figma-to-vue
Skill0 starsChanged 2 months agoMITView on GitHub
Convert Figma designs into Vue (2 or 3) + Tailwind components with structural accuracy and design-system fidelity. Use whenever the user pastes a Figma URL, mentions "figma", or asks to "build from figma", "implement this design", "match this mockup", or inspect/audit/map a Figma file to their Vue codebase — even if they don't name the skill. Auto-detects the project's Vue version (2.x, 2.7, 3.x) and adapts conventions. Enforces a 5-step workflow (inspect → map → outline → build → visual-match) that replaces guessing with inspection, then drives a Playwright + pixel-diff loop that renders each component and page beside its Figma image and iterates until pixel-close.
- Installs packages
In this repository6 other files it gives its agents.
- plan-and-buildSkill
- resolving-merge-conflictsSkill
- setup-obsidian-memorySkill
- sprint-release-cherry-pickSkill
- sync-brainSkill
- tailwind-color-tokenSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
Only the lead session orchestrates the team, so architect must be the lead — not itself a delegated subagent.
- Distinctive: line 44
No code this step. Call order:
- Distinctive: line 62
If >30% of colors or text styles are unbound, pause: *"This file has substantial unbound values.
- Very specific: line 66
Start from the get_variable_defs dump (left column), not the render.
- Distinctive: line 78
Before any code, output a structural outline:
- Distinctive: line 90
Only after step 3 is approved.
- Very specific: line 133
Only after build passes lint/typecheck.
- Very specific: line 174
Icon/image diffs are asset diffs, never style diffs: Don't eyeball paths, tweak size, or swap a similar icon — re-export via …
- Distinctive: line 176
No-progress stop: If both the diff list and the pixel ratio are unchanged from the prior iteration, stop and report.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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 to Vue
Deterministic 5-step workflow: inspect → map → outline → build → visual-match. Each step produces an artifact the next consumes.
The default failure mode is optimistic pattern-matching — eyeball the frame, guess hex, round spacing to the nearest Tailwind default, infer structure from visual grouping. It looks close but drifts from the design system and the real component hierarchy. Simple-looking designs fail hardest, because guessing feels safe. This skill replaces guessing with inspection.
Core rules (every step)
- Inspect, never guess. Every number comes from Figma's computed values: the
[Npx]literals andvar(--token, fallback)values in the reference codeget_design_contextreturns (these are the Dev Mode Inspect panel),get_metadatax/y/width/height, andget_variable_defs. Never read a value off a screenshot; never invent one to "look about right". - No arbitrary Tailwind values in emitted code.
bg-[#hex],p-[17px],text-[15px],w-[342px],rounded-[7px]are banned in every.vue. The[Npx]classes in the reference code you read are measurements, not output — transcribe the number, then map it in step 2. No token for a value? Propose one carrying the exact value (use thetailwind-color-tokenskill for hex). Arbitrary values are how design systems rot. - Exact or blocked — never nearest. A Figma value renders at that value or the file stops on a named blocker. Rounding (35 →
gap-9), snapping to the closest class (19.5 →size-5), dropping a value because it "belongs to the parent" (pt-[125px]), or re-nesting the tree so a class fits are all inventing measurements. Step 5 measures 35 vs 36 as a fail; don't spend an iteration on it. - Run all 5 steps in order. Never skip step 1. Pause for explicit user approval after step 3, before any code.
- Report design bugs, don't silently fix them. A discrepancy that stems from the design being wrong is reported — the user decides code vs design.
Orchestration — runs under architect
This skill always runs under the architect lead. Architect owns the plan and delegates the keystrokes; it never edits source itself. Architect decides which fields to spawn — it engages only the roles the design needs (a lone button won't pull the whole team), partitions files so no two workers collide, and sequences dependencies. The agents below are the roles it can draw on — the existing jeash team, referenced here, not redefined; the step→agent lines are the default routing, not a mandatory pipeline.
- Steps 1–3 (inspect → map → outline) — architect runs directly; they're read-only planning, and it holds the step-3 STOP-for-approval gate. When the design leans on semantics or a11y (interactive controls, lists, nav, headings), architect pulls
uxinto the step-1 map so semantic elements and roles/labels are specified before any code. - Step 4 (build) — architect delegates each Figma
Componentto thefrontendagent, one SFC per worker, files partitioned so no two touch the same file. Build bottom-up (leaves → composites → page) still holds; architect sequences the dependencies. - Step 5 (visual-match loop) — architect drives the loop and spawns the two roles as real agents (see the mapping in step 5):
develop=frontend,qa=qa(fresh-eyes, never edits). A freshqaspawns each iteration. - After the build — architect routes the SFCs through
reviewfor a multi-lens read, then splits its findings into partitioned fix-assignments to whichever fields own them:frontendUI/behavior,dxcode-quality (collapse the near-duplicate SFCs a leaf-by-leaf build produces into shared components/composables, tighten types, delete dead flexibility),uxsemantics/a11y (div-soup → real<button>/<nav>/<ul>, roles/labels, focus order — the rendering-changing fixesdxwon't make).qais the final gate.
Only the lead session orchestrates the team, so architect must be the lead — not itself a delegated subagent.
Prerequisites
| Need | Check | If missing |
| Figma MCP | get_metadata, get_design_context, get_variable_defs, get_screenshot, download_assets, get_code_connect_map in tool list (may be prefixed) | Stop, tell user to connect Figma MCP. Do not fall back to pasted screenshots. |
| Vue + Tailwind project | tailwind.config.{js,ts} or tailwind CSS imports present | Ask user to confirm before proceeding. |
| Playwright MCP | a Playwright browser tool in the list | Tell user to add @playwright/mcp and restart. Do not fall back to pasted screenshots. |
| Pixel-diff harness | Node (present in any Vue project) + references/visual-diff.mjs | Copy visual-diff.mjs to project root, npm i -D pixelmatch pngjs. See references/visual-diff-harness.md. |
Tool call order is cheap → expensive: get_metadata (structure/IDs) → get_design_context (layout/fills/variants) → get_variable_defs (bound tokens) → get_screenshot (match target) → download_assets (icons/images).
Step 1: Inspect
No code this step. Call order:
get_metadataon the selection → node tree + IDs; build the hierarchy from this without paying for full context.- List every top-level frame it returns (files usually ship several — mobile+desktop, multiple states). Ask "Which frame(s) / breakpoints are in scope?" — never assume one. Chosen frame widths become the step-5 match targets.
get_design_contexton in-scope node(s) → layout, spacing, fills, sizing.get_variable_defson in-scope node(s) → bound variables. This feeds step 2 directly.
Produce the 8-section report (exact format in references/inspection-template.md):
- Component hierarchy — indented tree, each node's type; mark
Component/Instancedistinctly (they map to separate SFCs). - Auto-layout — per frame: direction, gap, padding (T/R/B/L separately), primary- and counter-axis alignment.
- Colors — every fill/stroke as bound variable name, or raw hex. Flag every unbound color.
- Text styles — every text node as bound style name, or raw props. Flag every unbound style.
- Spacing — distinct padding/gap values; flag any not a multiple of 4.
- Layout sizing — per frame/key node:
fill/hug/fixed, fixed dims, and whether the root is full-bleed or fixed-width/centered. This is the most-guessed data — capture real numbers so nobody invents column/container widths at build time. - Assets to export — every
Vector, image fill, icon with node ID + format (SVGvectors/icons,PNGraster). Pulled viadownload_assetsin step 4 — capture IDs now so nothing becomes a<!-- TODO icon -->. - Match-spec (JSON) — one object per key node:
{ node, nodeId, expected: { widthPx, paddingPx, gapPx, fontSizePx, lineHeightPx, fontWeight, color, borderRadiusPx, layout, … } }. Only fields Figma specifies. Step 5 asserts against this; without it, step 5 falls back to eyeballing — the exact failure this skill prevents.
If >30% of colors or text styles are unbound, pause: "This file has substantial unbound values; output will propose many new tokens. Proceed, or have the designer bind variables first?"
Step 2: Map to Tailwind tokens
Start from the get_variable_defs dump (left column), not the render. Discover the config: ./tailwind.config.{js,ts} → apps/* / packages/* for monorepos → ask user. Read theme.extend.
Mapping table — Figma value | Tailwind class | Source:
- Token match — existing token maps exactly (
primary/500→bg-primary-500). - Near match — existing token within 1 unit (1px / closest shade). Flag it — user picks near-match vs new token. Until the user answers, the value is the exact one: build with a proposed exact token, never the near class (Core rule 3).
- Proposed new token — no match; propose the exact
tailwind.configaddition (key + value) as a diff.
Decision table and examples: references/token-mapping.md. (Core rule 2 applies — no arbitrary values.)
Step 3: Outline — STOP for approval
Before any code, output a structural outline:
- Files to create — each
.vueSFC + path (one per FigmaComponent, usually). - Per-file — props (name/type/default), emits (name/payload), slots, top-level template tree (elements, no classes yet), deps on other new components. Design each API with the
web-component-designskill — semantic props with defaults, variants as typed props (not boolean explosions), slots over props for content, provide/inject for shared child state. A FigmaComponentis a reusable API, not a page partial. - Reuse — call
get_code_connect_mapfirst (deterministic Figma→code mapping where the team maintains it); scan by name/shape for the rest. Don't rebuild an existingButton. List matches + source. - Variants — for any
Componentin a set, pull variant defs viaget_design_contextand enumerate them as real prop values. They're in the file; don't dump them into open questions. - Open questions — only genuinely absent info (undrawn states, loading/empty, keyboard behavior, responsive rules between captured frames).
STOP. Say: "Review the outline. Reply with approval or changes before I generate code." Proceed only on an explicit "yes / approved / go / build it". "Looks good but…" means keep iterating.
Step 4: Build
Only after step 3 is approved.
Detect the Vue version first (references/vue-detection.md), state it, then load only the matching conventions file — never both:
Detected: Vue 3.5.x. Loading vue3-conventions.md.
- Vue 3.x →
references/vue3-conventions.md - Vue 2.x →
references/vue2-conventions.md
Tailwind: classes from the step-2 mapping only; group layout → spacing → sizing → typography → color → effects → state; use :class object literals for conditionals.
Auto-layout → flex: HORIZONTAL → flex flex-row, VERTICAL → flex flex-col, itemSpacing → gap-N, padding → p/px/py/pt…-N (symmetric-aware), alignment → justify-* (primary) + items-* (counter).
Assets: export the step-1 inventory via download_assets into the assets dir; reference real files. Never a placeholder comment, emoji, or box. Never substitute a visually-similar library icon (lucide/heroicons/etc.) by eye — a lookalike is not the icon. Use a library icon only when step-3 reuse mapping explicitly maps that node to it; otherwise the exported SVG from the exact node ID is the icon.
Sizing modes, read from the reference code: w-[Npx] / h-[Npx] / size-[Npx] = fixed; w-full / size-full / flex-[1_0_0] = fill; no width/height class = hug. A measurement on a wrapper the component doesn't own (pt-[125px] on the page column) is the parent's value — it goes in the parent's match-spec entry and to the parent's builder, never dropped.
Tree is the step-3 outline's. Flattening a wrapper, turning two flex rows into a grid, merging siblings — structural choices happen in step 3 with approval. In step 4 they are drift (grid-cols-2 gap-9 yields 382px columns where Figma has 382.5).
Measurement contract — every SFC ships with a class-trace table:
| Class | Figma value | Source |
gap-8.75 | 35px | gap-[35px] on 1400:83362 |
max-w-form | 800px | get_metadata width="800" on 1400:83355 |
Source is a quoted field: a reference-code class + node ID, a get_metadata dimension, a get_variable_defs entry, a step-2 mapping row, or a step-3 outline decision. rounded, nearest, inferred, dropped are not sources — each such row is a blocker the architect surfaces to the user before the file counts as built. A value with no project token gets the exact value in the config diff (spacing: { '8.75': '2.1875rem' }); the user applies config, the builder never picks nearer.
| Rationalization | Reality |
| "Off by 1px — near-match rule" | Near-match is the user's call in step 2. The builder renders exact. |
"Tailwind has no h-4.5 / w-50" | Propose the token with the exact value. A nearest class is a guess with a name. |
| "That offset belongs to the page, not my component" | Then it belongs in the page's spec — hand it up, don't drop it. |
| "Pure wrapper, flattened" / "two rows == a grid" | Structure is the approved outline. Re-nesting changes widths. |
| "Extra wrapper for DRY — same box" | Structure is the approved outline; DRY is the post-build dx pass. |
| "0.5px, no visible difference" | Step 5 measures it. Sub-pixel drift is still a fail row. |
Build bottom-up — leaves first, composites next, page last. Each Component node becomes a self-contained SFC with its step-3 API, never page markup to split later.
After each file: (1) lint, (2) typecheck if TS, (3) fix failures before the next file, (4) run its Phase A visual match (step 5) before building the next — build → match → next, so a drifted leaf never gets composed. If the dev server/Playwright isn't up, defer Phase A to step 5 and flag it. (5) Report the diff, the class-trace table, and any tailwind.config additions separately (user applies config changes).
Step 5: Visual match loop
Only after build passes lint/typecheck. Requires Playwright + a running dev server. Ask the user once for the base URL + route per view (http://localhost:5173/checkout) — never infer routes from the router.
The two-gate rule. No screen is ✓ matched until BOTH pass: (1) an itemized diff table with zero HIGH/MEDIUM rows, and (2) the pixel diff is clean — pixelClose: true AND localized: false. A visual glance, "looks right", or correct-component/correct-structure is not sufficient. The table catches wrong tokens/structure the pixels would let slide; pixelClose catches whole-image drift no measured field covers; localized catches a small but wrong element (a swapped icon, an off-color chip) that's too few pixels to move the global ratio.
Two phases: Phase A per component (normally interleaved with step 4), then Phase B per page. Phase B starts only when every component is ✓ matched or reported blocked.
The loop (per target) — two subagents, never the same one (architect spawns them: develop = the frontend agent, qa = the qa agent):
get target image → develop → qa → fail? ─(findings back to develop)─┐
▲ │
└──────────────────────────────────────────────┘
qa passes? → done ✓ matched- develop — the builder subagent. Writes/fixes the
.vue+ Tailwind using Figma + step-2 mapping values only. First pass builds from the step-3 outline; every later pass consumes the qa findings and re-develops. Owns all edits; never marks its own work matched. - qa — the gate (this is the "match" — one comparison, no separate step). A fresh-eyes subagent that never saw the build, read-only, handed only the match-spec, the target
get_screenshot, and the URL. Runs the gate below, returns a verdict + findings, and never edits code. A new qa spawns each iteration — it never sees prior fixes.
On fail, qa returns its findings to develop; develop fixes and re-lints/re-typechecks; a fresh qa re-runs the gate. On done (verdict ✓ matched), stop.
The gate (qa runs this on every target — component in A, page in B)
- Target —
get_screenshotof the node. - Actual — deterministic capture. Via Playwright: set viewport to the Figma frame width and
deviceScaleFactorto the export scale (usually 2) so target/actual share pixel dimensions. Screenshot the matched element (Phase A: the component's root, not the parent; Phase B: the page). Use a stable selector; if none, adddata-figma-node="<nodeId>"to the SFC root and select on it. Before the screenshot, kill non-layout variance or it reads as drift (these are the "named false-diff sources" — remove them, don't tolerate them):await page.evaluate(() => document.fonts.ready)— an unswapped webfont is the #1 false diff.- Inject
* { animation: none !important; transition: none !important; caret-color: transparent !important; }and passscreenshot({ animations: 'disabled' })— no mid-animation frame, no blinking caret. - Seed the element with the exact Figma copy (from the step-1 report) so a text-region diff means layout drift, not placeholder-vs-live text.
- Mask genuinely dynamic regions (dates, avatars, random data) with
screenshot({ mask: [...] })so they can't inflate the ratio.
Measure, then table — numbers first, eye second. Pull computed styles (
getComputedStyle: padding, gap,font-size,line-height,font-weight,color,width,border-radius) and assert each against the step-1 match-spec. Tolerances: spacing exact, sizing ±1px, color exact (compare asrgb()). Every out-of-tolerance field is an automatic diff row — the eye gets no vote on numbers. Then write the table, seeded with failed assertions + visual-only aspects (missing/extra element, wrong image/icon):# Aspect Figma Render Impact (H/M/L) Walk every aspect explicitly — one you don't write a row for is one you didn't check: overall width (full-bleed vs centered), container max-width, column count + each width, row count, row/cell height, header alignment + fill, footers/toolbars, toggles, headings, page background, plus spacing, typography, radius, shadow. H = wrong layout/size/structure/color a user sees; M = off-by-a-token spacing/size/weight; L = sub-pixel/AA.
- Side-by-side pixel diff (required). Run
references/visual-diff.mjs target.png actual.png <outDir>→ writesside-by-side.png(target | actual | diff) + prints{ ratio, pixelClose, maxCluster, localized }. Viewside-by-side.png— the red panel points at what's off; seed a row for every visual-only diff it exposes. AsizeMismatch= wrong viewport/scale, fix that first.localized: true= a concentrated diff cluster atmaxCluster.box([x,y,w,h]) — a small but real defect the globalratiohides, so it's an automatic HIGH row; look at that box in the diff panel and name what's wrong there. - Verdict (qa returns it — qa never fixes).
✓ matchedonly if zero H/M rows ANDpixelCloseAND notlocalized→done. Any H/M row, not-pixel-close, orlocalized⇒⚠ not matched: qa hands the table + findings back to develop, which fixes the.vue/Tailwind using Figma/mapping values only and re-lints + re-typechecks; then a fresh qa re-runs this gate. No written table or no pixel run ⇒ can't be marked matched at all. - Interactive states. For each state the Figma set draws (hover/focus/active/disabled/selected, enumerated in step 3), drive it in Playwright,
get_screenshotthe matching variant node, and re-run this gate for that state. A resting match with a broken hover/disabled is⚠ not matched. Phase A owns per-component states; Phase B re-checks only page-level states (e.g. a row hover spanning components). - No iteration cap. Loop until zero H/M rows AND
pixelCloseAND notlocalized. Only exits: a named blocker (missing token/font) or the no-progress stop.
Guard rails
- Icon/image diffs are asset diffs, never style diffs. Don't eyeball paths, tweak size, or swap a similar icon — re-export via
download_assetsfrom the node ID in §7 and replace the file. Compare = rendered asset is that node's export + size/color match spec. - Never emit an arbitrary value to force a pixel match (Core rule 2). If closing a diff needs a token-less value, propose the exact token and flag it as a blocker; never close it with a nearer class (Core rule 3).
- No-progress stop. If both the diff list and the pixel ratio are unchanged from the prior iteration, stop and report. A dropping ratio is progress; a stuck one with an unchanged table is not.
- False-diff sources are eliminated at capture, not tolerated in the loop. Unloaded font, mid-animation frame, blinking caret, placeholder-vs-live copy, and dynamic data are all removed by the deterministic capture in gate step 2 (
fonts.ready, animations off, seeded copy, masked regions). If one still shows, fix the capture, don't excuse the diff. Layout/size/color diffs are never "noise" — always real H/M rows. - Fresh eyes are mandatory. qa is a separate subagent that never saw the build and never persists across iterations (see The loop above) — tell it to assume the render is wrong until numbers prove otherwise. develop never QAs its own work; qa never edits.
The gate exists to make this impossible: a full-bleed table (frame at x=0) rendered as centered max-w-[1400px] mx-auto with guessed column widths and 1 row instead of 6, declared ✓ matched with no table. Now the missing table blocks the verdict and each of those is a HIGH row.
Output — per component (A), then per page (B): ✓ matched (N iterations) or ⚠ blocked / no progress + the diff list, last side-by-side image, and any token/font blockers.
Skipping steps
"Just build it" / "skip the outline" → comply, but warn once: "Skipping the outline is the most common cause of structural mismatches; flagging it for the record." Don't repeat the warning. Never skip step 1 — without inspection everything downstream is guessing.
Output format
One labeled section per step:
## Step 1: Inspection [report]
## Step 2: Token mapping [table + proposed config additions]
## Step 3: Outline [files + per-file outline]
**STOP — approve before I build.**Step 4 writes the files + a summary. Step 5 outputs the Phase A (per-component) then Phase B (per-page) match reports.
Reference files
references/inspection-template.md— exact step-1 report formatreferences/token-mapping.md— step-2 decision rules + examplesreferences/visual-diff-harness.md— step-5 harness, thresholds, two-gate rulereferences/vue-detection.md— Vue version detection (load first in step 4)references/vue3-conventions.md— Vue 3 SFC patterns (load only if Vue 3)references/vue2-conventions.md— Vue 2 / 2.7 SFC patterns (load only if Vue 2)
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.

