Screenshot-to-code guesses; the Dev Mode MCP reads. It hands your agent the selected frame's real layer tree, auto-layout constraints, variables, and a rendered image — so generation starts from design truth. Your job is the pipeline around it: scoped selection, on-system prompting, and a structured fidelity review before anything merges.
Tier: Core · Workflow area: Design-to-code & design systems · Tools: Figma Dev Mode MCP, Claude Code, Cursor, VS Code Copilot
Pasting a screenshot into a chat window produces plausible-looking markup with invented spacing and colors sampled off pixels. The Dev Mode MCP changes the input class entirely: the agent sees that this padding is spacing/300, that fill is color/surface-raised, that this frame uses auto-layout with 12px gap. What it does with that truth still depends on you.
Enable the server and connect your agent. In the Figma desktop app: Preferences → Enable Dev Mode MCP Server (runs at http://127.0.0.1:3845/mcp). Then register it:
claude mcp add --transport http figma-dev-mode http://127.0.0.1:3845/mcp
For Cursor/VS Code, add the same HTTP server in MCP settings. Verify from the agent: select a frame in Figma, then ask What frame is currently selected? Summarize its layer tree. — a correct answer proves the pipe.
Prepare the frame like an engineer, not a tourist. Two minutes in Figma that determine output quality: confirm auto-layout on the frame and its children, styles attached to variables (not detached hex fills), layers named semantically (card/header, not Frame 427), and component instances used where the design system has them. If the frame fails this inspection, tell the designer what specifically blocks translation — that conversation is part of the pipeline.
Generate with scope, target, and system constraints explicit. Select the frame in Figma, then:
Using the Figma Dev Mode MCP, get the code and variable definitions
for my current selection (the SubscriptionCard frame) plus its
screenshot. Implement it as src/features/billing/SubscriptionCard.tsx:
- @acme/ui primitives only (Card, Stack, Text, Badge, Button)
- Figma variables map to our tokens: spacing/* -> our 4px scale,
color/* -> our semantic Tailwind classes. NO raw hex, no pixel
literals where a token exists.
- Auto-layout becomes flex via Stack props, not hand-written flexbox.
- Props: plan, price, renewalDate, status ('active'|'past_due'|
'canceled'), onManage. The three status variants in the Figma
component map to the status prop.
- Add Storybook stories for all three variants (pb-06 conventions).
Good output: token classes everywhere, Stack gap values from your scale, the status variants driven by one prop — and an explicit note where the design had something your system lacks ("Figma uses a 6px radius; nearest token is radius-sm (4px) — confirm").
Run the structured fidelity review — not an eyeball pass. Render the component (Storybook story), screenshot it, and make the agent compare against the Figma screenshot systematically:
npx playwright screenshot \
"http://localhost:6006/iframe.html?id=subscriptioncard--active&viewMode=story" \
shots/impl-active.png
Compare shots/impl-active.png against the Figma screenshot of the
selected frame. Produce a discrepancy table with columns: element,
property (spacing/type/color/radius/alignment), Figma value, impl
value, severity (must-fix / token-mismatch / intentional). Check
ALL text styles against our type scale, every gap and padding, and
the Badge color for each status variant.
Fix must-fixes, re-screenshot, re-compare. Two iterations usually reaches token-exact. (pb-11 covers this diffing loop in depth.)
Review the semantics the MCP cannot give you. Design truth ≠ component quality. Before the PR: interactive elements are real buttons/links with accessible names; heading levels fit the page the component lands in; the responsive behavior below the frame's designed width is defined (the frame shows one width — you decide what happens at 320px); loading/empty/error states exist even if the frame omitted them (it usually does — pb-04's enumeration applies).
Close the loop with the designer. Post the rendered stories back into the Figma file as a comment (or link the Storybook build in the PR and tag the designer). Deviation decisions — "radius-sm instead of 6px" — get resolved now, in one message, not archaeologically during design QA.
The MCP payload for a large frame can be big and slow. Select the smallest meaningful unit — one component, one card, one section — and compose the screen from parts. Whole-page selections produce worse code and worse reviews; component-sized selections produce PR-sized diffs.
<script setup lang="ts">" / "Angular standalone component") and map Figma variables to your token pipeline (CSS custom properties, SCSS maps); expect to lean harder on step 4 since less community exemplar code exists.The Dev Mode MCP upgrades design-to-code from pixel guessing to structured translation — but fidelity is earned in the loop you run around it: clean frames in, token-mapped generation, a screenshot-diff review, and human ownership of the states the frame never showed.