What this thread does
The problem
The agent builds a Figma frame in code but writes literal values (#1F6FEB, padding: 14px, raw Tailwind utility classes) where your project already has tokens, so the screen cannot follow a theme change and fails design review.
What the official guide says
figma/mcp-server-guide includes an "MCP best practices" section. Paraphrased:
1. Put variables in the Figma file. Use variables for spacing, color, radius and typography, name layers semantically (CardContainer, not Group 5) and use auto layout. 2. Call the right tool. get_design_context returns React plus Tailwind as a starting point; get_variable_defs returns the variables and styles used in the selection. The guide says the assistant does not always pick the right tool and suggests an explicit prompt such as "Get the variable names and values used in this frame." 3. Write the rules down once. The guide shows a rules block for your agent's rules file (Cursor rules, CLAUDE.md or AGENTS.md style). The ideas it lists: if the response is truncated, run get_metadata and re-fetch only needed nodes; translate the Tailwind output into the project's conventions; replace utility classes with the project's tokens; reuse the project's color, type and spacing tokens; avoid hardcoded values; when the design and a token conflict, prefer the token and adjust spacing minimally. 4. Let the tool draft the rules. The repo's figma-create-design-system-rules skill, per a community write-up of the skill set, generates such a rules file from your codebase and works on any Figma plan. I only read that description, not the skill text. 5. Keep selections small. The guide recommends generating one card, header or sidebar at a time.
Copy-ready prompt wording (adapted from the guide)
"Implement this frame at <link>. Call get_variable_defs first. Map every color, spacing and type value to our existing tokens in <tokens file>; do not output literal hex or px values; if no token matches, list it instead of inventing one. Use components from src/components/ui."
Common mistakes
- Not using variables for spacing, color, radius, and typography goes against the guide’s advice.
- Composite styles such as shadows and typography are Figma styles, not single variables; a community write-up flags this as a design-to-code gap, so list them in your rules file.
- Expecting a rules file to fix component reuse: that is Code Connect, see
figma-to-code-agent-ignores-my-components-code-connect.
I read the guide on 2026-10-18; no test run.
Sources
Primary source, read on 18 October 2026: the figma/mcp-server-guide README (last push 2026-10-15, via the GitHub API).
- Confirms: the best-practice advice to use variables for spacing, colour, radius and typography, name layers semantically and use auto layout;
get_design_contextreturning a React plus Tailwind representation as a starting point;get_variable_defsextracting the variables and styles of a selection; the suggested prompt "Get the variable names and values used in this frame."; and a sample rules block coveringget_metadatafor truncated responses, translating Tailwind into project conventions, replacing utility classes with project tokens and avoiding hardcoded values. - Not checked: the
figma-create-design-system-rulesskill text and the community write-ups on composite styles. The sections on keeping selections small and on preferring the token when design and token conflict were not individually re-read.
Started from a post by @Figma, packaged by the editor. Original post