figma-node-builder
Skill1 starsChanged 8 days agoMITView on GitHub
Builds production-ready UI components from previously extracted Figma spec files (.specs/*.json) and optional preview images (.specs/*.png), reusing the host project components, design tokens, and icon library. Works offline with no Figma API calls. Use when the user asks to implement, build, or code a component or screen from an existing .specs file, or approves implementation after a figma-extractor run.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- figma-extractorSkill
- figma-to-codeSkill
- generate-meta-repoSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 4 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
Before writing code, ground the implementation in the existing project:
- Very specific: line 28
Framework and styling: check package.json for React, Vue, Svelte, Angular, Next.js, Tailwind CSS, styled-components, or plain CSS.
- Very specific: line 31
Icons: check package.json for icon packages (lucide-react, @heroicons/react, phosphor-react) and local icon folders (components/icons/, …
- Very specific: line 35
Run the inspector instead of reading the raw JSON into context (resolve <skill-dir> as described below):
- Very specific: line 41
Use --json instead of --markdown for a structured summary (or --help / -h for CLI options).
- Distinctive: line 47
Read specific parts of the raw spec only when the inspector summary is not enough.
- Distinctive: line 51
Follow the Build rules, adapting syntax to the stack detected in Phase 1.
- Very specific: line 55
Run the project's existing checks: typecheck or lint scripts from package.json, or npx tsc --noEmit when TypeScript is already installed.
- Distinctive: line 56
If checks fail in the files you created or changed, fix them and run the checks again.
- Very specific: line 58
If .specs/<name>.png exists, compare it visually with the result.
- Very specific: line 62
Reuse existing components (no div soup): when an INSTANCE matches an existing component, import and render it with the spec props.
- Very specific: line 70
Colors and typography: never guess values. Use the semantic token when present, otherwise the exact hex color.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Figma Node Builder (SDD Implementation Layer)
Builds UI code from an extracted spec (.specs/<name>.json, the pruned Figma node tree with resolved tokens and component props) and its optional preview image (.specs/<name>.png). Works entirely offline: no Figma API calls or tokens.
Requires Node.js >= 16.7 for the inspector script (zero dependencies, no npm install).
Workflow
Copy this checklist and track your progress:
Implementation Progress:
- [ ] Phase 1: Discover the host project (stack, UI primitives, tokens, icons)
- [ ] Phase 2: Inspect the spec and map it to the codebase
- [ ] Phase 3: Build the component following the build rules
- [ ] Phase 4: Validate and fixPhase 1: Discover the host project
Before writing code, ground the implementation in the existing project:
- Framework and styling: check
package.jsonfor React, Vue, Svelte, Angular, Next.js, Tailwind CSS, styled-components, or plain CSS. - UI primitives: inspect
components/ui/,src/components/, or design system libraries (shadcn/ui, Radix, MUI) for reusable components (Button,Input,Card,Badge). - Design tokens: inspect
tailwind.config.*,theme.css, orglobals.cssfor color, spacing, and radius scales. - Icons: check
package.jsonfor icon packages (lucide-react,@heroicons/react,phosphor-react) and local icon folders (components/icons/,src/assets/,public/).
Phase 2: Inspect the spec and map it to the codebase
Run the inspector instead of reading the raw JSON into context (resolve <skill-dir> as described below):
node "<skill-dir>/scripts/inspect_spec.js" .specs/<name>.json --markdownUse --json instead of --markdown for a structured summary (or --help / -h for CLI options). Then:
- Component instances: match each
INSTANCEcomponent.nameagainst existing codebase components and note itsprops. - Design tokens: map each
token(colors/brand/primary,spacing/md,radii/lg) to the project CSS variables or Tailwind classes. - Gaps: list sub-components and tokens that do not exist yet and must be created.
Read specific parts of the raw spec only when the inspector summary is not enough.
Phase 3: Build the component
Follow the Build rules, adapting syntax to the stack detected in Phase 1.
Phase 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
.specs/<name>.pngexists, compare it visually with the result. If it does not exist, rely strictly on the metrics in the spec.
Build rules
- Reuse existing components (no div soup): when an
INSTANCEmatches an existing component, import and render it with the spec props. Never rebuild existing primitives from raw elements.// Correct <Button variant="primary" size="large" hasIcon>Confirm Order</Button> // Forbidden <div className="flex bg-blue-500 rounded p-2 text-white">Confirm Order</div> - 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, 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:{/* TODO: Add image source for 'User Avatar' (48x48) */} <img src="" alt="User Avatar" className="w-12 h-12 rounded-full object-cover" />
Spec field reference
| Field | Meaning | Code mapping |
type | FRAME, INSTANCE, TEXT, VECTOR | Container, component import, typography tag, or icon (rule 4). |
layoutMode | HORIZONTAL / VERTICAL auto-layout | flex flex-row / flex flex-col. |
itemSpacing / itemSpacingToken | Gap between children | gap-* or gap: Xpx. |
padding / paddingToken | { top, right, bottom, left } | p-*, px-*, py-* or padding. |
cornerRadius / cornerRadiusToken | Border radius | rounded-* or border-radius. |
component.name | Master component of an INSTANCE | Import name (import { Button } from '@/components/ui/button'). |
props | Normalized variant and boolean props | Component props (<Component {...props} />). |
bounds | { width, height } | Sizing (w-*, h-*, max-w-*). |
fills | SOLID, IMAGE, gradients | Background, gradient, or <img> (rule 5). |
characters / typography | Text content and font metrics | Text node with mapped typography classes. |
Resolving <skill-dir>
Substitute <skill-dir> with the directory where this skill is installed, keeping 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-node-builder.mdc): the sibling.cursor/skills/figma-node-builderdirectory.
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.

