figma-to-code
Skill1 starsChanged 8 days agoMITView on GitHub
Converts a Figma frame or component directly into production-ready UI code in a single pass, fetching a compact design-token-aware node tree from the Figma REST API and reusing the host project components and styles. Use when the user shares a figma.com link and explicitly asks to build, code, or implement it right away, without an intermediate spec review step. Supports React, Vue, Svelte, Angular, and plain HTML/CSS.
- Reads credentials
18 other projects use a version of this.
Adopted by
Most recently taken up by
- NoatToan/claude-code-pluginstheir own version, first seen Nov 1, 2026
- sushi-killer/sushiAItheir own version, first seen Oct 20, 2026
- t4sh/skills4shtheir own version, first seen Sep 28, 2026
- shivams07/figma-to-codetheir own version, first seen Aug 14, 2026
- sueryue/Claude-Skilllstheir own version, first seen Jul 28, 2026
- bedomax/webdesigner-agenttheir own version, first seen Jul 22, 2026
Used with
Projects with it also use systematic-debugging, mcp-builder and 1 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
OpenAISkillsystematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
Also in 3 projects that use this
MicrosoftSkillmcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Also in 3 projects that use this
GoogleSkilltdd
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
Also in 3 projects that use this
Other versions18 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 18
- shibit-net/xuanji-community★ 90same name
- scoobynko/claude-code-design-skills★ 39same name
- ggombee/code-forge★ 18same name
- t4sh/skills4sh★ 5same name
- kevinaimonster/skill-hub★ 4same name
- kyuhyi/BSD_claude_skills★ 2same name
- sushi-killer/sushiAI★ 2same name
- bedomax/webdesigner-agent★ 1same name
- gauravv-g/claude-skills-collection★ 1same name
- gihwan-dev/claude-code-gui★ 1same name
8 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- figma-extractorSkill
- figma-node-builderSkill
- generate-meta-repoSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 2 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
If the user only wants to inspect, document, or plan the design, stop and suggest the figma-extractor skill instead.
- Very specific: line 30
1. Discover the host project: check package.json (framework, styling, icon library), reusable components in components/ui/ or …
- Distinctive: line 40
3. Build: follow the Build rules, adapting syntax to the detected stack.
- Very specific: line 44
Run the project's existing checks: typecheck or lint scripts from package.json, or npx tsc --noEmit when TypeScript is already installed.
- Distinctive: line 45
If checks fail in the files you created or changed, fix them and run the checks again.
- Very specific: line 47
If a preview image was downloaded (image.path in the output), compare it visually with the result.
- Very specific: line 51
Reuse existing components (no div soup): when an INSTANCE matches an existing component, import and render it with the spec props (<Button …
- Very specific: line 53
Colors and typography: never guess values. Use the semantic token when present (mapped to the project CSS variable or Tailwind class), …
- Very specific: line 71
Run fetch_figma.js once per target frame or component.
“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Figma To Code
Fetches a compact, design-token-aware node tree for a Figma frame and immediately builds the component in the host project, reusing its existing components and styles.
Requires Node.js >= 16.7. The scripts have zero dependencies (no npm install).
Boundaries
- Never open Figma URLs with browser tools (Playwright, Puppeteer, Chrome DevTools). The Figma canvas is WebGL, so there is no DOM to read. Do not search for local browser binaries.
- API errors are final: report them to the user. Never fall back to scraping.
- If the user only wants to inspect, document, or plan the design, stop and suggest the
figma-extractorskill instead.
Workflow
Copy this checklist and track your progress:
Build Progress:
- [ ] 1. Discover the host project (stack, UI primitives, tokens, icons)
- [ ] 2. Fetch the node tree (once)
- [ ] 3. Build the component following the build rules
- [ ] 4. Validate and fix1. Discover the host project: check package.json (framework, styling, icon library), reusable components in components/ui/ or src/components/, and theme files (tailwind.config.*, theme.css, globals.css).
2. Fetch the node tree (1 Tier 1 API call; JSON is printed to stdout):
node "<skill-dir>/scripts/fetch_figma.js" "<FigmaURL>"For large frames, add --shallow-instances (collapses instance internals into props) or --depth 2. All flags, the output schema, token setup per OS, and proxy options: see REFERENCE.md (located at <skill-dir>/REFERENCE.md).
3. Build: follow the Build rules, adapting syntax to the detected stack.
4. Validate and fix
- Run the project's existing checks:
typecheckorlintscripts frompackage.json, ornpx tsc --noEmitwhen TypeScript is already installed. Never install new dependencies to do this. - If checks fail in the files you created or changed, fix them and run the checks again. Repeat until they pass.
- Report pre-existing failures in other files instead of fixing them.
- If a preview image was downloaded (
image.pathin the output), compare it visually with the result.
Build rules
- Reuse existing components (no div soup): when an
INSTANCEmatches an existing component, import and render it with the spec props (<Button variant="primary" size="large" hasIcon>Confirm Order</Button>). Never rebuild existing primitives from raw elements. - Layout:
layoutMode: "HORIZONTAL"→ flex row;"VERTICAL"→ flex column;itemSpacing→gap;padding→ padding;primaryAxisAlignItems/counterAxisAlignItems→justify-*/items-*. Prefer the matching*Tokenwhen present. - Colors and typography: never guess values. Use the semantic
tokenwhen present (mapped to the project CSS variable or Tailwind class), otherwise the exact hexcolor. Map font size, weight, and line height to existing typography tokens or classes. - Icons and vectors (
VECTORnodes,isSvg: true, or icon instances): normalize the name by strippingicon/,ic_,ico-(icon/search→search), then resolve in order:- Local assets or components in
components/icons/,src/assets/, orpublic/only (no repo-wide searches). - The icon library installed in
package.json(e.g.import { Search } from 'lucide-react'). - An accessible placeholder with a
TODO: Missing icon 'search'comment. Never invent raw SVG<path d="...">coordinates.
- Local assets or components in
- Image fills (
fills: [{ type: "IMAGE" }]): apply only the spec styling (size, radius,scaleMode: "FILL"→object-cover,"FIT"→object-contain). Never fetch or invent image URLs. Render<img src="" alt="...">with aTODOcomment naming the layer and its size.
Resolving <skill-dir>
Substitute <skill-dir> with the directory where this skill is installed. Never guess another agent's folder, and keep the double quotes around the script path (Windows/macOS/Linux):
- Standard skills (
SKILL.md): the parent directory of thisSKILL.mdfile. - Cursor rule (
.cursor/rules/figma-to-code.mdc): the sibling.cursor/skills/figma-to-codedirectory.
Quota rules (Zero-Hammer Protocol)
The script enforces a local rate gate and a persistent circuit breaker, but the agent must also follow these rules:
- Run
fetch_figma.jsonce per target frame or component. Never retry in a loop. - Do not pass
-iunless the user explicitly requests a preview image. The JSON already contains layout, dimensions, colors, radii, typography, and text. - Figma Starter plans and View seats have very small monthly Tier 1 quotas, so every call matters.
Errors
| Error code | Action |
FIGMA_ACCESS_TOKEN is not set / FIGMA_TOKEN_EXPIRED_OR_INVALID | Tell the user the token is missing, invalid, or expired. They create one in Figma Settings → Personal Access Tokens and set FIGMA_ACCESS_TOKEN (setup per OS in REFERENCE.md). |
| Node not found | Report that the node-id does not exist in the file. |
FIGMA_SSL_CERTIFICATE_ERROR | Corporate proxy or self-signed certificate: suggest FIGMA_IGNORE_SSL=true in .env. |
FIGMA_RATE_LIMIT_EXCEEDED / FIGMA_CIRCUIT_BREAKER_ACTIVE | Report the cooldown. Suggest duplicating the file in Figma Drafts (Right-click → Duplicate) for a fresh URL, or exporting the selection with the companion Figma Node JSON Extractor plugin and building from that JSON. |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

