- Home
- Skills
- Frontend & Web Apps
- Code to Figma — Export Running Code at 4 Fidelity Levels
More screenshots
Works with the AI tools you already use
Code to Figma — Export Running Code at 4 Fidelity Levels
Sends implemented code to Figma at a chosen fidelity — from a pixel-perfect screenshot up to full components with variables bound to your real design tokens. Handles dynamic routes with a batch-export option.
$15
Code to Figma — Export Running Code at 4 Fidelity Levels
Example session with this skill installed
/code-to-figma
- Read your context and instructions
- Compiled the code to figma
- Generated the image
The project is LOOP THREAD, an Astro 7 + Tailwind v4 storefront with real design tokens in @theme (colors, spacing, font weights) and two reusable components (CategoryCard.astro, ProductCard.astro) already in the source. The agent asked which page (homepage) and which level, then ran both Level 1 and Level 4 for this demo.
Level 1 — Code to Canvas
The agent built the project, started the preview server, added the temporary capture script, and used chrome-devtools-mcp (no browser extension needed) to open the capture URL. generate_figma_design reported completed after one poll cycle. The homepage (1512 × 3116) landed in Figma as a pixel-perfect, non-editable capture.
Level 4 — Full (nodes + components + variables)
This is the level that rebuilds the whole page as real, editable structure — not just a captured image. Reading global.css and every component file directly, the agent reconstructed all six sections (header, hero, categories, featured products, transparency, footer) as auto-layout nodes at 1440px, then componentized the repeating elements and bound every color and spacing value to variables:
| Created | Count | Detail |
|---|---|---|
| Color variables | 5 | color/brand-primary, color/brand-secondary, color/ink, color/base-white, color/border — scoped, never ALL_SCOPES |
| Spacing variables | 15 | every --spacing-fig-* value actually used across the page (4 through 119), scoped to GAP |
| Button | 2 variants, 3 instances | Style=Primary / Style=Secondary, a Label text property, used in the hero and the transparency CTA |
| Category Card | 3 instances | real content (T-Shirts, Sweatshirts, Outerwear) via Title / Price range text properties |
| Product Card | 4 instances | real content for all four products via Name / Price / Material text properties |
| Full page | 1440 × 2827 | 136 nodes, 62 text layers, all six sections present in the same order as the source |
Three bugs found and fixed during the run
The agent doesn't just generate and stop — it screenshots the result and audits it against what the code actually says:
Text overflow: the Product Card's name text hugged its content width, overflowing the card's fixed 220px width for longer names and clipping the price next to it. Fixed by switching the name to fill the available width with auto-height wrapping, matching the code's own flex behavior.
2.
Dropped opacity: the card image's 8%-opacity border (rgba(26,26,26,0.08) in the code) bound to the color variable correctly but came back at full opacity — setBoundVariableForPaint returns a new paint object that doesn't carry over the opacity set on the input. Fixed by applying the opacity to the returned paint instead.
3.
Leftover default fills on wrapper frames: an audit of every fill on the page found 56 auto-layout frames (nav row, button row, section headings, card rows, and more) still carrying Figma's default white fill, even though none of the corresponding <div>s in the source have a bg-* class — they're meant to be transparent. This is the exact wrapper-frame pitfall this skill's own references/known-pitfalls.md documents. Fixed by clearing fills on every pure layout wrapper and confirming, separately, that SiteHeader and SiteFooter — which do have bg-base-white in the source — kept a real bound fill instead of losing it in the same pass.
All three fixes were verified by re-reading the affected nodes' resolved values, and a final pass confirmed zero unbound solid fills remained anywhere on the page except the (at that point still placeholder) image areas.
A second pass: checked directly against the real Code to Canvas capture
Neutral-gray placeholders and eyeballed sizes are not good enough for a "Full" level that claims to rebuild the real page. Placing the Level 4 output next to the real Level 1 capture in the same file surfaced four more real gaps:
Card sizes didn't match the code's actual Tailwind scale. The category/product cards had been sized by eye instead of computed from the source's numeric utility classes (w-90, w-120, etc. — Tailwind v4's numeric scale is 1 unit = 4px). Recomputed exactly and resized every card and its image to match.
2.
Alignment was wrong for one section. The source's Categories heading and card row use lg:justify-end lg:items-end lg:text-right — right-aligned — but the rebuild had left them at the default left alignment. Fixed by setting counterAxisAlignItems/primaryAxisAlignItems to MAX and the heading's textAlignHorizontal to RIGHT.
3. A whole nested element was dropped, and its replacement data was invented. Each EmissionRow in the source has a two-layer bar: a light track plus a colored progress segment at a constant w-1/6 for every row. The rebuild only drew the track and — worse — fabricated varying proportions (1/6, 2/6, 4/6, 1/6) that don't exist in the source. Fixed by adding the real second bar at the real constant width, and this is now called out explicitly rather than glossed over.
4.
No real images. The 8 image areas (hero + 3 category cards + 4 product cards) were still generic gray placeholders. Uploaded the project's own real photos via the upload_assets MCP tool and applied each one to its correct target node.
A genuine new bug surfaced while fixing #4: the source images are .webp. upload_assets accepted them, returned a valid imageHash, and the resulting fill read back as completely correct (type: 'IMAGE', right hash, opacity: 1, bytes verifiable via getImageByHash) — but the image rendered as a blank white rectangle, both in a fresh screenshot and (going by the same evidence) on the canvas itself. Converting the same files to PNG and re-uploading rendered them correctly immediately, with nothing else changed. This wasn't previously documented anywhere, so it's now recorded in the skill's own references/known-pitfalls.md for future runs.
A third pass: two more real defects, caught by looking at the corrected screenshot itself
Even after the second pass, two things still looked wrong once the page was actually inspected again:
- The EmissionRow bars still looked like one solid flat line, not a two-tone track + progress bar. Two separate bugs compounded: the
color/bordervariable used for the track was created with full opacity baked in (a: 1, not the source's translucent value), and the progress-bar rectangle added in the second pass was positioned at the wrong y-coordinate — outside its parent frame's clipped bounds — so it was invisible the entire time, never actually rendering on top of the track at all. Fixed by applying paint-level opacity to the track (the same class of fix as the earlier opacity bug, reapplied — a fix on one node doesn't carry over to a different node binding the same variable) and repositioning the progress bar to exactly match the track's coordinates.
The product card row's right edge was clipped. The card width had been copied as a literal pixel value from the Level 1 capture (319.25px, taken at a 1512px browser viewport) instead of being recomputed for the Level 4 rebuild's own 1440px frame. The source uses a CSS Grid (grid-cols-4), so the card width is a fraction of its container — 301.25px at 1440px, not a fixed value that travels between viewports. Using the captured value made 4 cards overflow the row by 72px, silently clipped with no error. Recomputing the fraction against the rebuild's own row width fixed it exactly.
Both are now documented as new entries in the skill's own references/known-pitfalls.md — the grid-fraction-vs-fixed-scale confusion as a new rule, since it hadn't been seen before, and the recurring-opacity-drop as an addendum to the existing one.
A fourth pass: the header/footer border was still solid, and a better verification method
After the third pass, the header and footer borders still rendered as solid flat lines instead of a faint hairline. This time the fix wasn't just "apply the same patch to one more node" — it changed how this class of bug gets found and fixed at all:
- Verified against the live site, not just another Figma screenshot. The project's own dev server was started, and the exact computed
border-colorwas read straight from the live DOM for every element using the border style — consistentlyrgba(26, 26, 26, 0.08)everywhere in the real page. A translucent border and an opaque one of the same color are genuinely hard to tell apart by eye in a screenshot comparison; reading the real computed value removed any doubt about the target.
A file-wide scan, not a spot check. Rather than assuming the earlier two opacity fixes had covered every instance, every single node bound to the color/border variable was enumerated across the whole file in one pass. This turned up
9 more untouched bindings beyond the two already patched: the header's bottom border, the footer's top border, the footer's bottom copyright-row border, the hero image's border, all 3 category-card image borders, and 3 of 4 product-card image instances (whose per-instance overrides had quietly diverged from their already-fixed master once other properties, like the uploaded photo, were set on them).
3. Fixed the variable itself instead of patching nodes one at a time. Rather than reapplying the same per-paint opacity override a 12th time, the color/border variable's own value was updated to carry the real alpha ({r, g, b, a: 0.08}). Every one of the 11 bindings resolved correctly immediately, with zero per-node edits — because there was no longer a separate opacity value for any binding to lose.
This changed the skill's own guidance: references/known-pitfalls.md's Rule 22 now recommends baking alpha into the variable as the only reliable fix rather than a preference, and its mandatory pre-completion verification (Rule 2) now includes cross-checking computed styles against a live dev server whenever one is available — which it always should be for Level 2–4, since they require one to read the source from in the first place.
A final screenshot after all four passes confirms cards at the correct size with no overflow, the Categories section right-aligned, real two-tone emission bars on every row, all 8 real product photos in place, and every border at its correct faint opacity.
Re-verified on a second, unrelated project
To confirm the fixes above actually generalize rather than being specific to this one page, Level 4 was run again from scratch on a completely different, real Astro project — an Okinawan villa-rental site with its own design tokens, its own translucent-color naming (already split into separate -a72/-a35/-a15/-a10 tokens at the CSS level), a CSS Grid/flex-1 layout, and its own local .webp photos. Every one of the bug classes found above was checked for and came back clean on the first attempt: correct alpha on every translucent binding, no row overflow, all images rendering (PNG-converted per the fix), and computed styles matching the live site exactly. One new, unrelated bug did turn up in that run — combineAsVariants() silently dropping one component variant's padding — and is now documented and fixed the same way as everything above.
Summary
| Level | Output |
|---|---|
| 1 — Code to Canvas | 1 frame, pixel-perfect capture, 0 manual fixes needed |
| 4 — Full | 1 full page (6 sections, 136 nodes) · 2 variable collections (20 variables) · 3 components (2 variants + 7 more instances, 10 instances total) · every fill/stroke/padding bound to a variable · 8 real images uploaded and applied · 3 bugs found and fixed during the initial build, 6 more found and fixed against the real capture across two passes, then 11 more opacity bindings found via a file-wide scan and fixed at the source (the variable itself) in a fourth pass · re-run clean on a second, unrelated project (one new unrelated bug found and fixed) — 4 new pitfalls now documented in total, including a live-browser verification method |
The same page now exists in Figma two ways: an exact visual reference (Level 1) and a design-system-quality, fully editable version built from the code's real structure, tokens, and images (Level 4) — both from the same source, at whichever fidelity the task needs.
code-to-figma-export-running-code-at-4-f.png
PNG · 1536×1024
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
What you get
About this skill
Turning working code into a Figma file usually means one of two extremes: a flat screenshot that isn't editable, or a full manual rebuild. This skill puts four fidelity levels on a dial and lets you pick per export, from a quick visual reference to a design-system-quality file with your code's real tokens.
What it does
- Level 1 — Code to Canvas: captures the rendered page as-is through a real browser (fastest, pixel-perfect, non-editable image)
- Level 2 — Node Generation: creates real Figma nodes with auto layout, reading the source directly (no browser needed)
- Level 3 — Componentize: adds component and variant structure on top of Level 2
- Level 4 — Full: components with variables bound to the color/spacing tokens actually defined in your codebase — design-system quality
- Handles dynamic
[slug]routes (Astro Content Collections): resolves the real entries and lets you export one, several, or all of them, with a confirmation before a large batch - Reports what was created and offers to capture another page or finish
How it works
- Detects the page(s) in your project's routing, or asks for a URL
- Asks which fidelity level, and for Level 1, which viewport(s)
- Level 1 builds your project, starts the preview server, and captures it through a Chrome extension, a CDP-based plugin, or — if neither is available — the OS
opencommand, so it still works in agents without a browser automation tool - Level 2–4 read the source file directly and write nodes (and components/variables for 3–4) via the Figma API
What it is not
It does not guess which page or fidelity level to use — it always asks first, unless already specified. Level 1 needs a Node.js project with a working build/preview script; it does not work on a site with no local dev tooling. Level 2–4 do not upload externally-hosted images (only local/bundled assets) — it flags this and asks before proceeding rather than silently leaving blank boxes.
Requirements
Runs inside an agent connected to the official Figma MCP server. Level 1 additionally needs a buildable Node.js project (Astro, Vite/React, plain HTML, etc.) and, ideally, a browser automation tool (a Chrome extension or a CDP-based plugin) for viewport switching — without one, it falls back to the OS open command and Desktop-only capture. Level 2–4 need read (and, briefly, write) access to the project's source files, and no browser at all.
Try it free first
Try it Free on Agensi does not apply to this skill: the free trial runs on Agensi's own servers, which have no dev server or browser to capture. Use the example session above to see what a real run looks like; buy the skill and run it on your own project to use it for real.
Works well with
A good next step after building a page with any mockup/scaffolding workflow. Level 4's output pairs well with further Figma-side structuring (tokenizing, componentizing) if you want to keep refining the result.
More from KMRVID
The full Claude Code skill bundle for Figma, Tailwind and Astro workflows is available on Gumroad: https://gaspanik.gumroad.com/l/kmrvid-claudeskills
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean today
- Passed all security checks, Safe to install