Analyze a Figma design, set up the project (layout, fonts, design tokens), organize all assets by section, detect issues, and produce a design manifest for the build-design skill. Use when invoking "/plan-design".
Analyze a Figma page, set up the project, organize assets, and produce .claude/design-manifest.json — the handoff artifact for /build-design.
Input: $ARGUMENTS — Figma URL or raw node ID.
Output: Configured project + downloaded images + design manifest.
Extract the Figma fileKey and nodeId from $ARGUMENTS (fileKey from the URL path, nodeId from the node-id param, normalize - to :).
get_screenshot(nodeId="<page-id>", fileKey="<file-key>")
get_metadata(nodeId="<page-id>", fileKey="<file-key>")
NEVER call get_design_context on a full page — always use get_metadata first.
From the metadata, enumerate top-level sections. Record: display name, PascalCase component name, node ID, node type (frame vs instance), approximate height, visual order.
Naming: Choose the clearest display name using heading text, visual purpose, content type, or Figma layer name — whichever is most descriptive. Names must be unique.
Instance nodes: Appear as leaf nodes in metadata with no children. Their internals are only visible via get_design_context.
Batch sections into 2-3 Task agents launched in a single message. Use subagent_type="general-purpose".
Batch sections across agents as you see fit — balance parallelism with prompt size.
Each agent receives (common instructions once, then list of sections):
Analyze these Figma sections and cache their design context. Only analyze the "image" variant code path.
**Steps (per section):**
1. Call `get_design_context(nodeId="<node-id>", fileKey="<file-key>")`.
Write the FULL raw output to `.claude/figma-snapshots/<ComponentName>.txt`.
2. If the section is >1500px tall, use `get_metadata` to split into sub-nodes and fetch each via `get_design_context`.
Write each sub-node output to `.claude/figma-snapshots/<ComponentName>-<subNodeLabel>.txt`.
Record the sub-node IDs in NOTES.
3. If design context has "edit"/"image" variant branching, ONLY analyze the "image" path.
4. Analyze the output using the issue detection rules below.
**Issue detection (per section):**
1. **Multi-layer image scan:** Find `<img>` tags, group by parent container. Parent ≤300px with 2+ images → BLOCKER (fragmented asset: logos, icons, badges, phone mockups). Parent >300px with multiple images → valid layout.
2. **Screenshot cross-check:** Screenshot shows a single visual but code has multiple `<img>` tags composing it → fragmented, apply scan above.
3. **Wrong-language content:** Check image assets for baked-in text (badges, banners). Store badges (App Store, Google Play) are common offenders. Wrong language → BLOCKER.
4. **Content issues:** Template text, placeholder data, wrong-industry copy → CONTENT (not a blocker).
5. **Layout notes:** Interactive elements needing "use client", complex patterns → WARNING.
**Sections to analyze:**
1. "<section-name-A>" — ComponentName: <ComponentName-A>, node: <node-id-A>
2. "<section-name-B>" — ComponentName: <ComponentName-B>, node: <node-id-B>
**Return in EXACTLY this format (repeat per section with header):**
=== <section-name> ===
IMAGES:
- [figma-asset-url] | [filename-stem] | [description] | [dimensions if known]
(Do NOT guess file extensions. Record stems only — actual types are detected during download.)
COLORS (from "image" variant only):
- [hex] | [usage]
FONTS:
- [family] | [weight] | [sizes]
ISSUES:
- BLOCKER: [what's wrong] | KEEP: [what to preserve from design] | [node ID]
- WARNING: [description]
- CONTENT: [description]
(or "None")
NOTES:
- Snapshot files written: [list of paths]
- Sub-node IDs (if section >1500px): [list]
- Needs "use client": [yes/no, why]
- Shared asset references: [any refs to shared images]
- Gotchas: [anything build agent can't see from Figma alone]
(or "None")
LAYOUT:
- [single natural-language line describing spatial structure, element groups, and reading order]
Parse each agent's structured output:
shared/.BLOCKER: gates workflow, WARNING: stored in manifest, CONTENT: stored in contentNotes[] (not shown to user).pageContext from the first 2 snapshot files (now cached at .claude/figma-snapshots/): section spacing, container width, heading scale, button style, card style. Snap to Tailwind scale. Include projectPurpose.Present report covering: section list, locales (always AR + EN, note which is default), tokens summary, blockers, warnings. Content issues NOT shown — record in contentNotes[] for build agents.
Wait for user to confirm sections, default locale, and resolve blockers. Re-fetch affected sections if changes were made.
Create directory structure:
public/images/<section-kebab>/ for each sectionpublic/images/shared/ for cross-section imagesDownload all images. Shared images first, then section images. For each:
codePath stem (e.g., /images/hero/hero-bg) following kebab-case namingcurl the figmaAssetUrl to a temp pathfile <path> to detect actual type.png/.svg/.jpg/.webp) based on detected typepublic/preserveAspectRatio="none" and width="100%"/height="100%" attributes (Figma export artifacts)Write resolved codePaths (with correct extensions) to the manifest. Keep figmaAssetUrl for provenance.
If a download fails (expired URL or 403), call get_design_context for that section to get fresh URLs and retry.
If shared components were flagged in Phase 1.4 (same UI pattern in 2+ sections), create the component files at components/shared/ and add sharedComponents array to the manifest.
Run npm install next-intl first.
next.config.ts: Wrap with createNextIntlPlugini18n/routing.ts: defineRouting({ locales: ['ar', 'en'], defaultLocale: '<detected>' })i18n/request.ts: getRequestConfig — loads messages/<locale>.json for the requested localemiddleware.ts: createMiddleware(routing) with matcher ['/', '/(ar|en)/:path*']messages/ar/ and messages/en/: Empty directories (build agents write per-section files)app/[locale]/layout.tsx: Dynamic lang/dir from locale param (ar=RTL, en=LTR). Load both fonts via next/font/google (one per locale). Wrap children in NextIntlClientProvider. Use generateStaticParams for all locales.app/[locale]/page.tsx: Import and render all sections with setRequestLocaleapp/globals.css: @theme block with color tokenslib/use-scroll-reveal.ts: "use client" hook that observes [data-reveal] elements and adds .visible class when they scroll into view (one-time trigger)components/shared/LocaleSwitcher.tsx: Functional locale switcher using next-intl's LinkCreate .claude/design-manifest.json per references/manifest-schema.json.
Ensure each image entry in sections[].images and sharedImages includes both codePath and figmaAssetUrl.
npm run dev
Verify both localhost:3000/ar and localhost:3000/en resolve. Present: section count, images (N total), token count, warnings, and: "Manifest ready. Run /build-design to start."
get_design_context on a full page — per section or smaller onlyget_design_context to see internals