
If you’ve ever worked on a frontend team, you know the drill: the design system in Figma looks pristine, but the moment it hits the codebase, things start to drift. Tokens get renamed, spacing gets eyeballed in the browser, and before you know it, your single source of truth has completely splintered.
For our client Able’s design system, we got tired of this inevitable gravity. We wanted to go from design to code without the gap. So, we built a continuous, bi-directional workflow between Figma and our production HTML using Claude Code’s MCP toolchain.
.png)
Here is exactly how we automated the translation layer and killed the manual handoff for good.
The traditional handoff process is where consistency goes to die. We were constantly running into three major roadblocks:
color/cta/default) were being translated into raw hex codes by the time they hit the CSS, entirely breaking the semantic link.To fix this, we set up a pipeline where Claude handles the reading, reasoning, writing, validating, and pushing - all inside a single conversation.
Here is the step-by-step breakdown:
1. Get the Design Context
We simply pass the Figma URL to Claude. Claude extracts the node ID and calls get_design_context to pull the full spec: layout rules, spacing, fills, typography, and a suggested code scaffold. It also runs get_screenshot in parallel to establish a visual ground truth.
2. Map the Tokens
Figma variable names map directly to our CSS custom properties. Claude uses the get_variable_defs tool to resolve any unknown variables into hex values before writing a single line of code.
3. Build Production HTML
Next, Claude writes self-contained HTML with the CSS housed in a <style> tag. The strict rule here is zero hardcoded values - every single value must use a var(--token) reference.
4. The Visual Validation Loop
We don't just trust the generated code; we verify it.
figma_capture_screenshot plugin tool to grab the live state of the Figma node (avoiding the stale REST API cache).preview_screenshot.5. Push Back to Figma
Once the HTML is validated, Claude uses the import-html tool to push the component fragment directly back onto the Figma canvas. Both the codebase and the design artifact remain perfectly in sync as live references.
Each of the components below was translated directly from a Figma node using the five-step workflow. Every value references the shared token system - no hardcoded properties anywhere.
The reason this works so seamlessly is our strict 1:1 token mapping. A Figma variable like spacing/7 maps exactly to the CSS property --spacing-7 (which resolves to 24px).
To keep Claude from drifting, we maintain the entire token table inside a CLAUDE.md project memory file. Because this file is auto-loaded at the start of every session, Claude reads the vocabulary before writing any code, ensuring absolute consistency.
The outcomes of this continuous sync were immediate and highly measurable:

By letting Claude act as the translator, we finally closed the loop. Figma has the design intent, the codebase has the production output, and they are both pointing at the exact same truth.
