Generate React/SwiftUI/Tailwind code from a Figma frame
When to use: You have a Figma frame for a screen/component and want the first 80% of code generated faithfully.
Prerequisites
- Figma personal access token — figma.com → Settings → Personal access tokens; scope to file_read
- Figma file URL — Copy the URL from the Figma file; the MCP can extract file key and node id
Flow
-
Pull the frame dataGet the Figma node at <paste figma URL with node-id>. Return its layout, text content, colors, and child structure.✓ Copied→ Hierarchical node data with real values — not 'unable to fetch'
-
Generate code grounded in the dataGenerate a React + Tailwind component that matches this exactly. Use the actual hex colors and pixel values from the Figma data, not approximations.✓ Copied→ Code that references real values, e.g.
bg-[#1A2B3C]notbg-blue-500 -
Cross-check with an exportExport the same frame as a PNG. Compare to your generated component's expected render and call out any differences.✓ Copied→ Specific diffs (missing icon, wrong padding) rather than 'looks similar'
Outcome: A pixel-faithful first draft you can refine instead of rebuild.
Pitfalls
- Auto-layout vs absolute positioning maps differently to flex/grid — Tell Claude to prefer flexbox when the Figma frame uses auto-layout; absolute when it doesn't
- Vector icons come back as SVG paths Claude inlines verbatim — Have it extract icons separately to /icons/*.svg and reference them as components