--- name: figma-design-analyzer description: Extract and analyze Figma designs to create structured design specifications. Use this skill when you need to analyze Figma nodes, extract design properties (layout, spacing, typography), classify components using Atomic Design principles, and generate design specification documents that can be used for implementation. --- # Figma Design Analyzer ## Overview Systematically analyze Figma designs and extract structured design specifications. This skill focuses on understanding design intent, extracting accurate properties, and creating comprehensive design specification documents that serve as blueprints for implementation. **Use this skill when:** - Analyzing Figma designs to understand structure and properties - Extracting design tokens and component specifications - Classifying components according to Atomic Design principles - Creating design specification documents for developers - Comparing existing implementations with Figma designs ## Core Workflow ### Step 1: Extract Figma Design Information When given a Figma URL or node ID, use Figma MCP tools to extract design data: 1. **Parse the Figma URL to extract node ID:** ``` URL: https://figma.com/design/fileKey/fileName?node-id=1-2 Node ID: 1:2 (replace - with :) ``` 2. **Extract node design context:** ``` mcp__figma-dev__get_design_context( nodeId: "1:2", dirForAssetWrites: "/absolute/path/to/project/public/assets", clientLanguages: "typescript", clientFrameworks: "react,nextjs" ) ``` This returns the design code, including HTML structure and CSS properties. 3. **Get component metadata for structure overview:** ``` mcp__figma-dev__get_metadata( nodeId: "1:2", clientLanguages: "typescript", clientFrameworks: "react,nextjs" ) ``` Use this to understand the component hierarchy before detailed analysis. 4. **Check for Figma variables (design tokens):** ``` mcp__figma-dev__get_variable_defs( nodeId: "1:2", clientLanguages: "typescript", clientFrameworks: "react,nextjs" ) ``` Extract design system tokens for colors, typography, spacing, etc. 5. **Verify Code Connect mappings:** ``` mcp__figma-dev__get_code_connect_map( nodeId: "1:2", clientLanguages: "typescript", clientFrameworks: "react,nextjs" ) ``` Check if the component is already mapped to existing code. ### Step 2: Handle Component Instances and Variants **Important:** When the node is a component instance: 1. **Identify if it's an instance:** - Check metadata for "component instance" type - Note the main component ID 2. **Get the main component:** - Use `get_design_context` on the main component node - Extract the base structure and properties 3. **Extract instance-specific properties:** - Get the instance's specific size, device, and variant settings - Note any overrides (text, images, colors, etc.) 4. **Handle variants:** - If the main component uses variants, identify the variant mode - Extract the correct variant values for the instance - Document variant properties for props mapping ### Step 3: Classify the Component Use Atomic Design principles to classify the component: 1. **Read the classification guide:** ``` Read references/atomic-design-classification.md ``` 2. **Apply the decision tree:** - **Atom**: Indivisible, single purpose (button, input, icon, text label) - **Molecule**: 2-5 atoms, simple combination (search bar, form field) - **Organism**: Complex, multiple molecules/atoms (header, card, form) 3. **Determine the component category:** - Document: `atomicCategory: Atom | Molecule | Organism` ### Step 4: Analyze Layout and Spacing Extract accurate layout information: 1. **Read layout analysis guide:** ``` Read references/layout-analysis-guide.md ``` 2. **Determine layout method:** - **Auto Layout** → Flexbox - Check: direction (row/column), justify-content, align-items - **Grid structure** → CSS Grid - Check: grid-template-columns, grid-template-rows, gap - **Overlapping elements** → Absolute positioning - Check: position, top, left, z-index 3. **Extract spacing values:** ``` Read references/spacing-extraction-guide.md ``` - **Padding**: Internal spacing (px, py, pt, pr, pb, pl) - **Gap**: Spacing between flex/grid items - **Margin**: External spacing (rarely used, prefer gap) 4. **Map to Tailwind classes:** - Use standard Tailwind scale when possible (p-4, gap-6, etc.) - Use arbitrary values `[value]` for custom sizes (p-[18px]) 5. **Document in specification:** ```markdown ## Layout - Method: Flexbox - Direction: row - Justify: center - Align: center ## Spacing - Padding: px-6 py-3 - Gap: gap-2 - Border Radius: rounded-lg ``` ### Step 5: Extract Typography Extract accurate text styling: 1. **Read typography guide:** ``` Read references/typography-extraction-guide.md ``` 2. **Extract font properties:** - Font family (font-sans, font-serif, custom) - Font size (text-sm, text-base, text-lg, etc.) - Font weight (font-normal, font-semibold, font-bold) - Line height (leading-tight, leading-normal, etc.) - Letter spacing (tracking-tight, tracking-wide, etc.) - Text color (text-gray-900, text-white, etc.) - Text alignment (text-left, text-center, text-right) - Text decoration (underline, line-through) - Text transform (uppercase, lowercase, capitalize) 3. **Map to Tailwind classes:** - Use standard Tailwind typography classes - Check for design tokens in Figma variables - Use arbitrary values for custom sizes 4. **Document in specification:** ```markdown ## Typography - Font: text-base font-semibold - Color: text-white - Line Height: leading-normal - Alignment: text-center ``` ### Step 6: Choose Semantic HTML Select appropriate HTML elements: 1. **Read semantic HTML guide:** ``` Read references/semantic-html-guide.md ``` 2. **Apply semantic rules:** - **Sections**: `
`, `