This plugin converts Figma designs to code with pixel-perfect fidelity while respecting the existing codebase architecture.
This plugin requires the Figma MCP Remote Server. Before using any command, ensure the MCP server is connected:
- Run
/mcpin Claude Code to check connection status - If not connected, authorize via Figma OAuth when prompted
- The server URL is:
https://mcp.figma.com/mcp
- ALWAYS extract design context using
get_design_contextbefore generating code - Use
get_screenshotto maintain visual accuracy for complex layouts - Never approximate values - use exact measurements from Figma
- ALWAYS analyze the existing codebase before generating code
- Detect framework from
package.json(React, Vue, Svelte, vanilla) - Reuse existing components when similarity > 80%
- Follow naming conventions already established in the project
- Use existing design tokens/CSS variables when available
- Extract variables using
get_variable_defsfor colors, spacing, typography - Map Figma variables to CSS custom properties, Tailwind config (v3), or CSS theme (v4)
- Never hardcode values that exist as design tokens
⚠️ CRITICAL: When design token conflicts are detected between Figma and codebase:- STOP implementation immediately
- PRESENT detailed comparison to user
- WAIT for explicit user approval before making ANY modifications
- NEVER assume which value to use or modify tokens automatically
- New: Create following existing architecture patterns
- Match (>80%): Propose merge with existing component
- Different: Create variant with descriptive name (e.g.,
button-hero.tsx) - Conflict: STOP and ask user for decision
- When
components.jsonis detected, project uses shadcn/ui - ALWAYS prefer CLI installation over manual component creation:
- Use
pnpm dlx shadcn@latest add <component>ornpx shadcn@latest add <component> - DO NOT create shadcn/ui components manually
- Use
- Reference https://ui.shadcn.com/llms.txt for component documentation and available components
- Map Figma designs to shadcn/ui components when applicable
- CHECK package.json for icon libraries before implementing icons
- If
@iconify/reactis installed (React/Next.js):- USE
<Icon icon="icon-name" />from@iconify/react - DO NOT create SVG components manually
- USE
- If
astro-iconis installed (Astro):- USE
<Icon name="icon-name" />fromastro-icon/components
- USE
- If no icon library is present, extract SVG from Figma or suggest installation
⚠️ MANDATORY APPROVAL required for:- Updating design tokens in config files
- Overriding existing components
- Adding new dependencies
- Modifying shared utility functions
- Changing global CSS/theme files
- ALWAYS show full impact analysis before requesting approval
- PROVIDE option to see detailed diffs
- NEVER make structural changes without explicit user confirmation
| Tool | When to Use |
|---|---|
get_design_context |
First step - get structured representation of Figma selection |
get_variable_defs |
Extract design tokens (colors, spacing, typography) |
get_screenshot |
Visual reference for complex layouts |
get_code_connect_map |
Check existing component mappings |
get_metadata |
Get layer structure for large designs |
-
Be explicit about tools: If output seems wrong, explicitly request the tool
- "Get the variable names and values" triggers
get_variable_defs - "Generate code for this frame" triggers
get_design_context
- "Get the variable names and values" triggers
-
Handle large designs: Use
get_metadatafirst, then fetch specific nodes -
Asset handling: If MCP returns localhost URLs for images/SVGs, use them directly
package.json detection:
├── next/react → App Router + shadcn/ui + Tailwind + Radix
├── vue/nuxt → Nuxt UI + Headless UI + Tailwind
├── svelte/kit → Skeleton UI + Tailwind
├── astro → Astro components + Tailwind
└── no framework → Vanilla HTML + Tailwind + Alpine.js
components/
├── ui/ # Base components (Button, Input, Card)
├── blocks/ # Composite components (Hero, Navbar, Footer)
└── [feature]/ # Feature-specific components
- Use TypeScript when project uses TypeScript
- Include proper props typing
- Follow existing ESLint/Prettier configuration
- Add accessibility attributes (ARIA labels, roles)
When validating implementations:
- Compare dimensions with ±2px tolerance
- Verify all design tokens are correctly mapped
- Check responsive behavior matches Figma constraints
- Ensure color values match exactly (no approximations)
- Never commit changes automatically
- Never modify files outside the component scope without asking
- Never ignore existing design system in favor of Figma values
- Never skip the codebase analysis step
- Never hardcode colors/spacing when tokens exist