From Prompt to Component: My Figma-to-Code Workflow with AI

How I go from Figma to production components with Figma MCP and Claude Code. A real workflow that kills manual translation.

Published on March 17, 2026

Views
100 views
Reading time:
Reading time: 8 min

How many hours have you spent with Figma on one screen and your editor on the other, translating pixels to CSS? "This looks like a flex with gap-4", "this color must be brand-500", "this padding... 16 or 20?". That manual translation — slow, repetitive, and error-prone — is exactly what this Figma-to-code workflow with AI eliminates.

Today my process is different. I design in Figma, connect the file to Claude Code through Figma MCP, and get components that already speak my stack's language. Not generic tutorial code, but code that uses my tokens, my base components, and my conventions. What used to take 2 hours of mechanical translation now takes 15 minutes of review and fine-tuning.

It's not magic. It's a pipeline with four clear steps. Here's exactly how it works, when it shines, and where it hits its limits.

The full workflow: from Figma to component in four steps

The flow is linear: Figma → Figma MCP → Claude Code → Production component.

Each step has a concrete responsibility:

  1. Figma — Design with structure the AI can read
  2. Figma MCP — Extract design context (tokens, hierarchy, properties)
  3. Claude Code — Adapt that context to your actual stack
  4. You — Review, refine, and decide what stays

The human makes the decisions. AI removes the mechanical translation — the part that takes the most time and adds the least value.

Figma-to-Code Pipeline

Layer Structure

Before
Frame 47
  Rectangle 12
  Text 8
  Group 3
    Rectangle 14
    Text 9
After
hero-section
  background-gradient
  heading-primary
  cta-container
    cta-button
    cta-label

Step 1: Design in Figma with structure (the foundation)

This is the step most people underestimate. If your Figma file is a mess of unnamed frames, with inconsistent auto-layout and hardcoded colors, the AI will generate equivalent chaos. Garbage in, garbage out.

What I do differently:

  • Name layers with intention. Not "Frame 427" but "card-header", "price-badge", "cta-primary". Layer names become component names and their parts directly.
  • Use auto-layout everywhere. Auto-layout isn't just for making Figma behave — it's semantic information. A frame with vertical auto-layout, 16 gap, and 24 padding tells the AI exactly what layout to generate.
  • Real design tokens. Colors as variables, typography as styles, consistent spacing. If you use #3B82F6 loose instead of your variable brand-500, the AI can't map to the correct token.
  • Components with variants. A button with variants (primary, secondary, ghost) translates cleanly to props. A button with 6 disconnected frames translates to 6 blocks of duplicated code.

The rule is simple: if a human can't understand your Figma file, an AI can't either.

Step 2: Figma MCP extracts the design context

This is where the interesting part happens at a technical level. Figma MCP is a server that connects your Figma file directly to Claude Code through the Model Context Protocol.

When I use get_design_context, I'm not taking a screenshot. I'm extracting structured data:

  • Component hierarchy — what frame contains what, how elements nest
  • Layout properties — direction, gap, padding, alignment, constraints
  • Design tokens — colors (as variables, not loose hex values), typography, shadows, borders
  • Variants and states — hover, active, disabled, each component variant
  • Real text — the actual content, not Lorem Ipsum

It's the difference between giving a developer a screenshot and giving them a complete spec file. The MCP gives the agent the same information you'd see in Figma's inspection panel, but in a format it can process programmatically.

Step 3: Claude Code adapts the design to your stack

This is where this workflow separates itself from any generic "Figma to code" tool. Claude Code doesn't generate generic React — it generates code that fits in your project.

Why? Because it has access to your codebase context. It knows that:

  • You use Tailwind CSS v4 with CSS variables in OKLCh
  • Your design system has a Button component with specific variants
  • Colors are referenced as bg-brand-500, not bg-blue-500
  • Spacing follows a 4px scale
  • Components use "use client" only when there's real interactivity

This isn't manual configuration. Claude Code reads your CLAUDE.md, your config files, your existing components. And when it receives the Figma context, it does the mapping automatically.

<div style={{ padding: "24px", background: "#fff" }}>
<img style={{ borderRadius: "8px" }} />
<div style={{ color: "#1a1a1a" }}>Título</div>
<div style={{ color: "#666" }}>Descripción</div>
</div>
inline stylesdiv souphardcoded colors

