diff --git a/.agents/skills/aidesigner-frontend/SKILL.md b/.agents/skills/aidesigner-frontend/SKILL.md new file mode 100644 index 0000000..58e3f79 --- /dev/null +++ b/.agents/skills/aidesigner-frontend/SKILL.md @@ -0,0 +1,229 @@ +--- +name: "aidesigner-frontend" +description: "Use this skill when the user wants to create or redesign a frontend, landing page, dashboard, marketing page, or other UI with AIDesigner. Prefer the connected aidesigner MCP server for generate/refine, then use the local AIDesigner CLI for artifact capture, preview rendering, and repo-native adoption guidance." +--- + + + +# AIDesigner Frontend + +Use AIDesigner to establish a strong visual direction, then port that direction into the repo's real frontend stack instead of shipping raw HTML. + +## Mission + +1. Inspect the repo first. +2. Generate or refine an AIDesigner HTML artifact. +3. Capture that artifact into a local run. +4. Render a preview and adoption brief. +5. For clone work, run a local visual QA loop before calling it done. +6. Port the design into the repo's actual primitives, routes, tokens, and components. + +## Scope Defaults + +- Spend AIDesigner credits only when the user explicitly asked to use AIDesigner or clearly opted into that workflow. +- Prefer the connected `aidesigner` MCP server for `whoami`, `get_credit_status`, `generate_design`, and `refine_design`. +- Treat returned HTML as a design artifact first and implementation input second. +- Prefer one coherent direction over multiple weak variants. + +## Auth And Execution Surface + +- In Claude Code or Codex, prefer the connected `aidesigner` MCP server. That uses OAuth-backed account credits instead of API keys. +- For local helper usage outside a host-managed MCP connection, `AIDESIGNER_MCP_ACCESS_TOKEN` is the preferred bearer token. +- `AIDESIGNER_API_KEY` remains an explicit fallback for CI or manual usage. +- `AIDESIGNER_MCP_URL` and `AIDESIGNER_BASE_URL` are optional. +- For local file operations, always use the canonical AIDesigner CLI. Do not hand-roll `curl` calls. + +```bash +npx -y @aidesigner/agent-skills ... +``` + +Supported verbs: + +- `init` +- `doctor` +- `capture` +- `preview` +- `adopt` + +## Pre-Flight + +1. Before generating anything, look for repo design context in this order: + - `DESIGN.md`, `.aidesigner/DESIGN.md`, or `docs/design.md` if present + - theme files, token files, Tailwind config, CSS variables, font setup, and shared UI primitives + - the target route or page plus nearby components to understand real layout and interaction patterns +2. If no design brief file exists, inspect the repo directly and infer the existing design system from code before spending credits. +3. Write a compact internal design brief that covers: + - platform and target surface + - product goal and primary user action + - existing visual language to preserve or intentionally move away from + - important repo patterns, constraints, and content types + - typography, tokens, surfaces, spacing, and motion only when the repo already defines them or the user explicitly wants the current aesthetic preserved + - any explicit must-haves or do-not-break constraints from the repo or user +4. Decide whether the request is: + - prompt-only generation + - `clone` for a faithful recreation of a specific URL + - `enhance` for a redesign that preserves a specific URL's content or intent + - `inspire` for a new direction based on a specific URL's visual style +5. If the request is `clone`, verify screenshot-capable browser tooling before spending credits. + - Check whether Puppeteer or equivalent local browser automation is already available. + - If it is missing, install `puppeteer` in the repo using the repo package manager before generation so visual QA can happen after the run. + - Do not start clone generation when you already know screenshot QA cannot run. + +## Workflow + +### 1. Build The Visual Prompt + +- Split the work into two layers: + - visual reference prompt for AIDesigner + - implementation spec you keep local for the real build +- Convert the user's ask plus that design brief into a broad visual reference prompt. +- Give AIDesigner room to invent structure, composition, visual rhythm, and stylistic details. +- Focus the prompt on product type, audience, UX priorities, desired feel, and non-negotiable constraints. +- Do not prescribe exact section order, card counts, copy, button labels, or detailed per-element placement unless the user explicitly asked for those specifics. +- Do not forward full content inventories, exhaustive section lists, parameter tables, example responses, CLI command matrices, or other documentation detail dumps into the AIDesigner prompt. +- If the user provided a highly detailed product or content spec, compress it into a smaller set of visual requirements for AIDesigner, then keep the detailed spec for local implementation after the design artifact comes back. +- The AIDesigner prompt should usually stay short and art-directed rather than reading like a PRD or sitemap. +- If the repo already has an established design system or the user wants the same aesthetic, bias the prompt toward consistency with that system and it is fine to mention concrete colors, fonts, or tokens from the repo. +- If the repo is new or the user wants a visual reset, keep the prompt relatively general on visual styling. Describe the desired vibe and product feel, but do not lock the design into exact colors, gradients, or overly specific palette instructions unless the user explicitly asked for them. + +### 2. Generate Or Refine + +- If you are connected to the `aidesigner` MCP server, call its `generate_design` or `refine_design` tool with a compact repo summary as `repo_context`. +- If you are using the helper directly, it performs the repo scan for you. +- Keep MCP calls prompt-driven unless the user explicitly asked for a reference-URL workflow. +- Only use `clone` when the user explicitly wants a near-1:1 recreation, copy, match, or faithful clone of a specific URL. +- Only use `enhance` when the user explicitly wants to improve, redesign, modernize, or upgrade a specific URL while preserving its content or intent. +- Only use `inspire` when the user explicitly wants a new design inspired by a specific URL or its visual style. +- Before a `clone` generation or refinement, confirm screenshot tooling is available. If Puppeteer or equivalent browser automation is missing, install it first in the repo rather than discovering that blocker after spending credits. +- If the user only mentions a URL as background context, do not pass `mode` or `url`. +- If the user wants `clone`, `enhance`, or `inspire` but no reference URL is available yet, stop and ask for the URL before spending credits. +- If continuing a previous reference-mode run, prefer `refine_design` and keep the existing `mode` and `url` as long as the user still wants that same reference workflow. +- If the user explicitly wants to stop matching the reference and branch into a fresh direction, drop `mode` and `url` and continue prompt-only. If needed, refine from the latest HTML artifact instead of reusing a prior run id so the new iteration does not inherit the old reference. +- If repeated AIDesigner work is likely and no design brief file exists, you may suggest creating a human-reviewable `DESIGN.md` or `.aidesigner/DESIGN.md` after the first pass. Do not silently invent one during setup. + +If MCP succeeds, immediately persist the returned HTML into a local run: + +```bash +npx -y @aidesigner/agent-skills capture --html-file .aidesigner/mcp-latest.html \ + --prompt "" \ + --transport mcp \ + --remote-run-id "" +``` + +If MCP is unavailable or the server says auth is expired: + +- If `AIDESIGNER_API_KEY` is already configured, use `npx -y @aidesigner/agent-skills generate` or `npx -y @aidesigner/agent-skills refine` as the explicit fallback path. +- Otherwise stop and explain exactly how to connect AIDesigner: + 1. Run `npx -y @aidesigner/agent-skills init` in this repo, or `npx -y @aidesigner/agent-skills init --scope user` for all repos + 2. Open the host client + 3. Open its MCP panel or login flow + 4. Connect the `aidesigner` server and finish browser sign-in + 5. Retry the request +- Mention the fallback alternative: set `AIDESIGNER_API_KEY` and retry. + +### 3. Preview And Adopt + +- After every successful run, ensure the user gets visuals. +- Use the preview created by `capture` or run: + +```bash +npx -y @aidesigner/agent-skills preview --id +``` + +- Run adoption analysis before porting: + +```bash +npx -y @aidesigner/agent-skills adopt --id +``` + +### 3A. Clone QA Loop + +- If the request used `clone`, do not stop at the first generation. +- Clone QA must be visual, not just text-based. DOM inspection or structural reasoning can help, but they do NOT replace screenshot comparison. +- Capture screenshots of the generated result with browser automation. Prefer the preview created by `npx -y @aidesigner/agent-skills preview`, host-provided browser tools, or local automation such as Playwright or Puppeteer. +- If the clone has been ported into the repo, capture screenshots of the integrated page itself, not only the raw HTML artifact, whenever possible. +- Compare the generated screenshots against the reference URL and any available reference screenshots. +- Check for hard fidelity issues: + - section order and section count + - major layout geometry and container widths + - spacing rhythm and alignment + - typography scale, weight, and line-height + - image role, crop, and placement + - backgrounds, gradients, borders, shadows, and overlays + - repeated block counts such as logos, cards, testimonials, FAQs, and footer columns +- If no screenshot-capable browser tooling is available, stop and surface that blocker. Ask to install or enable a browser automation tool such as Playwright or Puppeteer before claiming clone QA is complete. +- If meaningful mismatches remain, fix them locally yourself in the HTML artifact or repo code. Do not spend another AIDesigner credit for small or medium visual corrections the agent can make directly. +- After local edits, render a fresh preview and compare again. Repeat until the remaining differences are minor or a real blocker remains. +- Use `refine_design` only when the clone is fundamentally off and a local correction pass would be slower or less reliable than another model iteration. +- When the clone has already been ported into the repo, prefer QA on the integrated implementation instead of only the raw artifact whenever local browser tooling is available. + +### 4. Port Into The Repo + +- Use the AIDesigner output as a strong design reference or inspiration board when building the real page or component locally. +- Do not paste raw standalone HTML into framework code when the repo has real frontend primitives. +- The design artifact defines two distinct layers - port them differently: + - **Design system layer (match precisely):** Extract and faithfully reproduce every visual decision from the artifact - color palette, gradients, shadows, border radii, border styles, spacing values, font sizes, font weights, letter-spacing, line-height, background effects, opacity values, hover and transition states, and layout structure. Convert these into the repo's native token system rather than approximating with "close enough" utility classes. When the artifact defines specific values, those are the spec. + - **Content layer (adapt freely):** Copy, section count, placeholder data, button labels, testimonial quotes, and other content should be filled in from the user's actual product context and request. The artifact's content is illustrative, not prescriptive. +- Clone exception: when the reference or artifact includes explicit media assets that are necessary for fidelity - product screenshots, brand logos, hero images, photography, illustrations, icon sprites, or videos - preserve them. Do not replace real asset URLs with homemade mocks, inline SVG approximations, placeholder art, or reconstructed fake UI unless the originals are unavailable or the user explicitly asked for substitution. +- For clone ports, run an asset audit before sign-off: + - compare key image or media references from the artifact/reference against the repo implementation + - make sure major screenshots, logos, hero visuals, and repeated brand assets still exist after the port + - if the artifact used real external assets, do not declare the clone complete when the integrated implementation has silently dropped them +- When porting the design system layer, work methodically: + 1. First extract theme tokens from the artifact config or styles and define them in the repo's token system. + 2. Then port each component's visual structure, preserving exact class values for spacing, sizing, and effects. + 3. Do not substitute approximate values such as `pt-48` for `pt-32`, `min-h-screen` for `min-h-[90vh]`, or `text-6xl` for `text-[64px]`. +- Reuse the repo's existing routes, components, and token system where possible. +- Preserve accessibility basics and responsiveness while porting the design. + +### 5. Parallelize Large Ports With Subagents + +- If the artifact is large enough that one agent would be juggling multiple distinct sections, component families, or screens at once, split the implementation into focused subagent tasks. +- Keep the foundation work in the main agent: + - token extraction + - shared primitives + - route shell and page composition + - final integration decisions +- Use subagents for leaf-level porting work that can be done independently, such as: + - hero section + - feature section + - pricing grid + - testimonial rail + - FAQ block + - footer + - dashboard panel group + - repeated card family +- Split by coherent section or component family, not by arbitrary DOM slices. +- Give each subagent a tight scope: + - the exact section or component family to port + - the target files it may touch + - the relevant artifact fragment, screenshot, or HTML slice + - the non-negotiable tokens, spacing values, and visual constraints it must preserve +- Do not let multiple subagents edit the same component or file family unless the main agent is intentionally coordinating a merge. +- After subagents finish, the main agent must normalize shared primitives, remove duplicate token definitions, and make the final composition feel consistent. +- Use subagents to reduce cognitive load, not to avoid design judgment. The main agent remains responsible for fidelity and final integration quality. + +## Required Outputs + +After a successful run, provide or record all of the following: + +- the final visual prompt or a concise prompt summary +- the remote run id if MCP returned one +- the local run id under `.aidesigner/runs//` +- the preview image path +- the adoption brief path, or explicit confirmation that adoption analysis was run +- the intended route, component, or surface targets for repo integration +- any unresolved blockers or risks if the design could not be fully adopted + +## References + +- For the API contract and helper behavior: [references/api.md](references/api.md) +- For the frontend adoption quality bar: [references/frontend-rubric.md](references/frontend-rubric.md) + +## Operating Rules + +- If neither MCP nor `AIDESIGNER_API_KEY` is available, stop and explain how to run `npx -y @aidesigner/agent-skills init` and reconnect through the host's MCP flow. +- Do not present raw HTML as the final integrated implementation for framework repos. +- Apply the original detailed requirements during implementation, not by forcing them all into the AIDesigner prompt. +- If repo context and user intent conflict, preserve the repo's design system unless the user explicitly wants a new visual direction. diff --git a/.agents/skills/aidesigner-frontend/references/api.md b/.agents/skills/aidesigner-frontend/references/api.md new file mode 100644 index 0000000..b93fee1 --- /dev/null +++ b/.agents/skills/aidesigner-frontend/references/api.md @@ -0,0 +1,89 @@ +# AIDesigner Frontend API Reference + +This skill prefers the AIDesigner OAuth-backed remote MCP server for interactive Claude, Codex, Cursor, and Copilot usage and keeps the generate-design API as a fallback. + +## Preferred MCP Surface + +- MCP endpoint: `POST /api/v1/mcp` +- OAuth discovery: + - `GET /.well-known/oauth-protected-resource` + - `GET /.well-known/oauth-authorization-server` +- OAuth endpoints: + - `GET /api/v1/mcp/oauth/authorize` + - `POST /api/v1/mcp/oauth/token` + - `POST /api/v1/mcp/oauth/register` + - `POST /api/v1/mcp/oauth/revoke` +- MCP tools: + - `generate_design` + - `refine_design` + - `get_credit_status` + - `whoami` + +When a host is connected to the `aidesigner` MCP server, the host manages OAuth login and token refresh. The agent should use the MCP tools directly. + +## API-Key Fallback + +- `POST /api/v1/generateDesign` +- Default base URL: `https://api.aidesigner.ai` +- Auth header: `Authorization: Bearer ` + +## Supported Request Fields + +- `prompt: string` +- `messages: array` +- `streaming: boolean` +- `mode: inspire | clone | enhance` +- `url: string` when `mode` is present + +The helper script uses `streaming: false` on the fallback API path so it can reliably capture a complete HTML artifact, write files, and render previews. + +## Skill-Side Request Strategy + +The agent or helper sends a compact repo summary plus the user request. Use this to make the output fit the destination codebase: + +- framework and app shell +- route surface candidates +- token sources +- component-library clues +- design language hints + +The goal is not to make AIDesigner emit final production code for the repo. The goal is to generate a strong visual artifact that the agent can then port into the repo responsibly. + +## Verb Mapping + +### `generate` + +Creates a fresh local run and writes: + +- `request.json` +- `repo-context.json` +- `design.html` +- `preview.png` +- `summary.json` + +### `refine` + +Loads a prior run, preserves parent context, and writes a new run with a `parentRunId`. On the MCP path, remote run ids are also persisted server-side so follow-up refinements can reference them directly. + +### `preview` + +Renders an HTML artifact to a PNG preview using local browser automation when available. + +For clone workflows, this preview is part of the required visual QA loop. Agents should compare screenshots, not just inspect HTML or DOM structure. + +### `adopt` + +Reads the current run plus repo context and writes an adoption brief so the agent knows how to turn the artifact into repo-native code. + +## Error Handling Expectations + +Surface failures clearly: + +- missing or invalid OAuth token +- missing or invalid API key fallback +- insufficient credits +- invalid reference URL +- upstream generation failure +- preview renderer unavailable + +When preview rendering fails, keep the HTML artifact and explain the preview blocker. For clone workflows, the agent should request installation or enablement of browser automation such as Playwright or Puppeteer instead of silently skipping visual QA. diff --git a/.agents/skills/aidesigner-frontend/references/frontend-rubric.md b/.agents/skills/aidesigner-frontend/references/frontend-rubric.md new file mode 100644 index 0000000..ff2f2bc --- /dev/null +++ b/.agents/skills/aidesigner-frontend/references/frontend-rubric.md @@ -0,0 +1,82 @@ +# AIDesigner Frontend Rubric + +Use this rubric when turning an AIDesigner artifact into repo-native code. + +## 1. Commit To A Clear Visual Direction + +- Pick one strong aesthetic and carry it consistently. +- Avoid generic "AI-generated" layouts that feel interchangeable. +- Make typography, spacing, color, and imagery feel intentionally related. + +## 2. Respect The Repo Before Inventing + +- Reuse existing routes, shell patterns, and navigation conventions. +- Reuse component-library primitives before creating new base components. +- Preserve tokens from CSS variables, theme files, and utility conventions. + +## 3. Port, Do Not Paste + +- Treat generated HTML as a mockup artifact. +- Treat the AIDesigner prompt as a visual-direction tool, not the final content spec. +- Break the layout into logical sections and components. +- Map classes, spacing, and color choices into the repo's actual styling system. +- Remove dead CSS, duplicated wrappers, and one-off resets that fight the host app. + +## 4. Keep The Implementation Production-Minded + +- Maintain responsiveness across mobile and desktop. +- Preserve accessibility basics: headings, landmarks, labels, contrast, focus states. +- Keep animations purposeful and light. +- Avoid image-heavy hero sections that hide weak layout thinking. + +## 5. Push Quality Upward + +- If the repo already has a design system, make the new work feel like its strongest expression. +- If the repo is visually weak, still integrate cleanly but move the design forward with confidence. +- Prefer one polished direction over a bag of trends. + +## 6. Adoption Heuristics + +### Clone Fidelity + +- For clone work, the acceptance bar is visual fidelity, not just thematic similarity. +- Compare screenshots of the generated preview or integrated implementation against the reference and look for concrete mismatches before declaring success. +- Text-only checks, DOM inspection, or structural summaries are insufficient on their own. +- Use browser automation when needed to capture screenshots. If the environment cannot take screenshots yet, surface that blocker and request installation or enablement of a tool such as Playwright or Puppeteer. +- Preserve section order, section count, repeated block count, image roles, and the overall page rhythm unless the user explicitly asked for a deviation. +- Preserve fidelity-critical media assets when they are part of the reference. Product screenshots, logos, photography, illustrations, and other explicit reference media are not interchangeable placeholder content. +- Run an asset-presence audit before sign-off. If the artifact/reference contains key media assets and the integrated implementation replaced them with mocks or dropped them entirely, the clone is not done. +- Fix visual gaps locally when they are specific and actionable. Do not default to another generation pass for spacing, typography, color, crop, or alignment issues the agent can correct directly. + +### Content-Heavy Surfaces + +- For docs, pricing, dashboards, and other content-dense pages, use AIDesigner to establish the visual system, rhythm, and component language. +- Keep the exact information architecture, copy fidelity, data tables, and reference details in the local implementation layer. +- Do not force every real content requirement into the generation prompt up front. + +### Next.js / React + +- Convert repeated sections into components. +- Prefer server and client boundaries that match existing app patterns. +- Keep business logic out of presentation-only layout components. + +### Tailwind Projects + +- Reuse established spacing, radius, shadow, and color tokens. +- Avoid enormous arbitrary values when existing scales can express the same design. + +### Radix Or shadcn-Style Stacks + +- Compose with existing primitives for dialogs, tabs, popovers, buttons, and form controls. +- Keep custom styling layered on top of those primitives instead of replacing them. + +### Dashboard Surfaces + +- Protect information density and navigation clarity. +- Do not sacrifice usability for spectacle. + +### Marketing Surfaces + +- Lead with hierarchy, clarity, and conversion. +- Make CTA contrast obvious. +- Ensure hero, proof, feature explanation, and CTA flow read naturally. diff --git a/.aidesigner/.gitkeep b/.aidesigner/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.claude/agents/aidesigner-frontend.md b/.claude/agents/aidesigner-frontend.md new file mode 100644 index 0000000..58e3f79 --- /dev/null +++ b/.claude/agents/aidesigner-frontend.md @@ -0,0 +1,229 @@ +--- +name: "aidesigner-frontend" +description: "Use this skill when the user wants to create or redesign a frontend, landing page, dashboard, marketing page, or other UI with AIDesigner. Prefer the connected aidesigner MCP server for generate/refine, then use the local AIDesigner CLI for artifact capture, preview rendering, and repo-native adoption guidance." +--- + + + +# AIDesigner Frontend + +Use AIDesigner to establish a strong visual direction, then port that direction into the repo's real frontend stack instead of shipping raw HTML. + +## Mission + +1. Inspect the repo first. +2. Generate or refine an AIDesigner HTML artifact. +3. Capture that artifact into a local run. +4. Render a preview and adoption brief. +5. For clone work, run a local visual QA loop before calling it done. +6. Port the design into the repo's actual primitives, routes, tokens, and components. + +## Scope Defaults + +- Spend AIDesigner credits only when the user explicitly asked to use AIDesigner or clearly opted into that workflow. +- Prefer the connected `aidesigner` MCP server for `whoami`, `get_credit_status`, `generate_design`, and `refine_design`. +- Treat returned HTML as a design artifact first and implementation input second. +- Prefer one coherent direction over multiple weak variants. + +## Auth And Execution Surface + +- In Claude Code or Codex, prefer the connected `aidesigner` MCP server. That uses OAuth-backed account credits instead of API keys. +- For local helper usage outside a host-managed MCP connection, `AIDESIGNER_MCP_ACCESS_TOKEN` is the preferred bearer token. +- `AIDESIGNER_API_KEY` remains an explicit fallback for CI or manual usage. +- `AIDESIGNER_MCP_URL` and `AIDESIGNER_BASE_URL` are optional. +- For local file operations, always use the canonical AIDesigner CLI. Do not hand-roll `curl` calls. + +```bash +npx -y @aidesigner/agent-skills ... +``` + +Supported verbs: + +- `init` +- `doctor` +- `capture` +- `preview` +- `adopt` + +## Pre-Flight + +1. Before generating anything, look for repo design context in this order: + - `DESIGN.md`, `.aidesigner/DESIGN.md`, or `docs/design.md` if present + - theme files, token files, Tailwind config, CSS variables, font setup, and shared UI primitives + - the target route or page plus nearby components to understand real layout and interaction patterns +2. If no design brief file exists, inspect the repo directly and infer the existing design system from code before spending credits. +3. Write a compact internal design brief that covers: + - platform and target surface + - product goal and primary user action + - existing visual language to preserve or intentionally move away from + - important repo patterns, constraints, and content types + - typography, tokens, surfaces, spacing, and motion only when the repo already defines them or the user explicitly wants the current aesthetic preserved + - any explicit must-haves or do-not-break constraints from the repo or user +4. Decide whether the request is: + - prompt-only generation + - `clone` for a faithful recreation of a specific URL + - `enhance` for a redesign that preserves a specific URL's content or intent + - `inspire` for a new direction based on a specific URL's visual style +5. If the request is `clone`, verify screenshot-capable browser tooling before spending credits. + - Check whether Puppeteer or equivalent local browser automation is already available. + - If it is missing, install `puppeteer` in the repo using the repo package manager before generation so visual QA can happen after the run. + - Do not start clone generation when you already know screenshot QA cannot run. + +## Workflow + +### 1. Build The Visual Prompt + +- Split the work into two layers: + - visual reference prompt for AIDesigner + - implementation spec you keep local for the real build +- Convert the user's ask plus that design brief into a broad visual reference prompt. +- Give AIDesigner room to invent structure, composition, visual rhythm, and stylistic details. +- Focus the prompt on product type, audience, UX priorities, desired feel, and non-negotiable constraints. +- Do not prescribe exact section order, card counts, copy, button labels, or detailed per-element placement unless the user explicitly asked for those specifics. +- Do not forward full content inventories, exhaustive section lists, parameter tables, example responses, CLI command matrices, or other documentation detail dumps into the AIDesigner prompt. +- If the user provided a highly detailed product or content spec, compress it into a smaller set of visual requirements for AIDesigner, then keep the detailed spec for local implementation after the design artifact comes back. +- The AIDesigner prompt should usually stay short and art-directed rather than reading like a PRD or sitemap. +- If the repo already has an established design system or the user wants the same aesthetic, bias the prompt toward consistency with that system and it is fine to mention concrete colors, fonts, or tokens from the repo. +- If the repo is new or the user wants a visual reset, keep the prompt relatively general on visual styling. Describe the desired vibe and product feel, but do not lock the design into exact colors, gradients, or overly specific palette instructions unless the user explicitly asked for them. + +### 2. Generate Or Refine + +- If you are connected to the `aidesigner` MCP server, call its `generate_design` or `refine_design` tool with a compact repo summary as `repo_context`. +- If you are using the helper directly, it performs the repo scan for you. +- Keep MCP calls prompt-driven unless the user explicitly asked for a reference-URL workflow. +- Only use `clone` when the user explicitly wants a near-1:1 recreation, copy, match, or faithful clone of a specific URL. +- Only use `enhance` when the user explicitly wants to improve, redesign, modernize, or upgrade a specific URL while preserving its content or intent. +- Only use `inspire` when the user explicitly wants a new design inspired by a specific URL or its visual style. +- Before a `clone` generation or refinement, confirm screenshot tooling is available. If Puppeteer or equivalent browser automation is missing, install it first in the repo rather than discovering that blocker after spending credits. +- If the user only mentions a URL as background context, do not pass `mode` or `url`. +- If the user wants `clone`, `enhance`, or `inspire` but no reference URL is available yet, stop and ask for the URL before spending credits. +- If continuing a previous reference-mode run, prefer `refine_design` and keep the existing `mode` and `url` as long as the user still wants that same reference workflow. +- If the user explicitly wants to stop matching the reference and branch into a fresh direction, drop `mode` and `url` and continue prompt-only. If needed, refine from the latest HTML artifact instead of reusing a prior run id so the new iteration does not inherit the old reference. +- If repeated AIDesigner work is likely and no design brief file exists, you may suggest creating a human-reviewable `DESIGN.md` or `.aidesigner/DESIGN.md` after the first pass. Do not silently invent one during setup. + +If MCP succeeds, immediately persist the returned HTML into a local run: + +```bash +npx -y @aidesigner/agent-skills capture --html-file .aidesigner/mcp-latest.html \ + --prompt "" \ + --transport mcp \ + --remote-run-id "" +``` + +If MCP is unavailable or the server says auth is expired: + +- If `AIDESIGNER_API_KEY` is already configured, use `npx -y @aidesigner/agent-skills generate` or `npx -y @aidesigner/agent-skills refine` as the explicit fallback path. +- Otherwise stop and explain exactly how to connect AIDesigner: + 1. Run `npx -y @aidesigner/agent-skills init` in this repo, or `npx -y @aidesigner/agent-skills init --scope user` for all repos + 2. Open the host client + 3. Open its MCP panel or login flow + 4. Connect the `aidesigner` server and finish browser sign-in + 5. Retry the request +- Mention the fallback alternative: set `AIDESIGNER_API_KEY` and retry. + +### 3. Preview And Adopt + +- After every successful run, ensure the user gets visuals. +- Use the preview created by `capture` or run: + +```bash +npx -y @aidesigner/agent-skills preview --id +``` + +- Run adoption analysis before porting: + +```bash +npx -y @aidesigner/agent-skills adopt --id +``` + +### 3A. Clone QA Loop + +- If the request used `clone`, do not stop at the first generation. +- Clone QA must be visual, not just text-based. DOM inspection or structural reasoning can help, but they do NOT replace screenshot comparison. +- Capture screenshots of the generated result with browser automation. Prefer the preview created by `npx -y @aidesigner/agent-skills preview`, host-provided browser tools, or local automation such as Playwright or Puppeteer. +- If the clone has been ported into the repo, capture screenshots of the integrated page itself, not only the raw HTML artifact, whenever possible. +- Compare the generated screenshots against the reference URL and any available reference screenshots. +- Check for hard fidelity issues: + - section order and section count + - major layout geometry and container widths + - spacing rhythm and alignment + - typography scale, weight, and line-height + - image role, crop, and placement + - backgrounds, gradients, borders, shadows, and overlays + - repeated block counts such as logos, cards, testimonials, FAQs, and footer columns +- If no screenshot-capable browser tooling is available, stop and surface that blocker. Ask to install or enable a browser automation tool such as Playwright or Puppeteer before claiming clone QA is complete. +- If meaningful mismatches remain, fix them locally yourself in the HTML artifact or repo code. Do not spend another AIDesigner credit for small or medium visual corrections the agent can make directly. +- After local edits, render a fresh preview and compare again. Repeat until the remaining differences are minor or a real blocker remains. +- Use `refine_design` only when the clone is fundamentally off and a local correction pass would be slower or less reliable than another model iteration. +- When the clone has already been ported into the repo, prefer QA on the integrated implementation instead of only the raw artifact whenever local browser tooling is available. + +### 4. Port Into The Repo + +- Use the AIDesigner output as a strong design reference or inspiration board when building the real page or component locally. +- Do not paste raw standalone HTML into framework code when the repo has real frontend primitives. +- The design artifact defines two distinct layers - port them differently: + - **Design system layer (match precisely):** Extract and faithfully reproduce every visual decision from the artifact - color palette, gradients, shadows, border radii, border styles, spacing values, font sizes, font weights, letter-spacing, line-height, background effects, opacity values, hover and transition states, and layout structure. Convert these into the repo's native token system rather than approximating with "close enough" utility classes. When the artifact defines specific values, those are the spec. + - **Content layer (adapt freely):** Copy, section count, placeholder data, button labels, testimonial quotes, and other content should be filled in from the user's actual product context and request. The artifact's content is illustrative, not prescriptive. +- Clone exception: when the reference or artifact includes explicit media assets that are necessary for fidelity - product screenshots, brand logos, hero images, photography, illustrations, icon sprites, or videos - preserve them. Do not replace real asset URLs with homemade mocks, inline SVG approximations, placeholder art, or reconstructed fake UI unless the originals are unavailable or the user explicitly asked for substitution. +- For clone ports, run an asset audit before sign-off: + - compare key image or media references from the artifact/reference against the repo implementation + - make sure major screenshots, logos, hero visuals, and repeated brand assets still exist after the port + - if the artifact used real external assets, do not declare the clone complete when the integrated implementation has silently dropped them +- When porting the design system layer, work methodically: + 1. First extract theme tokens from the artifact config or styles and define them in the repo's token system. + 2. Then port each component's visual structure, preserving exact class values for spacing, sizing, and effects. + 3. Do not substitute approximate values such as `pt-48` for `pt-32`, `min-h-screen` for `min-h-[90vh]`, or `text-6xl` for `text-[64px]`. +- Reuse the repo's existing routes, components, and token system where possible. +- Preserve accessibility basics and responsiveness while porting the design. + +### 5. Parallelize Large Ports With Subagents + +- If the artifact is large enough that one agent would be juggling multiple distinct sections, component families, or screens at once, split the implementation into focused subagent tasks. +- Keep the foundation work in the main agent: + - token extraction + - shared primitives + - route shell and page composition + - final integration decisions +- Use subagents for leaf-level porting work that can be done independently, such as: + - hero section + - feature section + - pricing grid + - testimonial rail + - FAQ block + - footer + - dashboard panel group + - repeated card family +- Split by coherent section or component family, not by arbitrary DOM slices. +- Give each subagent a tight scope: + - the exact section or component family to port + - the target files it may touch + - the relevant artifact fragment, screenshot, or HTML slice + - the non-negotiable tokens, spacing values, and visual constraints it must preserve +- Do not let multiple subagents edit the same component or file family unless the main agent is intentionally coordinating a merge. +- After subagents finish, the main agent must normalize shared primitives, remove duplicate token definitions, and make the final composition feel consistent. +- Use subagents to reduce cognitive load, not to avoid design judgment. The main agent remains responsible for fidelity and final integration quality. + +## Required Outputs + +After a successful run, provide or record all of the following: + +- the final visual prompt or a concise prompt summary +- the remote run id if MCP returned one +- the local run id under `.aidesigner/runs//` +- the preview image path +- the adoption brief path, or explicit confirmation that adoption analysis was run +- the intended route, component, or surface targets for repo integration +- any unresolved blockers or risks if the design could not be fully adopted + +## References + +- For the API contract and helper behavior: [references/api.md](references/api.md) +- For the frontend adoption quality bar: [references/frontend-rubric.md](references/frontend-rubric.md) + +## Operating Rules + +- If neither MCP nor `AIDESIGNER_API_KEY` is available, stop and explain how to run `npx -y @aidesigner/agent-skills init` and reconnect through the host's MCP flow. +- Do not present raw HTML as the final integrated implementation for framework repos. +- Apply the original detailed requirements during implementation, not by forcing them all into the AIDesigner prompt. +- If repo context and user intent conflict, preserve the repo's design system unless the user explicitly wants a new visual direction. diff --git a/.claude/commands/aidesigner.md b/.claude/commands/aidesigner.md new file mode 100644 index 0000000..70c8968 --- /dev/null +++ b/.claude/commands/aidesigner.md @@ -0,0 +1,111 @@ + + +Use AIDesigner for the request in $ARGUMENTS. + +## Scope Defaults + +- Spend AIDesigner credits only when the user explicitly asked to use AIDesigner or clearly opted into that workflow. +- Prefer the connected `aidesigner` MCP server for `whoami`, `get_credit_status`, `generate_design`, and `refine_design`. +- Treat HTML as a design artifact first and implementation input second. + +## Pre-Flight + +1. Gather design context before spending credits: + - Read `DESIGN.md`, `.aidesigner/DESIGN.md`, or `docs/design.md` if present. + - Inspect theme files, tokens, fonts, shared components, and the target route or page. +2. Write a compact internal design brief from that repo context: + - platform and surface + - product goal and main user action + - visual language to preserve, evolve, or reset + - important repo patterns, constraints, and content types + - concrete typography or tokens only if preserving the current repo aesthetic +3. Split the task into: + - a visual reference prompt for AIDesigner + - a detailed implementation spec you keep local +4. If this will use `mode: "clone"`, check for screenshot-capable browser tooling before spending credits. + - If Puppeteer or equivalent browser automation is missing, install `puppeteer` in the repo with the repo package manager first. + - Do not start clone generation when visual QA tooling is known to be unavailable. + +## Workflow + +### 1. Build The Visual Prompt + +Rewrite `$ARGUMENTS` into a broad visual reference prompt before calling AIDesigner. + +- Focus on product type, audience, UX priorities, overall feel, and non-negotiable constraints. +- Let AIDesigner choose the specific layout, supporting sections, composition, and most stylistic details. +- Avoid exact section orders, card counts, micro-copy, and detailed per-element placement unless the user explicitly requested them. +- Do not pass exhaustive content outlines, tables, command lists, API fields, or other documentation detail dumps into the prompt. +- If the user gave a very specific page spec, compress it into a smaller visual brief for AIDesigner and save the full spec for local implementation. +- If matching an existing aesthetic, it is fine to mention concrete repo colors, fonts, and tokens. +- If this is a new design or revamp, keep styling guidance broad and do not hard-code exact colors or gradients unless the user explicitly asked for them. + +### 2. Generate Or Refine + +- Keep MCP calls prompt-driven unless the user explicitly asked for a reference-URL workflow. +- Use `mode: "clone"` only for a near-1:1 recreation or faithful copy of a specific URL. +- Use `mode: "enhance"` only to improve or modernize a specific URL while preserving its content or intent. +- Use `mode: "inspire"` only for a new design inspired by a specific URL or its visual style. +- Before `mode: "clone"` generation or refinement, make sure Puppeteer or equivalent screenshot tooling is installed. If it is missing, install it before you spend credits. +- If the user only mentions a URL as context, do not pass `mode` or `url`. +- If the user wants one of those reference workflows but has not provided the URL yet, stop and ask for it before spending credits. +- If a prior run already used a reference mode and the user still wants that workflow, use `refine_design` and keep the same `mode` and `url`. +- If the user explicitly wants to move away from the reference, drop `mode` and `url` and continue prompt-only. Refine from the latest HTML artifact instead of a prior run id if you need to avoid inheriting the old reference mode. + +After a successful MCP generation or refinement, persist the returned HTML into a local run: + +```bash +npx -y @aidesigner/agent-skills capture --html-file .aidesigner/mcp-latest.html \ + --prompt "" \ + --transport mcp \ + --remote-run-id "" +``` + +If MCP is unavailable or needs re-auth: + +- If `AIDESIGNER_API_KEY` is already set, use `npx -y @aidesigner/agent-skills generate --prompt ""`. +- Otherwise stop and show setup instructions: + - Recommended: `npx -y @aidesigner/agent-skills init`, then reconnect through the host's MCP flow and sign into `aidesigner`. + - Cross-repo: `npx -y @aidesigner/agent-skills init --scope user` + - Fallback: set `AIDESIGNER_API_KEY` and retry + +### 3. Preview, Adopt, And Port + +- After every successful run, use the preview image and run `npx -y @aidesigner/agent-skills adopt --id `. +- For `mode: "clone"`, run a visual QA loop before calling the result done: + - screenshot the result with browser automation, using the preview output, host browser tools, or Playwright/Puppeteer + - if the page is integrated into the repo, prefer screenshots of the integrated implementation + - compare those screenshots against the reference URL and any available screenshots + - check section order, layout geometry, spacing, typography, image placement, backgrounds, and repeated block counts + - text-only or DOM-only verification is not sufficient + - if no screenshot-capable browser tooling is available, stop and ask to install or enable one before claiming QA is complete + - fix remaining fidelity issues locally yourself in the HTML artifact or repo code + - rerender the preview after edits and repeat until only minor differences remain + - use `refine_design` only if the clone is fundamentally off and local edits are a worse option +- The design artifact defines two distinct layers - port them differently: + - Design system layer (match precisely): extract and faithfully reproduce every visual decision from the artifact - palette, gradients, shadows, radii, border styles, spacing, typography values, background effects, opacity, transitions, and layout structure. Convert them into the repo's native token system rather than approximating with "close enough" utility classes. When the artifact defines exact values, those are the spec. + - Content layer (adapt freely): copy, section count, placeholder data, button labels, testimonial quotes, and other content should come from the user's actual product context and request unless they explicitly asked for a close recreation. +- In clone mode, treat reference-provided media assets as fidelity-critical. Preserve real product screenshots, logos, hero images, photos, illustrations, and videos when they exist. +- Do not replace real asset URLs with homemade mocks, inline SVG stand-ins, or fake reconstructed UI unless the originals are unavailable or the user explicitly asked for substitution. +- Before signing off a clone port, run a simple asset audit so key screenshots and logos present in the artifact/reference are still present in the integrated implementation. +- When porting the design system layer, work methodically: + - First extract theme tokens from the artifact config or styles and define them in the repo token system. + - Then port each component's visual structure, preserving exact spacing, sizing, and effects. + - Do not substitute approximate values such as `pt-48` for `pt-32`, `min-h-screen` for `min-h-[90vh]`, or `text-6xl` for `text-[64px]`. +- For very large HTML ports, split the implementation into section-level or component-family subagent tasks. +- Keep tokens, shared primitives, route shell, and final integration in the main agent. +- Use subagents only for independent leaf sections, and give each one a tight file scope plus the exact artifact fragment it must port. +- Apply the full user requirements during repo implementation using local content, behaviors, and component structure. Do not ship raw standalone HTML into app code. + +## Required Outputs + +At the end of a successful run, provide or record: + +- the final prompt or a concise prompt summary +- the remote run id if MCP returned one +- the local run id +- the preview image path +- the adoption brief path, or confirmation that adoption analysis ran +- the intended route or component targets for integration +- any blockers or remaining risks diff --git a/.claude/skills/aidesigner-frontend/SKILL.md b/.claude/skills/aidesigner-frontend/SKILL.md new file mode 100644 index 0000000..58e3f79 --- /dev/null +++ b/.claude/skills/aidesigner-frontend/SKILL.md @@ -0,0 +1,229 @@ +--- +name: "aidesigner-frontend" +description: "Use this skill when the user wants to create or redesign a frontend, landing page, dashboard, marketing page, or other UI with AIDesigner. Prefer the connected aidesigner MCP server for generate/refine, then use the local AIDesigner CLI for artifact capture, preview rendering, and repo-native adoption guidance." +--- + + + +# AIDesigner Frontend + +Use AIDesigner to establish a strong visual direction, then port that direction into the repo's real frontend stack instead of shipping raw HTML. + +## Mission + +1. Inspect the repo first. +2. Generate or refine an AIDesigner HTML artifact. +3. Capture that artifact into a local run. +4. Render a preview and adoption brief. +5. For clone work, run a local visual QA loop before calling it done. +6. Port the design into the repo's actual primitives, routes, tokens, and components. + +## Scope Defaults + +- Spend AIDesigner credits only when the user explicitly asked to use AIDesigner or clearly opted into that workflow. +- Prefer the connected `aidesigner` MCP server for `whoami`, `get_credit_status`, `generate_design`, and `refine_design`. +- Treat returned HTML as a design artifact first and implementation input second. +- Prefer one coherent direction over multiple weak variants. + +## Auth And Execution Surface + +- In Claude Code or Codex, prefer the connected `aidesigner` MCP server. That uses OAuth-backed account credits instead of API keys. +- For local helper usage outside a host-managed MCP connection, `AIDESIGNER_MCP_ACCESS_TOKEN` is the preferred bearer token. +- `AIDESIGNER_API_KEY` remains an explicit fallback for CI or manual usage. +- `AIDESIGNER_MCP_URL` and `AIDESIGNER_BASE_URL` are optional. +- For local file operations, always use the canonical AIDesigner CLI. Do not hand-roll `curl` calls. + +```bash +npx -y @aidesigner/agent-skills ... +``` + +Supported verbs: + +- `init` +- `doctor` +- `capture` +- `preview` +- `adopt` + +## Pre-Flight + +1. Before generating anything, look for repo design context in this order: + - `DESIGN.md`, `.aidesigner/DESIGN.md`, or `docs/design.md` if present + - theme files, token files, Tailwind config, CSS variables, font setup, and shared UI primitives + - the target route or page plus nearby components to understand real layout and interaction patterns +2. If no design brief file exists, inspect the repo directly and infer the existing design system from code before spending credits. +3. Write a compact internal design brief that covers: + - platform and target surface + - product goal and primary user action + - existing visual language to preserve or intentionally move away from + - important repo patterns, constraints, and content types + - typography, tokens, surfaces, spacing, and motion only when the repo already defines them or the user explicitly wants the current aesthetic preserved + - any explicit must-haves or do-not-break constraints from the repo or user +4. Decide whether the request is: + - prompt-only generation + - `clone` for a faithful recreation of a specific URL + - `enhance` for a redesign that preserves a specific URL's content or intent + - `inspire` for a new direction based on a specific URL's visual style +5. If the request is `clone`, verify screenshot-capable browser tooling before spending credits. + - Check whether Puppeteer or equivalent local browser automation is already available. + - If it is missing, install `puppeteer` in the repo using the repo package manager before generation so visual QA can happen after the run. + - Do not start clone generation when you already know screenshot QA cannot run. + +## Workflow + +### 1. Build The Visual Prompt + +- Split the work into two layers: + - visual reference prompt for AIDesigner + - implementation spec you keep local for the real build +- Convert the user's ask plus that design brief into a broad visual reference prompt. +- Give AIDesigner room to invent structure, composition, visual rhythm, and stylistic details. +- Focus the prompt on product type, audience, UX priorities, desired feel, and non-negotiable constraints. +- Do not prescribe exact section order, card counts, copy, button labels, or detailed per-element placement unless the user explicitly asked for those specifics. +- Do not forward full content inventories, exhaustive section lists, parameter tables, example responses, CLI command matrices, or other documentation detail dumps into the AIDesigner prompt. +- If the user provided a highly detailed product or content spec, compress it into a smaller set of visual requirements for AIDesigner, then keep the detailed spec for local implementation after the design artifact comes back. +- The AIDesigner prompt should usually stay short and art-directed rather than reading like a PRD or sitemap. +- If the repo already has an established design system or the user wants the same aesthetic, bias the prompt toward consistency with that system and it is fine to mention concrete colors, fonts, or tokens from the repo. +- If the repo is new or the user wants a visual reset, keep the prompt relatively general on visual styling. Describe the desired vibe and product feel, but do not lock the design into exact colors, gradients, or overly specific palette instructions unless the user explicitly asked for them. + +### 2. Generate Or Refine + +- If you are connected to the `aidesigner` MCP server, call its `generate_design` or `refine_design` tool with a compact repo summary as `repo_context`. +- If you are using the helper directly, it performs the repo scan for you. +- Keep MCP calls prompt-driven unless the user explicitly asked for a reference-URL workflow. +- Only use `clone` when the user explicitly wants a near-1:1 recreation, copy, match, or faithful clone of a specific URL. +- Only use `enhance` when the user explicitly wants to improve, redesign, modernize, or upgrade a specific URL while preserving its content or intent. +- Only use `inspire` when the user explicitly wants a new design inspired by a specific URL or its visual style. +- Before a `clone` generation or refinement, confirm screenshot tooling is available. If Puppeteer or equivalent browser automation is missing, install it first in the repo rather than discovering that blocker after spending credits. +- If the user only mentions a URL as background context, do not pass `mode` or `url`. +- If the user wants `clone`, `enhance`, or `inspire` but no reference URL is available yet, stop and ask for the URL before spending credits. +- If continuing a previous reference-mode run, prefer `refine_design` and keep the existing `mode` and `url` as long as the user still wants that same reference workflow. +- If the user explicitly wants to stop matching the reference and branch into a fresh direction, drop `mode` and `url` and continue prompt-only. If needed, refine from the latest HTML artifact instead of reusing a prior run id so the new iteration does not inherit the old reference. +- If repeated AIDesigner work is likely and no design brief file exists, you may suggest creating a human-reviewable `DESIGN.md` or `.aidesigner/DESIGN.md` after the first pass. Do not silently invent one during setup. + +If MCP succeeds, immediately persist the returned HTML into a local run: + +```bash +npx -y @aidesigner/agent-skills capture --html-file .aidesigner/mcp-latest.html \ + --prompt "" \ + --transport mcp \ + --remote-run-id "" +``` + +If MCP is unavailable or the server says auth is expired: + +- If `AIDESIGNER_API_KEY` is already configured, use `npx -y @aidesigner/agent-skills generate` or `npx -y @aidesigner/agent-skills refine` as the explicit fallback path. +- Otherwise stop and explain exactly how to connect AIDesigner: + 1. Run `npx -y @aidesigner/agent-skills init` in this repo, or `npx -y @aidesigner/agent-skills init --scope user` for all repos + 2. Open the host client + 3. Open its MCP panel or login flow + 4. Connect the `aidesigner` server and finish browser sign-in + 5. Retry the request +- Mention the fallback alternative: set `AIDESIGNER_API_KEY` and retry. + +### 3. Preview And Adopt + +- After every successful run, ensure the user gets visuals. +- Use the preview created by `capture` or run: + +```bash +npx -y @aidesigner/agent-skills preview --id +``` + +- Run adoption analysis before porting: + +```bash +npx -y @aidesigner/agent-skills adopt --id +``` + +### 3A. Clone QA Loop + +- If the request used `clone`, do not stop at the first generation. +- Clone QA must be visual, not just text-based. DOM inspection or structural reasoning can help, but they do NOT replace screenshot comparison. +- Capture screenshots of the generated result with browser automation. Prefer the preview created by `npx -y @aidesigner/agent-skills preview`, host-provided browser tools, or local automation such as Playwright or Puppeteer. +- If the clone has been ported into the repo, capture screenshots of the integrated page itself, not only the raw HTML artifact, whenever possible. +- Compare the generated screenshots against the reference URL and any available reference screenshots. +- Check for hard fidelity issues: + - section order and section count + - major layout geometry and container widths + - spacing rhythm and alignment + - typography scale, weight, and line-height + - image role, crop, and placement + - backgrounds, gradients, borders, shadows, and overlays + - repeated block counts such as logos, cards, testimonials, FAQs, and footer columns +- If no screenshot-capable browser tooling is available, stop and surface that blocker. Ask to install or enable a browser automation tool such as Playwright or Puppeteer before claiming clone QA is complete. +- If meaningful mismatches remain, fix them locally yourself in the HTML artifact or repo code. Do not spend another AIDesigner credit for small or medium visual corrections the agent can make directly. +- After local edits, render a fresh preview and compare again. Repeat until the remaining differences are minor or a real blocker remains. +- Use `refine_design` only when the clone is fundamentally off and a local correction pass would be slower or less reliable than another model iteration. +- When the clone has already been ported into the repo, prefer QA on the integrated implementation instead of only the raw artifact whenever local browser tooling is available. + +### 4. Port Into The Repo + +- Use the AIDesigner output as a strong design reference or inspiration board when building the real page or component locally. +- Do not paste raw standalone HTML into framework code when the repo has real frontend primitives. +- The design artifact defines two distinct layers - port them differently: + - **Design system layer (match precisely):** Extract and faithfully reproduce every visual decision from the artifact - color palette, gradients, shadows, border radii, border styles, spacing values, font sizes, font weights, letter-spacing, line-height, background effects, opacity values, hover and transition states, and layout structure. Convert these into the repo's native token system rather than approximating with "close enough" utility classes. When the artifact defines specific values, those are the spec. + - **Content layer (adapt freely):** Copy, section count, placeholder data, button labels, testimonial quotes, and other content should be filled in from the user's actual product context and request. The artifact's content is illustrative, not prescriptive. +- Clone exception: when the reference or artifact includes explicit media assets that are necessary for fidelity - product screenshots, brand logos, hero images, photography, illustrations, icon sprites, or videos - preserve them. Do not replace real asset URLs with homemade mocks, inline SVG approximations, placeholder art, or reconstructed fake UI unless the originals are unavailable or the user explicitly asked for substitution. +- For clone ports, run an asset audit before sign-off: + - compare key image or media references from the artifact/reference against the repo implementation + - make sure major screenshots, logos, hero visuals, and repeated brand assets still exist after the port + - if the artifact used real external assets, do not declare the clone complete when the integrated implementation has silently dropped them +- When porting the design system layer, work methodically: + 1. First extract theme tokens from the artifact config or styles and define them in the repo's token system. + 2. Then port each component's visual structure, preserving exact class values for spacing, sizing, and effects. + 3. Do not substitute approximate values such as `pt-48` for `pt-32`, `min-h-screen` for `min-h-[90vh]`, or `text-6xl` for `text-[64px]`. +- Reuse the repo's existing routes, components, and token system where possible. +- Preserve accessibility basics and responsiveness while porting the design. + +### 5. Parallelize Large Ports With Subagents + +- If the artifact is large enough that one agent would be juggling multiple distinct sections, component families, or screens at once, split the implementation into focused subagent tasks. +- Keep the foundation work in the main agent: + - token extraction + - shared primitives + - route shell and page composition + - final integration decisions +- Use subagents for leaf-level porting work that can be done independently, such as: + - hero section + - feature section + - pricing grid + - testimonial rail + - FAQ block + - footer + - dashboard panel group + - repeated card family +- Split by coherent section or component family, not by arbitrary DOM slices. +- Give each subagent a tight scope: + - the exact section or component family to port + - the target files it may touch + - the relevant artifact fragment, screenshot, or HTML slice + - the non-negotiable tokens, spacing values, and visual constraints it must preserve +- Do not let multiple subagents edit the same component or file family unless the main agent is intentionally coordinating a merge. +- After subagents finish, the main agent must normalize shared primitives, remove duplicate token definitions, and make the final composition feel consistent. +- Use subagents to reduce cognitive load, not to avoid design judgment. The main agent remains responsible for fidelity and final integration quality. + +## Required Outputs + +After a successful run, provide or record all of the following: + +- the final visual prompt or a concise prompt summary +- the remote run id if MCP returned one +- the local run id under `.aidesigner/runs//` +- the preview image path +- the adoption brief path, or explicit confirmation that adoption analysis was run +- the intended route, component, or surface targets for repo integration +- any unresolved blockers or risks if the design could not be fully adopted + +## References + +- For the API contract and helper behavior: [references/api.md](references/api.md) +- For the frontend adoption quality bar: [references/frontend-rubric.md](references/frontend-rubric.md) + +## Operating Rules + +- If neither MCP nor `AIDESIGNER_API_KEY` is available, stop and explain how to run `npx -y @aidesigner/agent-skills init` and reconnect through the host's MCP flow. +- Do not present raw HTML as the final integrated implementation for framework repos. +- Apply the original detailed requirements during implementation, not by forcing them all into the AIDesigner prompt. +- If repo context and user intent conflict, preserve the repo's design system unless the user explicitly wants a new visual direction. diff --git a/.claude/skills/aidesigner-frontend/references/api.md b/.claude/skills/aidesigner-frontend/references/api.md new file mode 100644 index 0000000..b93fee1 --- /dev/null +++ b/.claude/skills/aidesigner-frontend/references/api.md @@ -0,0 +1,89 @@ +# AIDesigner Frontend API Reference + +This skill prefers the AIDesigner OAuth-backed remote MCP server for interactive Claude, Codex, Cursor, and Copilot usage and keeps the generate-design API as a fallback. + +## Preferred MCP Surface + +- MCP endpoint: `POST /api/v1/mcp` +- OAuth discovery: + - `GET /.well-known/oauth-protected-resource` + - `GET /.well-known/oauth-authorization-server` +- OAuth endpoints: + - `GET /api/v1/mcp/oauth/authorize` + - `POST /api/v1/mcp/oauth/token` + - `POST /api/v1/mcp/oauth/register` + - `POST /api/v1/mcp/oauth/revoke` +- MCP tools: + - `generate_design` + - `refine_design` + - `get_credit_status` + - `whoami` + +When a host is connected to the `aidesigner` MCP server, the host manages OAuth login and token refresh. The agent should use the MCP tools directly. + +## API-Key Fallback + +- `POST /api/v1/generateDesign` +- Default base URL: `https://api.aidesigner.ai` +- Auth header: `Authorization: Bearer ` + +## Supported Request Fields + +- `prompt: string` +- `messages: array` +- `streaming: boolean` +- `mode: inspire | clone | enhance` +- `url: string` when `mode` is present + +The helper script uses `streaming: false` on the fallback API path so it can reliably capture a complete HTML artifact, write files, and render previews. + +## Skill-Side Request Strategy + +The agent or helper sends a compact repo summary plus the user request. Use this to make the output fit the destination codebase: + +- framework and app shell +- route surface candidates +- token sources +- component-library clues +- design language hints + +The goal is not to make AIDesigner emit final production code for the repo. The goal is to generate a strong visual artifact that the agent can then port into the repo responsibly. + +## Verb Mapping + +### `generate` + +Creates a fresh local run and writes: + +- `request.json` +- `repo-context.json` +- `design.html` +- `preview.png` +- `summary.json` + +### `refine` + +Loads a prior run, preserves parent context, and writes a new run with a `parentRunId`. On the MCP path, remote run ids are also persisted server-side so follow-up refinements can reference them directly. + +### `preview` + +Renders an HTML artifact to a PNG preview using local browser automation when available. + +For clone workflows, this preview is part of the required visual QA loop. Agents should compare screenshots, not just inspect HTML or DOM structure. + +### `adopt` + +Reads the current run plus repo context and writes an adoption brief so the agent knows how to turn the artifact into repo-native code. + +## Error Handling Expectations + +Surface failures clearly: + +- missing or invalid OAuth token +- missing or invalid API key fallback +- insufficient credits +- invalid reference URL +- upstream generation failure +- preview renderer unavailable + +When preview rendering fails, keep the HTML artifact and explain the preview blocker. For clone workflows, the agent should request installation or enablement of browser automation such as Playwright or Puppeteer instead of silently skipping visual QA. diff --git a/.claude/skills/aidesigner-frontend/references/frontend-rubric.md b/.claude/skills/aidesigner-frontend/references/frontend-rubric.md new file mode 100644 index 0000000..ff2f2bc --- /dev/null +++ b/.claude/skills/aidesigner-frontend/references/frontend-rubric.md @@ -0,0 +1,82 @@ +# AIDesigner Frontend Rubric + +Use this rubric when turning an AIDesigner artifact into repo-native code. + +## 1. Commit To A Clear Visual Direction + +- Pick one strong aesthetic and carry it consistently. +- Avoid generic "AI-generated" layouts that feel interchangeable. +- Make typography, spacing, color, and imagery feel intentionally related. + +## 2. Respect The Repo Before Inventing + +- Reuse existing routes, shell patterns, and navigation conventions. +- Reuse component-library primitives before creating new base components. +- Preserve tokens from CSS variables, theme files, and utility conventions. + +## 3. Port, Do Not Paste + +- Treat generated HTML as a mockup artifact. +- Treat the AIDesigner prompt as a visual-direction tool, not the final content spec. +- Break the layout into logical sections and components. +- Map classes, spacing, and color choices into the repo's actual styling system. +- Remove dead CSS, duplicated wrappers, and one-off resets that fight the host app. + +## 4. Keep The Implementation Production-Minded + +- Maintain responsiveness across mobile and desktop. +- Preserve accessibility basics: headings, landmarks, labels, contrast, focus states. +- Keep animations purposeful and light. +- Avoid image-heavy hero sections that hide weak layout thinking. + +## 5. Push Quality Upward + +- If the repo already has a design system, make the new work feel like its strongest expression. +- If the repo is visually weak, still integrate cleanly but move the design forward with confidence. +- Prefer one polished direction over a bag of trends. + +## 6. Adoption Heuristics + +### Clone Fidelity + +- For clone work, the acceptance bar is visual fidelity, not just thematic similarity. +- Compare screenshots of the generated preview or integrated implementation against the reference and look for concrete mismatches before declaring success. +- Text-only checks, DOM inspection, or structural summaries are insufficient on their own. +- Use browser automation when needed to capture screenshots. If the environment cannot take screenshots yet, surface that blocker and request installation or enablement of a tool such as Playwright or Puppeteer. +- Preserve section order, section count, repeated block count, image roles, and the overall page rhythm unless the user explicitly asked for a deviation. +- Preserve fidelity-critical media assets when they are part of the reference. Product screenshots, logos, photography, illustrations, and other explicit reference media are not interchangeable placeholder content. +- Run an asset-presence audit before sign-off. If the artifact/reference contains key media assets and the integrated implementation replaced them with mocks or dropped them entirely, the clone is not done. +- Fix visual gaps locally when they are specific and actionable. Do not default to another generation pass for spacing, typography, color, crop, or alignment issues the agent can correct directly. + +### Content-Heavy Surfaces + +- For docs, pricing, dashboards, and other content-dense pages, use AIDesigner to establish the visual system, rhythm, and component language. +- Keep the exact information architecture, copy fidelity, data tables, and reference details in the local implementation layer. +- Do not force every real content requirement into the generation prompt up front. + +### Next.js / React + +- Convert repeated sections into components. +- Prefer server and client boundaries that match existing app patterns. +- Keep business logic out of presentation-only layout components. + +### Tailwind Projects + +- Reuse established spacing, radius, shadow, and color tokens. +- Avoid enormous arbitrary values when existing scales can express the same design. + +### Radix Or shadcn-Style Stacks + +- Compose with existing primitives for dialogs, tabs, popovers, buttons, and form controls. +- Keep custom styling layered on top of those primitives instead of replacing them. + +### Dashboard Surfaces + +- Protect information density and navigation clarity. +- Do not sacrifice usability for spectacle. + +### Marketing Surfaces + +- Lead with hierarchy, clarity, and conversion. +- Make CTA contrast obvious. +- Ensure hero, proof, feature explanation, and CTA flow read naturally. diff --git a/.gitignore b/.gitignore index a646ae8..fd12e3e 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,5 @@ yarn-error.* /android .env +.aidesigner/* +!.aidesigner/.gitkeep diff --git a/.mcp.json b/.mcp.json new file mode 100644 index 0000000..ff459c6 --- /dev/null +++ b/.mcp.json @@ -0,0 +1,8 @@ +{ + "mcpServers": { + "aidesigner": { + "type": "http", + "url": "https://api.aidesigner.ai/api/v1/mcp" + } + } +} diff --git a/README.md b/README.md index b738fce..b397898 100644 --- a/README.md +++ b/README.md @@ -62,18 +62,37 @@ Universal/app links (camera opens the app without the site page) need a domain; ## Layout ``` -src/app/_layout.tsx fonts, React Query, auth gate (→ /login?next=…) -src/app/login.tsx email → code → optional name (PATCH /me) -src/app/(tabs)/ index (home), booths, scan, investees, me -src/app/q/[token].tsx scan result (success / mystery celebration / already scanned / not a GRV code) -src/app/leaderboard.tsx, raffles.tsx, merch.tsx -src/components/ui.tsx icons, text, cards, buttons, screen shells -src/components/OrderCard.tsx merch order + pickup QR (order number) +src/app/_layout.tsx fonts, React Query, auth gate (→ /login?next=…), celebration host +src/app/login.tsx email → code → optional name (PATCH /me), welcome toast +src/app/(tabs)/ index (home), map (venue map + booth list), scan, investees, me (profile + ticket pass) +src/app/q/[token].tsx scan result: confetti, count-up points, tier progress, mystery screen, + then tier-unlock modal and badge toasts +src/app/achievements.tsx tier timeline + badges +src/app/leaderboard.tsx podium + list; raffles.tsx, merch.tsx +src/components/ui.tsx icons, text, cards, buttons, Backdrop wash, DateBlock, Pill, Gem/Medal art +src/components/Celebrate.tsx toast(), celebrate(), Confetti, announceProgress() +src/lib/content.ts event info, venue zones, achievement tiers and badges src/lib/api.ts fetch wrapper, session (secure-store), API types, queries, money format src/lib/theme.ts colours/fonts from GRVSummit/app/globals.css assets/ icon/splash/pattern PNGs rendered from GRVLogo.png and mainwhite.svg ``` +Design: GRV greens only (primary `#30614c`, secondary `#b9d8c9`, ink `#1a4034`), soft green wash at the +top of each screen, 20–28px radius cards with hairline borders, floating ink tab bar with a raised +Scan button. Every unlock (points, tier, badge, mystery) gets haptics plus confetti, a modal or a toast. + +## Replacing placeholder assets + +- **Venue map**: `zones` in `src/lib/content.ts`. Each zone is a rectangle on a 100 × 128 plan with + a name, kind (colour) and details. Booth numbers map to zones by letter (`boothPrefixes`). + To use a real floor-plan image instead, render it in `FloorPlan` (`src/app/(tabs)/map.tsx`) behind + the same tap targets. +- **Achievement art**: `Gem` (tiers) and `Medal` (badges) in `src/components/ui.tsx` are drawn SVG. + Swap their bodies for `.png')} />`. +- **Tiers and badges**: names, point thresholds and hints in `src/lib/content.ts`. Badges are derived + from `/me` on the device, so changing a rule needs no backend change. +- **Event info** (dates, venue, programme): `event` in `src/lib/content.ts`. + Fonts: Antebas (headings) and DM Sans (body). The Antebas files are the Fontspring **demo** build — digits and punctuation are watermark glyphs, so headings with numbers or punctuation use DM Sans. Swap in the licensed OTFs in `assets/fonts/` before the store release. diff --git a/src/app/(tabs)/_layout.tsx b/src/app/(tabs)/_layout.tsx index ae91605..15b1177 100644 --- a/src/app/(tabs)/_layout.tsx +++ b/src/app/(tabs)/_layout.tsx @@ -1,28 +1,92 @@ import { Tabs } from 'expo-router/js-tabs'; +import { Pressable, View } from 'react-native'; +import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { Icon, type IconName } from '../../components/ui'; -import { colors, fonts } from '../../lib/theme'; +import { colors } from '../../lib/theme'; +// Floating pill tab bar: icons only, active tab gets a soft green disc; Scan is the raised centre. const tab = (title: string, icon: IconName) => ({ title, - tabBarIcon: ({ color }: { color: unknown }) => ( - + tabBarAccessibilityLabel: title, + tabBarIcon: ({ focused }: { focused: boolean }) => ( + + + ), }); export default function TabsLayout() { + const insets = useSafeAreaInsets(); return ( - - + + ( + + {({ pressed }) => ( + + + + )} + + ), + }} + /> diff --git a/src/app/(tabs)/booths.tsx b/src/app/(tabs)/booths.tsx deleted file mode 100644 index 245e882..0000000 --- a/src/app/(tabs)/booths.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { Text, View } from 'react-native'; -import { Card, CheckDot, ErrorBox, H1, Loading, P, Row, Screen, s } from '../../components/ui'; -import { useCheckpoints } from '../../lib/api'; -import { colors, fonts } from '../../lib/theme'; - -export default function Booths() { - const q = useCheckpoints('BOOTH'); - const list = q.data ?? []; - const found = list.filter((c) => c.scanned).length; - - return ( - void q.refetch()} refreshing={q.isRefetching}> -

