Topic 3 of 5 · 5 min read
Design-to-code handoff with coding agents
Goal: Set up a handoff in which a coding agent reads the design and its tokens, then review the generated code for drift from the design.
Let the coding agent read the real design and your design tokens, then review its code against them: the agent will not copy values it was never shown. A picture of a screen is a weak brief. A connected design file is a strong one.
Check yourself · 1 of 3
What does connecting a coding agent to the design file give it that a screenshot does not?
Why it matters
Hand a screenshot to a coding agent such as Claude Code, Cursor or Copilot, and it estimates. It sees a blue button and writes a blue that is close but not yours, with padding that is close but not on your spacing scale. Each guess is small. Across forty screens the product drifts from the design, and nobody can say where.
How to set it up
- Connect the design source. A server that speaks the Model Context Protocol (MCP), such as the Figma MCP server, lets the agent read the frame, its layers, variables and components from the file. Check the current docs for what it exposes.
- Name the tokens. Tokens are named design values: a colour, a spacing step, a font size. Point the agent at the file that holds them, so it writes
var(--color-primary)rather than a hex code. - Name the components. Tell the agent which existing components to reuse, such as your
Button, so it does not build a second one. - Give acceptance checks. "Spacing and colours use tokens only. No new components if one exists."
- Review for drift. Read the diff the agent produces and compare it with the design.
Before and after
Weak diff: a hard-coded value that looks right but bypasses the system.
- <button className="btn-primary">Pay now</button>
+ <button style={{ background: "#2F6FED", padding: "11px 22px" }}>Pay now</button>
Fixed diff: the existing component, with token values.
- <button className="btn-primary">Pay now</button>
+ <Button variant="primary">Pay now</Button>
What goes wrong
- Hard-coded colours, sizes and fonts that match today and break at the next theme change.
- A duplicate component built beside the existing one.
- The agent reads one frame and invents the hover, focus and disabled states, because the file did not define them.
- A model reading a very large frame loses detail; hand it one section at a time.
Examples
A handoff brief
Implement the Checkout summary frame from the connected Figma file.
Use tokens from src/styles/tokens.css only; no hex codes or pixel values.
Reuse Button and Card from src/components; do not add new ones.
If a state (hover, focus, disabled) is not in the file, list it as missing
instead of inventing it.
A quick drift check
Search the diff for # colour codes and px values that are not in the tokens file. Each hit is either a missing token to add to the design system or a deviation to fix.
Key points
- A screenshot is an estimate; a connected design file with tokens gives the agent real values.
- MCP servers such as the Figma MCP server let a coding agent read frames, variables and components.
- Tell the agent which tokens and components to use, and what not to create.
- Review the diff for hard-coded values, duplicate components and invented states.
- Give the agent one section of the design at a time rather than a whole file.
Common mistakes
- Giving the agent a screenshot and expecting exact colours and spacing.
- Not naming the tokens and components, so the agent builds its own.
- Accepting hard-coded values because the page looks right today.
- Letting the agent invent states the design never defined.
Check yourself · 2 of 3
In a generated diff, which line most clearly shows design drift?
Check yourself · 3 of 3
The design file shows only the default state of a button. What should the brief tell the agent to do about hover and focus?
Practice items, not counted towards your mastery.
Start here
- AI Prototyping in Real Design Contexts (NN/g) (opens in a new tab)ArticleFree
Nielsen Norman Group's view of where AI prototyping tools help real design work and where they fall short.
- v0 documentation (opens in a new tab)DocsFree
Official docs for a prompt-to-UI tool that produces runnable web code.
- Explore Figma Make (Figma Help) (opens in a new tab)DocsFree
Shows how a prompt-to-prototype tool inside a design app is used and edited.
More for this topic
- Figma MCP server documentation (opens in a new tab)DocsFree
How a coding agent reads frames, variables and components from a Figma file.