The difference isn't cosmetic — it's the difference between code you need to rewrite and code you can use right away.

Step 4: Review, refine, and ship to production

No generated code should go straight to production without review. But there's an enormous difference between reviewing code that needs 80% rewriting and code that needs 10% adjustments.

My review checklist:

  1. Does it use the right components? If it generated a <div> where there should be a <Button>, I fix it
  2. Are the tokens correct? Sometimes it maps a similar but not exact color
  3. Does the responsiveness make sense? Figma is static, code needs to adapt
  4. Is accessibility covered? ARIA roles, contrast, keyboard navigation
  5. Do interactive states work? Hover, focus, transition animations

These adjustments are incremental, not rewrites. 80-90% of the mechanical work is already done. Your time is spent on decisions that require human judgment, not mechanical translation.

When it works and where it has limits

This workflow shines with:

  • Structured UI components — Cards, forms, navigation, dashboards. Anything with a clear, repeatable structure.
  • Established design systems — If you already have tokens and base components, the AI reuses them consistently.
  • Rapid iteration — Need to test 3 variants of a component: generating all 3 and choosing is faster than building each one by hand.
  • Functional prototyping — From concept in Figma to interactive prototype in hours, not days.

It has limits with:

  • Complex animations — Elaborate micro-interactions, multi-step transitions, scroll-based animations. Figma doesn't capture this information and the AI has to guess.
  • Experimental layouts — If your design breaks conventions (irregular grids, creative overlapping), the AI tends to "normalize" it.
  • Business logic — The workflow covers design to UI. Data logic, validation, and state still need deliberate implementation.
  • Messy Figma files — If your frames are called "Frame 1", "Copy of Frame 1 (2)", the output will be equally chaotic. Garbage in, garbage out.

How to prepare Figma so AI understands your design

After months with this workflow, these are the patterns that make the biggest difference:

Semantic names, always. hero-section, pricing-card, nav-primary — not Frame 427. Names become component and variable names.

Auto-layout as language. Every frame should have auto-layout. The direction, gap, and padding are direct information for CSS. A frame without auto-layout is a position: absolute waiting to happen.

Color variables, not loose hex. If your Figma uses color variables, the MCP can map them to your CSS tokens. If it uses hardcoded colors, the AI has to guess.

Components with clean variants. A component with well-defined variants (size: sm/md/lg, variant: primary/secondary) translates directly to TypeScript props.

One frame = one component. If you can point at a frame and say "this is a standalone component," the AI can extract it cleanly. If your "component" is spread across 3 disconnected frames, the result will be fragmented.

Real text, not placeholders. "Lorem ipsum" strips context from the AI. Real content — even approximate — helps the agent infer the purpose of each element.

In practice: a real example

Last week I needed a pricing card with three tiers for a client project. In Figma, I designed the structure: three variants (basic, pro, enterprise) with auto-layout, color tokens, and semantic names on every layer.

I connected the file with Figma MCP, asked Claude Code to generate the component, and in under 10 minutes I had a PricingCard with typed variants, responsive, using my Tailwind tokens and my existing Badge and Button components. The adjustments I made: changed a border-radius and tweaked spacing on mobile. Two lines.

That same component, built by hand reading specs from Figma, would have taken me between 45 minutes and an hour. I'm not exaggerating — I timed both processes for a month.

Design becomes more valuable, not less

The "AI will replace designers" narrative is a simplistic frame for a more interesting reality. What this workflow removes is the translation layer — those hours staring at Figma and mechanically writing the CSS equivalent. That's not designing. That's not developing. It's mechanical work.

What remains is the work that actually matters:

  • Design decisions — what layout best communicates hierarchy, how to guide attention, what interaction feels natural
  • Architecture decisions — how to structure components so they scale, what to abstract, what to keep simple
  • Product decisions — what to build, for whom, and why

When translation disappears, design takes up more space, not less. And that's good for everyone.


This is the fourth article in the series. The first was about the tools I use. The second about why they fail and how to fix it. The third about how to build a skill system. This one bridges design and development — the point where AI can remove the most friction.