Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Translate Figma designs into production-ready code with pixel-perfect fidelity using the Figma MCP server.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: figma-implement-design3description: Translates Figma designs into production-ready application code with 1:1 visual fidelity. Use when implementing UI code from Figma files, when user mentions "implement design", "generate code", "implement component", provides Figma URLs, or asks to build components matching Figma specs. For Figma canvas writes via `use_figma`, use `figma-use`.4disable-model-invocation: false5---67# Implement Design89## Overview1011This skill provides a structured workflow for translating Figma designs into production-ready code with pixel-perfect accuracy. It ensures consistent integration with the Figma MCP server, proper use of design tokens, and 1:1 visual parity with designs.1213## Skill Boundaries1415- Use this skill when the deliverable is code in the user's repository.16- If the user asks to create/edit/delete nodes inside Figma itself, switch to [figma-use](../figma-use/SKILL.md).17- If the user asks to build or update a full-page screen in Figma from code or a description, switch to [figma-generate-design](../figma-generate-design/SKILL.md).18- If the user asks only for Code Connect mappings, switch to [figma-code-connect](../figma-code-connect/SKILL.md).19- If the user asks to author reusable agent rules (`CLAUDE.md`/`AGENTS.md`), switch to [figma-create-design-system-rules](../figma-create-design-system-rules/SKILL.md).2021## Prerequisites2223- Figma MCP server must be connected and accessible24- User must provide a Figma URL in the format: `https://figma.com/design/:fileKey/:fileName?node-id=1-2`25- `:fileKey` is the file key26- `1-2` is the node ID (the specific component or frame to implement)27- **OR** when using `figma-desktop` MCP: User can select a node directly in the Figma desktop app (no URL required)28- Project should have an established design system or component library (preferred)2930## Required Workflow3132**Follow these steps in order. Do not skip steps.**3334### Step 1: Get Node ID3536#### Option A: Parse from Figma URL3738When the user provides a Figma URL, extract the file key and node ID to pass as arguments to MCP tools.3940**URL format:** `https://figma.com/design/:fileKey/:fileName?node-id=1-2`4142**Extract:**4344- **File key:** `:fileKey` (the segment after `/design/`)45- **Node ID:** `1-2` (the value of the `node-id` query parameter)4647**Note:** When using the local desktop MCP (`figma-desktop`), `fileKey` is not passed as a parameter to tool calls. The server automatically uses the currently open file, so only `nodeId` is needed.4849**Example:**5051- URL: `https://figma.com/design/kL9xQn2VwM8pYrTb4ZcHjF/DesignSystem?node-id=42-15`52- File key: `kL9xQn2VwM8pYrTb4ZcHjF`53- Node ID: `42-15`5455#### Option B: Use Current Selection from Figma Desktop App (figma-desktop MCP only)5657When using the `figma-desktop` MCP and the user has NOT provided a URL, the tools automatically use the currently selected node from the open Figma file in the desktop app.5859**Note:** Selection-based prompting only works with the `figma-desktop` MCP server. The remote server requires a link to a frame or layer to extract context. The user must have the Figma desktop app open with a node selected.6061### Step 2: Fetch Design Context6263Run `get_design_context` with the extracted file key and node ID.6465```66get_design_context(fileKey=":fileKey", nodeId="1-2")67```6869This provides the structured data including:7071- Layout properties (Auto Layout, constraints, sizing)72- Typography specifications73- Color values and design tokens74- Component structure and variants75- Spacing and padding values7677**If the response is too large or truncated:**78791. Run `get_metadata(fileKey=":fileKey", nodeId="1-2")` to get the high-level node map802. Identify the specific child nodes needed from the metadata813. Fetch individual child nodes with `get_design_context(fileKey=":fileKey", nodeId=":childNodeId")`8283### Step 3: Capture Visual Reference8485Run `get_screenshot` with the same file key and node ID for a visual reference.8687```88get_screenshot(fileKey=":fileKey", nodeId="1-2")89```9091This screenshot serves as the source of truth for visual validation. Keep it accessible throughout implementation.9293### Step 4: Download Required Assets9495Download any assets (images, icons, SVGs) returned by the Figma MCP server.9697**IMPORTANT:** Follow these asset rules:9899- If the Figma MCP server returns a `localhost` source for an image or SVG, use that source directly100- DO NOT import or add new icon packages - all assets should come from the Figma payload101- DO NOT use or create placeholders if a `localhost` source is provided102- Assets are served through the Figma MCP server's built-in assets endpoint103104### Step 5: Translate to Project Conventions105106Translate the Figma output into this project's framework, styles, and conventions.107108**Key principles:**109110- Treat the Figma MCP output (typically React + Tailwind) as a representation of design and behavior, not as final code style111- Replace Tailwind utility classes with the project's preferred utilities or design system tokens112- Reuse existing components (buttons, inputs, typography, icon wrappers) instead of duplicating functionality113- Use the project's color system, typography scale, and spacing tokens consistently114- Respect existing routing, state management, and data-fetch patterns115116### Step 6: Achieve 1:1 Visual Parity117118Strive for pixel-perfect visual parity with the Figma design.119120**Guidelines:**121122- Prioritize Figma fidelity to match designs exactly123- Avoid hardcoded values - use design tokens from Figma where available124- When conflicts arise between design system tokens and Figma specs, prefer design system tokens but adjust spacing or sizes minimally to match visuals125- Follow WCAG requirements for accessibility126- Add component documentation as needed127128### Step 7: Validate Against Figma129130Before marking complete, validate the final UI against the Figma screenshot.131132**Validation checklist:**133134- [ ] Layout matches (spacing, alignment, sizing)135- [ ] Typography matches (font, size, weight, line height)136- [ ] Colors match exactly137- [ ] Interactive states work as designed (hover, active, disabled)138- [ ] Responsive behavior follows Figma constraints139- [ ] Assets render correctly140- [ ] Accessibility standards met141142## Implementation Rules143144### Component Organization145146- Place UI components in the project's designated design system directory147- Follow the project's component naming conventions148- Avoid inline styles unless truly necessary for dynamic values149150### Design System Integration151152- ALWAYS use components from the project's design system when possible153- Map Figma design tokens to project design tokens154- When a matching component exists, extend it rather than creating a new one155- Document any new components added to the design system156157### Code Quality158159- Avoid hardcoded values - extract to constants or design tokens160- Keep components composable and reusable161- Add TypeScript types for component props162- Include JSDoc comments for exported components163164## Examples165166### Example 1: Implementing a Button Component167168User says: "Implement this Figma button component: https://figma.com/design/kL9xQn2VwM8pYrTb4ZcHjF/DesignSystem?node-id=42-15"169170**Actions:**1711721. Parse URL to extract fileKey=`kL9xQn2VwM8pYrTb4ZcHjF` and nodeId=`42-15`1732. Run `get_design_context(fileKey="kL9xQn2VwM8pYrTb4ZcHjF", nodeId="42-15")`1743. Run `get_screenshot(fileKey="kL9xQn2VwM8pYrTb4ZcHjF", nodeId="42-15")` for visual reference1754. Download any button icons from the assets endpoint1765. Check if project has existing button component1776. If yes, extend it with new variant; if no, create new component using project conventions1787. Map Figma colors to project design tokens (e.g., `primary-500`, `primary-hover`)1798. Validate against screenshot for padding, border radius, typography180181**Result:** Button component matching Figma design, integrated with project design system.182183### Example 2: Building a Dashboard Layout184185User says: "Build this dashboard: https://figma.com/design/pR8mNv5KqXzGwY2JtCfL4D/Dashboard?node-id=10-5"186187**Actions:**1881891. Parse URL to extract fileKey=`pR8mNv5KqXzGwY2JtCfL4D` and nodeId=`10-5`1902. Run `get_metadata(fileKey="pR8mNv5KqXzGwY2JtCfL4D", nodeId="10-5")` to understand the page structure1913. Identify main sections from metadata (header, sidebar, content area, cards) and their child node IDs1924. Run `get_design_context(fileKey="pR8mNv5KqXzGwY2JtCfL4D", nodeId=":childNodeId")` for each major section1935. Run `get_screenshot(fileKey="pR8mNv5KqXzGwY2JtCfL4D", nodeId="10-5")` for the full page1946. Download all assets (logos, icons, charts)1957. Build layout using project's layout primitives1968. Implement each section using existing components where possible1979. Validate responsive behavior against Figma constraints198199**Result:** Complete dashboard matching Figma design with responsive layout.200201## Best Practices202203### Always Start with Context204205Never implement based on assumptions. Always fetch `get_design_context` and `get_screenshot` first.206207### Incremental Validation208209Validate frequently during implementation, not just at the end. This catches issues early.210211### Document Deviations212213If you must deviate from the Figma design (e.g., for accessibility or technical constraints), document why in code comments.214215### Reuse Over Recreation216217Always check for existing components before creating new ones. Consistency across the codebase is more important than exact Figma replication.218219### Design System First220221When in doubt, prefer the project's design system patterns over literal Figma translation.222223## Common Issues and Solutions224225### Issue: Figma output is truncated226227**Cause:** The design is too complex or has too many nested layers to return in a single response.228**Solution:** Use `get_metadata` to get the node structure, then fetch specific nodes individually with `get_design_context`.229230### Issue: Design doesn't match after implementation231232**Cause:** Visual discrepancies between the implemented code and the original Figma design.233**Solution:** Compare side-by-side with the screenshot from Step 3. Check spacing, colors, and typography values in the design context data.234235### Issue: Assets not loading236237**Cause:** The Figma MCP server's assets endpoint is not accessible or the URLs are being modified.238**Solution:** Verify the Figma MCP server's assets endpoint is accessible. The server serves assets at `localhost` URLs. Use these directly without modification.239240### Issue: Design token values differ from Figma241242**Cause:** The project's design system tokens have different values than those specified in the Figma design.243**Solution:** When project tokens differ from Figma values, prefer project tokens for consistency but adjust spacing/sizing to maintain visual fidelity.244245## Understanding Design Implementation246247The Figma implementation workflow establishes a reliable process for translating designs to code:248249**For designers:** Confidence that implementations will match their designs with pixel-perfect accuracy.250**For developers:** A structured approach that eliminates guesswork and reduces back-and-forth revisions.251**For teams:** Consistent, high-quality implementations that maintain design system integrity.252253By following this workflow, you ensure that every Figma design is implemented with the same level of care and attention to detail.254255## Additional Resources256257- [Figma MCP Server Documentation](https://developers.figma.com/docs/figma-mcp-server/)258- [Figma MCP Server Tools and Prompts](https://developers.figma.com/docs/figma-mcp-server/tools-and-prompts/)259- [Figma Variables and Design Tokens](https://help.figma.com/hc/en-us/articles/15339657135383-Guide-to-variables-in-Figma)260