figma-design
Access Figma designs, extract design systems, and retrieve component specifications. Use when implementing UI from Figma mockups, extracting design tokens, or analyzing design files.
SKILL.md
Full skill instructions
Figma Design
Access Figma designs, design systems, and components for frontend implementation. Extract design tokens, component specifications, and visual assets to ensure pixel-perfect implementation.
Quick Start
- Identify design source - Get Figma file URL, frame names, or component IDs from designer
- Extract design tokens - Use
get_design_systemorexport_tokensfor colors, typography, spacing - Get component details - Use
get_node_info,get_componentfor structure, variants, states - Download assets - Use
download_design_assetsorexport_node_as_imagefor images, icons - Implement with fidelity - Apply
frontend-philosophyto extracted tokens, maintain visual quality
Workflow
0) If any MCP call fails because Figma MCP is not connected, pause and set it up:
- Add the Figma MCP:
codex mcp add figma --url https://mcp.figma.com/mcp
- Enable remote MCP client:
- Set
[features].rmcp_client = trueinconfig.tomlor runcodex --enable rmcp_client
- Set
- Log in with OAuth (or configure API token):
codex mcp login figma- OR set
FIGMA_ACCESS_TOKENenvironment variable
After successful login, the user will have to restart codex. You should finish your answer and tell them so when they try again they can continue with Step 1.
1) Understand the Design Context
Before extracting any data, clarify:
- What Figma file or frame contains the design?
- Is there a design system or shared library?
- What component(s) need implementation?
- Are there specific variants or states (hover, active, disabled)?
- What framework is being used (React, Vue, HTML/CSS)?
Tools to use:
get_document_info- Get file structure overviewget_file_nodes- List all nodes in fileget_tree- Export file structure as ASCII tree
2) Extract Design System Tokens
Design tokens are the foundation of consistent UI implementation.
Colors:
get_styles- List all color stylesexport_tokens({ format: "css" })- Export as CSS variablesexport_tokens({ format: "tailwind" })- Export as Tailwind configexport_tokens({ format: "json" })- Export as JSON
Typography:
get_styles- List all text styles- Extract font families, sizes, weights, line heights
- Map to
frontend-philosophydistinctive fonts (avoid Inter, Roboto)
Spacing & Layout:
get_node_infowith@layoutprojection - Get padding, gaps, auto-layout- Extract spacing scale (4px, 8px, 16px, 24px, etc.)
- Identify layout patterns (flexbox, grid)
Effects:
get_styles- List effect styles (shadows, blurs)get_css- Extract exact CSS for shadows, borders, opacity
3) Get Component Specifications
For each component to implement:
Structure:
get_node_info({ node_id, select: ["@structure", "@bounds"] })- Get hierarchy and dimensionsget_component- Get component details and variantslist_local_components- Audit all project componentslist_remote_components- Access team library components
Styling:
get_css({ node_id })- Extract CSS properties (fills, strokes, effects, corner radius)get_node_info({ node_id, select: ["@css"] })- Get detailed styling data- Note: Apply
frontend-philosophy- enhance generic styles with intentional color and atmosphere
Variants & States:
get_componentreturns all variants (Primary/Secondary, Small/Medium/Large)get_node_infofor each variant to understand differences- Map to component props (e.g.,
variant="primary",size="large")
Accessibility:
- Check for accessibility labels in Figma annotations
- Extract semantic roles (button, link, heading)
- Verify color contrast meets WCAG standards
4) Download Visual Assets
Images & Icons:
export_node_as_image({ node_id, format: "svg" })- Export icons as SVGexport_node_as_image({ node_id, format: "png", scale: 2 })- Export images at 2xdownload_design_assets({ figma_url, local_path })- Batch download all assets
Reference Images:
download_design_assetsincludesreference.pngfor visual context- Use reference image with
zai-vision_*tool for visual comparison during implementation
5) Implement with Design Fidelity
Apply extracted tokens while maintaining frontend-philosophy:
Typography:
- If Figma uses generic fonts (Inter, Roboto), suggest distinctive alternatives
- Maintain hierarchy and scale from design tokens
- Apply proper font weights and line heights
Color:
- Extract color palette from Figma
- If palette is generic gray/blue, propose bold intentional alternatives
- Maintain contrast ratios for accessibility
Spacing:
- Use exact padding, margins, gaps from auto-layout properties
- Apply brave spatial composition (generous negative space OR controlled density)
Effects:
- Extract shadows, blurs, gradients from Figma
- Layer visual richness (gradient meshes, noise textures) per
frontend-philosophy
Motion:
- Figma prototypes may specify transitions
- Add purposeful motion that enhances UX (not decorative)
6) Verify Implementation
Visual Comparison:
- Export Figma frame as PNG:
export_node_as_image - Screenshot implemented component
- Use
zai-vision_*to compare for pixel-perfect accuracy
Responsive Behavior:
- Check Figma constraints (fixed, stretch, scale)
- Implement responsive breakpoints
- Test on multiple viewport sizes
Accessibility:
- Verify color contrast with Figma accessibility plugin data
- Add ARIA labels and semantic HTML
- Test keyboard navigation
Available Tools
Document Navigation
get_document_info- Get file overview and structureget_file_nodes- List all nodes in fileget_tree- Export file structure as ASCII tree with node IDsget_selection- Get currently selected elements in Figmaset_current_page- Switch to specific page
Design System Extraction
get_styles- List all styles (color, text, effect, grid)export_tokens- Export design tokens to CSS/JSON/Tailwindget_css- Extract CSS properties from nodesget_local_components- Audit project componentsget_remote_components- Access team library components
Component Analysis
get_node_info- Inspect specific node properties (use projections:@structure,@css,@layout,@typography,@tokens)get_nodes_info- Batch inspect multiple nodesget_component- Get component details and variantscreate_component_instance- Use components in designs
Asset Export
export_node_as_image- Export as PNG/SVG/JPGdownload_design_assets- Batch download assets with reference imagescan_text_nodes- Find all text layers for content audit
Query API (Advanced)
query- Use Figma Query DSL for token-efficient searches- Projections:
@structure,@bounds,@css,@layout,@typography,@tokens,@images,@all - Filters:
$match,$eq,$in,$gt,$lt - Example:
{ "from": ["COMPONENT"], "where": { "name": { "$match": "Button*" } }, "select": ["@structure", "@css"] }
- Projections:
Practical Workflows
Design Handoff
Goal: Extract complete design specifications for implementation
get_document_info- Understand file structureget_tree- Get node IDs for target framesexport_tokens({ format: "tailwind" })- Export design systemget_node_info({ node_id, select: ["@all"] })- Get component detailsdownload_design_assets- Download assets + reference.png- Implement component using extracted data
Design System Audit
Goal: Inventory design tokens and components for consistency
get_styles- List all color, text, effect styleslist_local_components- Get all components with usage countexport_tokens({ format: "json" })- Export tokens for analysis- Identify inconsistencies (duplicate colors, similar components)
- Recommend consolidation or cleanup
Component Library Migration
Goal: Convert Figma components to code components
list_local_components- Get component inventory- For each component:
get_component- Get variants and propertiesget_css- Extract stylingget_node_info({ select: ["@layout"] })- Get layout properties
- Generate component code (React, Vue, etc.)
- Create Storybook stories or documentation
Visual QA & Pixel Perfection
Goal: Ensure implementation matches design exactly
export_node_as_image({ node_id, format: "png", scale: 2 })- Export design- Screenshot implemented component
- Use
zai-vision_*for visual comparison - Identify discrepancies (spacing, colors, shadows)
- Fix implementation and re-verify
Design Token Synchronization
Goal: Keep code tokens in sync with Figma
export_tokens({ format: "css" })- Export current tokens- Compare with existing CSS variables or Tailwind config
- Identify changes (new colors, updated spacing)
- Update code design system
- Document changes and notify team
Tips for Maximum Productivity
- Use projections for efficient queries -
select: ["@structure", "@css"]fetches only needed data - Batch node inspections - Use
get_nodes_infofor multiple nodes instead of individual calls - Export tokens early - Get design system tokens before diving into components
- Download reference images - Visual context helps with implementation decisions
- Map Figma variants to props - Component variants become component props (e.g.,
variant,size,state) - Use Query DSL for large files - More token-efficient than fetching entire files
- Cache component IDs - Reuse node IDs across multiple queries
- Verify with visual comparison - Always compare exported design vs. implementation
Troubleshooting
- Authentication Errors: Re-run OAuth (
codex mcp login figma); verify workspace access; check API token permissions - File Not Found: Verify Figma URL is correct and accessible; check file hasn't been moved or deleted
- Node Not Found: Use
get_treeto find correct node IDs; verify node hasn't been deleted - Export Failures: Check node type supports export (frames, components); verify export settings; try different format (PNG vs SVG)
- Missing Fonts: Pre-load custom fonts with
load_font_asyncbefore setting font names - Component Import Timeout: Use
getNodeByIdAsyncfor local components; increase timeout for remote library components - Token Export Issues: Verify design uses variables/styles (not raw values); check file has defined color/text styles
- Rate Limits: Batch operations; use Query DSL for efficient data fetching; implement exponential backoff
Integration with Frontend Workflow
When working with the frontend agent:
- Load this skill first:
skill("figma-design")before implementation - Extract design tokens as foundation for styling
- Get component specs for structure and variants
- Apply frontend-philosophy to elevate generic Figma designs:
- Replace generic fonts with distinctive alternatives
- Enhance color palettes with bold, intentional choices
- Add atmosphere and depth (gradients, shadows, textures)
- Implement purposeful motion
- Verify visual fidelity with exported reference images
See reference/design-handoff-workflow.md for detailed step-by-step process.
References and Examples
reference/design-token-extraction.md- How to export and apply design tokensreference/component-implementation-guide.md- Step-by-step component conversionreference/figma-query-dsl.md- Query DSL syntax and examplesexamples/button-component-extraction.md- Complete button component workflowexamples/design-system-migration.md- Migrating Figma design system to code