Booths

-

Visit exhibitor and partner booths and scan their QR to check them off.

- {q.isPending ? ( - - ) : q.error ? ( - void q.refetch()} /> - ) : ( - <> - - {found} of {list.length} visited - - - {list.length === 0 && ( -

- Booths will appear here soon. -

- )} - {list.map((c, i) => ( - 0 ? { borderTopWidth: 1, borderTopColor: colors.surfaceMuted } : undefined - } - > - - - - {c.organisation ?? c.label} - - {(c.boothNumber || (c.organisation && c.label !== c.organisation)) && ( -

- {[ - c.boothNumber && `Booth ${c.boothNumber}`, - c.organisation && c.label !== c.organisation && c.label, - ] - .filter(Boolean) - .join(' · ')} -

- )} -
- - +{c.points} - -
- ))} -
- - )} -
- ); -} diff --git a/src/app/(tabs)/index.tsx b/src/app/(tabs)/index.tsx index feeaefd..cf6dbb8 100644 --- a/src/app/(tabs)/index.tsx +++ b/src/app/(tabs)/index.tsx @@ -1,21 +1,76 @@ import { router } from 'expo-router'; -import { Image, Pressable, Text, View } from 'react-native'; +import { Image, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native'; import { - Button, - Card, + DateBlock, ErrorBox, + Gem, + H1, H2, Icon, Loading, + Medal, P, - PatternHeader, Screen, s, type IconName, } from '../../components/ui'; -import { useMe, useRaffles } from '../../lib/api'; +import { useMe, useRaffles, type Me } from '../../lib/api'; +import { badges, earnedBadges, event, nextTier, tierAt } from '../../lib/content'; import { colors, fonts } from '../../lib/theme'; +function PointsCard({ m }: { m: Me }) { + const cur = tierAt(m.points); + const next = nextTier(m.points); + const from = cur?.points ?? 0; + const pct = next ? (m.points - from) / (next.points - from) : 1; + return ( + + + + + Your points + + {m.points} + + + router.push('/leaderboard')} + accessibilityRole="button" + accessibilityLabel="Leaderboard" + style={({ pressed }) => [st.rank, pressed && { opacity: 0.8 }]} + > + + {m.rank ? `#${m.rank}` : 'Unranked'} + + + router.push('/achievements')} + accessibilityRole="button" + accessibilityLabel="Achievements" + style={st.tierRow} + > + + + + {cur ? cur.name : 'No tier yet'} + + {next ? ` · ${next.points - m.points} pts to ${next.name}` : ' · top tier'} + + + + + + + + + + ); +} + function Progress({ label, found, @@ -31,36 +86,23 @@ function Progress({ }) { const pct = total ? Math.min(1, found / total) : 0; return ( - - - - + [{ flex: 1 }, pressed && { opacity: 0.85 }]} + > + + + {label} + - {label} - + {found} / {total} - - + + - + ); } @@ -70,44 +112,6 @@ export default function Home() { const raffles = useRaffles(); const m = me.data; - const header = ( - - -

- {m?.user.name ? `Hi ${m.user.name.split(' ')[0]}` : 'Welcome to the GRV Summit'} -

- - - {m?.points ?? '–'} - - - points - - - router.push('/leaderboard')} - style={{ alignItems: 'flex-end', marginBottom: 10 }} - > - Rank - - {m?.rank ? `#${m.rank}` : '–'} - - - -
- ); - const refresh = () => { void me.refetch(); void raffles.refetch(); @@ -117,9 +121,42 @@ export default function Home() { const nextRaffle = raffles.data ?.filter((r) => !r.eligible && !r.drawnAt) .sort((a, b) => a.minPoints - b.minPoints)[0]; + const raffleLine = raffles.isPending + ? 'Loading…' + : eligible + ? `You're in ${eligible} draw${eligible > 1 ? 's' : ''}.` + : nextRaffle && m + ? `${Math.max(0, nextRaffle.minPoints - m.points)} more points to enter.` + : 'Drawn at the end of the summit.'; + const earned = m ? earnedBadges(m, raffles.data) : new Set(); + const first = m?.user.name?.split(' ')[0]; return ( - + + + + router.push('/me')} + accessibilityRole="button" + accessibilityLabel="Profile" + style={st.avatar} + > + + {(first ?? m?.user.email ?? '?').charAt(0).toUpperCase()} + + + + + +

{first ? `Hi ${first}` : 'Welcome'}

+

Scan, explore and climb the Rift.

+
+ {me.isPending ? ( ) : me.error ? ( @@ -127,14 +164,91 @@ export default function Home() { ) : ( m && ( <> -