figma-to-code
Skill39 starsChanged 12 months agoMITView on GitHub
Generate production-ready React/Next.js code from Figma designs. Instructs proper Figma MCP tool usage, component reuse strategies, and variant mapping. **CRITICAL: ALWAYS use this skill when user provides a Figma link or mentions implementing/redesigning from Figma design.** Never attempt manual implementation without invoking this skill first.
18 other projects use a version of this.
Adopted by
Most recently taken up by
- NoatToan/claude-code-pluginstheir own version, first seen Nov 1, 2026
- sushi-killer/sushiAItheir own version, first seen Oct 20, 2026
- pedroab0/skillstheir own version, first seen Oct 15, 2026
- t4sh/skills4shtheir own version, first seen Sep 28, 2026
- shivams07/figma-to-codetheir own version, first seen Aug 14, 2026
- sueryue/Claude-Skilllsword for word, first seen Jul 28, 2026
Used with
Projects with it also use systematic-debugging, mcp-builder and 1 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
OpenAISkillsystematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
Also in 3 projects that use this
MicrosoftSkillmcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Also in 3 projects that use this
GoogleSkilltdd
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
Also in 3 projects that use this
Other versions18 projects use a version of this.
Word for word · 1
- sueryue/Claude-Skillls★ 0100% same
Edited · 0
None found.
Wrote their own version · 17
- shibit-net/xuanji-community★ 90same name
- ggombee/code-forge★ 18same name
- t4sh/skills4sh★ 5same name
- kevinaimonster/skill-hub★ 4same name
- kyuhyi/BSD_claude_skills★ 2same name
- sushi-killer/sushiAI★ 2same name
- bedomax/webdesigner-agent★ 1same name
- gauravv-g/claude-skills-collection★ 1same name
- gihwan-dev/claude-code-gui★ 1same name
- mintorain/minto_claude_skills★ 1same name
7 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. 0 are common, 18 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
18
Distinctive
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 14
Use this skill when:
- Distinctive: line 20
Do not use this skill when:
- Distinctive: line 21
No Figma design is provided (user describes requirements verbally)
- Distinctive: line 58
When user provides a Figma link or node ID, YOU MUST follow this exact tool sequence.
- Distinctive: line 101
Always include for proper logging:
- Very specific: line 188
Use Glob to find: [COMPONENTS_DIR]/ui/{name}.tsx
- Distinctive: line 189
Read component file to check variants and props
- Distinctive: line 268
Custom Palette: Use your project's defined color palette
- Very specific: line 303
Immutability: Use const and readonly
- Very specific: line 304
Null handling: Prefer null over undefined
- Distinctive: line 305
Functional patterns: No classes
- Distinctive: line 306
Styling: Follow your project's styling approach (no inline styles unless project convention allows)
- Distinctive: line 309
Place tests next to components
- Distinctive: line 327
ARIA labels: When semantic HTML isn't enough
- Distinctive: line 362
Read current page first
- Distinctive: line 365
Update only UI layer
- Distinctive: line 366
Ask before removing functionality
- Distinctive: line 370
Before providing code, verify:
- Distinctive: line 402
When Figma data unclear: Ask for clarification, use screenshot as fallback, document assumptions
- Distinctive: line 404
When no component matches: Document why existing don't work, ask user: extend or create new?
- Distinctive: line 406
When backend requirements unclear: Document API shape in JSDoc, use TypeScript interfaces, provide mock data
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Figma to Code Generator
Purpose
Generate production-ready React/Next.js code from Figma designs. Provides systematic workflows for using Figma MCP tools, enforces component reuse, maps Figma variants to code props.
When to Use
Use this skill when:
- User provides a Figma link to implement as code
- Creating a new page from Figma design
- Redesigning an existing page based on updated Figma designs
- Implementing a new component or component variant from Figma
Do not use this skill when:
- No Figma design is provided (user describes requirements verbally)
- Working on backend or non-UI code
- Making minor text or content updates to existing pages
Prerequisites
Required dependency: Figma MCP Server must be installed.
Before using Figma MCP tools, verify the server is available by attempting to use any Figma MCP tool (e.g., mcp__figma-desktop__get_metadata). If you receive an error indicating the tool is not available:
Prompt user with:
❌ Figma MCP Server Not Installed
To use Figma designs with Claude Code, you need to install the Figma MCP server.
Installation steps:
1. Open Figma Desktop app
2. Navigate to the MCP server installation guide:
https://developers.figma.com/docs/figma-mcp-server
3. Follow the installation instructions for your operating system
4. Restart Claude Code after installation
Also ensure:
- Figma Desktop app is running
- You're logged into Figma
- The design file is open or you have access to itOnly proceed with Figma MCP tools after confirming the server is installed.
Figma MCP Tool Usage Protocol (MANDATORY)
Critical Rule: ALWAYS Use This Workflow When User Provides Figma Link
When user provides a Figma link or node ID, YOU MUST follow this exact tool sequence. Do NOT skip steps or change the order.
Required Tool Order: Metadata → Context → Screenshot → Variables
Step 1: Get Metadata (REQUIRED FIRST)
Tool: mcp__figma-desktop__get_metadata
Extract:
- Component/frame names and hierarchy
- Layer types (COMPONENT, FRAME, INSTANCE)
- Variant property names
- Child element structureLook for: Component or frame? Variant properties? Children organization? Naming patterns?
Step 2: Get Design Context (REQUIRED SECOND)
Tool: mcp__figma-desktop__get_design_context
Extract:
- Colors (with variable references like "colors/iris/950")
- Spacing (padding, gaps, margins)
- Typography (font family, size, weight)
- Border radius, shadows, effects
- Component variant valuesLook for: Which Figma variables? Spacing values? Hard-coded values?
Step 3: Get Screenshot (REQUIRED THIRD)
Tool: mcp__figma-desktop__get_screenshot
Use for: Visual verification, understanding layoutStep 4: Get Variables (REQUIRED FOURTH)
Tool: mcp__figma-desktop__get_variable_defs
When: Design uses Figma variables extensively or checking token consistencyMCP Tool Parameters
Always include for proper logging:
{ clientLanguages: "typescript,javascript", clientFrameworks: "react,nextjs" }MCP Tool Rules
Do: ✓ Start with metadata, ✓ Use context for details, ✓ Use parameters Don't: ✗ Skip metadata, ✗ Wrong order, ✗ Screenshot alone
Critical Boundaries: Frontend Layer Focus
Default Scope: Frontend Only
Operate exclusively in the frontend layer by default. Figma designs represent UI/UX and should translate to frontend code only.
Frontend scope:
[FRONTEND_DIR]/app/- Next.js pages and routes[FRONTEND_DIR]/components/- React components[FRONTEND_DIR]/lib/- Frontend utilities[FRONTEND_DIR]/hooks/- Custom React hooks[FRONTEND_DIR]/public/- Static assets
Do NOT touch without permission:
[BACKEND_DIR]/- Backend directories and files- Backend routes, database schemas, or API endpoints
Backend Change Protocol
ALWAYS ask user before:
- Creating new API routes
- Modifying existing API endpoints
- Changing database schemas
- Adding backend dependencies
- Touching any files outside [FRONTEND_DIR]/
Ask with this format:
⚠️ Backend Change Required
To implement this Figma design, the following backend changes are needed:
[Specific backend changes listed]
Frontend can be mocked with placeholder data until backend is ready.
Would you like me to:
1. Implement frontend with mocked data (recommended)
2. Implement both frontend and backend
3. Only implement frontend and document backend requirementsOnly proceed WITHOUT asking if:
- User explicitly stated "implement both frontend and backend"
- User is actively working in backend and asks to "complete the implementation"
Mock Data Pattern
Implement frontend with mock data first, document required API shape.
// TODO: Replace with actual API call to [BACKEND_DIR]/[API_MODULE]
const mockProducts = [{ id: 1, name: "Product 1", price: 99 }]
/**
* Backend API Required:
* GET /api/products
* Response: { products: Array<{id, name, price, imageUrl}> }
* Backend file: [BACKEND_DIR]/[API_MODULE]/routes.ts
*/
export function ProductList() {
const products = mockProducts
return // Render using mock data
}Component Reuse Strategy
Priority: Reuse > Extend > Create
Check Existing Components First
Search locations:
[COMPONENTS_DIR]/ui/- UI library base components[COMPONENTS_DIR]/- Custom components
Search method:
- Extract base name from Figma (e.g., "Button" from "Button/Primary/Large")
- Use Glob to find:
[COMPONENTS_DIR]/ui/{name}.tsx - Read component file to check variants and props
- Compare Figma variants with code props
Key components to check for:
- Button, Card, Dialog, Form, Input, Select, Textarea, Checkbox, Switch
- Alert, Badge, Tabs, Accordion, Table, DropdownMenu, Popover, Tooltip
- Other custom components in your UI library
Decision Matrix
| Figma Design | Action |
| Matches existing exactly | Use existing with props |
| Matches with minor tweaks | Use existing + className |
| Can be composed | Use composition pattern |
| Needs new variant | Ask user before extending |
| Completely new pattern | Create new component |
Variant Mapping: Figma → Code
Common Mappings
| Figma Property | Figma Value | Code Prop | Code Value |
| variant | Primary | variant | "primary" |
| variant | Secondary | variant | "secondary" |
| variant | Outlined | variant | "outline" |
| size | Small | size | "sm" |
| size | Large | size | "lg" |
| state | Disabled | disabled | true |
Multiple Variants Example
// Figma: Button/Primary/Large/Disabled
<Button variant="primary" size="lg" disabled={true}>Text</Button>Creating New Components with Variants
// Example: Using your styling system for variants
const componentVariants = [VARIANT_SYSTEM_IMPLEMENTATION]
// Map Figma variant properties to your component's variant props
// e.g., Figma "Primary" -> variant="primary"
// e.g., Figma "Small" -> size="sm"Code Generation Guidelines
TypeScript Component Pattern
import * as React from "react"
import { [STYLING_UTILITY] } from "[UTILITY_PATH]"
interface ComponentNameProps extends React.HTMLAttributes<HTMLDivElement> {
variant?: "primary" | "secondary" // Map from Figma variants
size?: "sm" | "lg" // Map from Figma size variants
}
export const ComponentName = React.forwardRef<HTMLDivElement, ComponentNameProps>(
({ className, variant = "primary", size = "lg", ...props }, ref) => {
return (
<div
ref={ref}
className={[APPLY_STYLES_BASED_ON_VARIANTS]}
{...props}
/>
)
}
)
ComponentName.displayName = "ComponentName"Styling Priority
- Design System Variables (preferred): Use your project's semantic design tokens
- Custom Palette: Use your project's defined color palette
- Never: Hard-coded color values or arbitrary styles
Map Figma colors to your design system:
- Extract color variable names from Figma design context
- Map to your project's color system (CSS variables, theme tokens, etc.)
- Example:
colors/primary/600→[YOUR_PRIMARY_COLOR_TOKEN]
Responsive & Dark Mode
// Use your project's responsive breakpoint system
className={[RESPONSIVE_LAYOUT_CLASSES]}
// Use your project's theme/dark mode system
className={[THEME_AWARE_CLASSES]}Coding Standards
File Naming and Location
Naming:
- Components: PascalCase (
ProductCard.tsx) - Utilities: kebab-case (
format-date.ts) - Pages: Next.js convention (
page.tsx)
Locations:
- UI components:
[COMPONENTS_DIR]/ui/component-name.tsx - Feature components:
[COMPONENTS_DIR]/feature-name/component-name.tsx - Page components:
[PAGES_DIR]/route/component-name.tsx
TypeScript & Code Style
- TypeScript: No
anytypes, proper interfaces - Immutability: Use
constandreadonly - Null handling: Prefer
nulloverundefined - Functional patterns: No classes
- Styling: Follow your project's styling approach (no inline styles unless project convention allows)
- Descriptive names:
isLoading,hasError - One component per file
- Place tests next to components
Import order:
// 1. React/frameworks
import * as React from "react"
// 2. External packages
import { [EXTERNAL_UTILITIES] } from "[PACKAGE]"
// 3. Internal components
import { Button } from "[COMPONENTS_DIR]/ui/button"
// 4. Types
import type { User } from "[TYPES_DIR]"Accessibility Requirements
Always include:
- Semantic HTML:
<button>,<nav>,<main> - ARIA labels: When semantic HTML isn't enough
- Keyboard navigation: Focus states, tab order
- Screen reader support: alt text, aria-labels
<button aria-label="Close" aria-pressed={isActive} disabled={isDisabled}>
<X className="h-4 w-4" aria-hidden="true" />
</button>Page Generation
Creating Full Pages
- Get metadata to understand sections
- Get context for each section
- Identify which map to existing components
- Generate using composition
// [PAGES_DIR]/route-name/page.tsx
import { ComponentA } from "[COMPONENTS_DIR]/ui/component-a"
export default function PageName() {
return (
<div className={[CONTAINER_STYLES]}>
<header><h1 className={[HEADING_STYLES]}>Page Title</h1></header>
<main className={[LAYOUT_STYLES]}><ComponentA /></main>
</div>
)
}Redesigning Pages
- Read current page first
- Identify changes vs. staying same
- Preserve data fetching and state
- Update only UI layer
- Ask before removing functionality
Quality Checklist
Before providing code, verify:
- Used metadata → context → screenshot → variables order
- Checked for existing components first
- Used composition over creation
- Mapped Figma variants to code props
- Used project's design system tokens/variables
- No
anytypes, proper TypeScript - Included accessibility attributes
- Responsive design following project conventions
- Theme/dark mode support if applicable
- Correct file naming and location
- Added component displayName
- JSDoc comments for complex logic
- All code in frontend directory only
- No backend changes without permission
- Used mock data if backend needed
Examples
For detailed workflow examples, see the reference file: examples.md
Examples include:
- Button component reuse
- Card composition
- Page with backend requirements
- Creating new component with variants
- Full page layout implementation
- Common patterns (composition, extending, mock data)
Error Handling
When Figma data unclear: Ask for clarification, use screenshot as fallback, document assumptions
When no component matches: Document why existing don't work, ask user: extend or create new?
When backend requirements unclear: Document API shape in JSDoc, use TypeScript interfaces, provide mock data
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.

