Implement Design
Overview
This 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.
Prerequisites
- - Figma MCP server must be connected and accessible
- Before proceeding, verify the Figma MCP server is connected by checking if Figma MCP tools (e.g.,
get_design_context) are available.
- If the tools are not available, the Figma MCP server may not be enabled. Guide the user to enable the Figma MCP server that is included with the plugin. They may need to restart their MCP client afterward.
- - User must provide a Figma URL in the format: INLINECODE1
-
:fileKey is the file key
-
1-2 is the node ID (the specific component or frame to implement)
- - Project should have an established design system or component library (preferred)
Required Workflow
Follow these steps in order. Do not skip steps.
Step 1: Get Node ID
Option A: Parse from Figma URL
When the user provides a Figma URL, extract the file key and node ID to pass as arguments to MCP tools.
URL format: INLINECODE4
Extract:
- - File key:
:fileKey (the segment after /design/) - Node ID:
1-2 (the value of the node-id query parameter)
Example:
- - URL: INLINECODE9
- File key: INLINECODE10
- Node ID: INLINECODE11
Step 2: Fetch Design Context
Run get_design_context with the extracted file key and node ID.
CODEBLOCK0
This provides the structured data including:
- - Layout properties (Auto Layout, constraints, sizing)
- Typography specifications
- Color values and design tokens
- Component structure and variants
- Spacing and padding values
If the response is too large or truncated:
- 1. Run
get_metadata(fileKey=":fileKey", nodeId="1-2") to get the high-level node map - Identify the specific child nodes needed from the metadata
- Fetch individual child nodes with INLINECODE14
Step 3: Capture Visual Reference
Run get_screenshot with the same file key and node ID for a visual reference.
CODEBLOCK1
This screenshot serves as the source of truth for visual validation. Keep it accessible throughout implementation.
Step 4: Download Required Assets
Download any assets (images, icons, SVGs) returned by the Figma MCP server.
IMPORTANT: Follow these asset rules:
- - If the Figma MCP server returns a
localhost source for an image or SVG, use that source directly - DO NOT import or add new icon packages - all assets should come from the Figma payload
- DO NOT use or create placeholders if a
localhost source is provided - Assets are served through the Figma MCP server's built-in assets endpoint
Step 5: Translate to Project Conventions
Translate the Figma output into this project's framework, styles, and conventions.
Key principles:
- - Treat the Figma MCP output (typically React + Tailwind) as a representation of design and behavior, not as final code style
- Replace Tailwind utility classes with the project's preferred utilities or design system tokens
- Reuse existing components (buttons, inputs, typography, icon wrappers) instead of duplicating functionality
- Use the project's color system, typography scale, and spacing tokens consistently
- Respect existing routing, state management, and data-fetch patterns
Step 6: Achieve 1:1 Visual Parity
Strive for pixel-perfect visual parity with the Figma design.
Guidelines:
- - Prioritize Figma fidelity to match designs exactly
- Avoid hardcoded values - use design tokens from Figma where available
- When conflicts arise between design system tokens and Figma specs, prefer design system tokens but adjust spacing or sizes minimally to match visuals
- Follow WCAG requirements for accessibility
- Add component documentation as needed
Step 7: Validate Against Figma
Before marking complete, validate the final UI against the Figma screenshot.
Validation checklist:
- - [ ] Layout matches (spacing, alignment, sizing)
- [ ] Typography matches (font, size, weight, line height)
- [ ] Colors match exactly
- [ ] Interactive states work as designed (hover, active, disabled)
- [ ] Responsive behavior follows Figma constraints
- [ ] Assets render correctly
- [ ] Accessibility standards met
Implementation Rules
Component Organization
- - Place UI components in the project's designated design system directory
- Follow the project's component naming conventions
- Avoid inline styles unless truly necessary for dynamic values
Design System Integration
- - ALWAYS use components from the project's design system when possible
- Map Figma design tokens to project design tokens
- When a matching component exists, extend it rather than creating a new one
- Document any new components added to the design system
Code Quality
- - Avoid hardcoded values - extract to constants or design tokens
- Keep components composable and reusable
- Add TypeScript types for component props
- Include JSDoc comments for exported components
Examples
Example 1: Implementing a Button Component
User says: "Implement this Figma button component: https://figma.com/design/kL9xQn2VwM8pYrTb4ZcHjF/DesignSystem?node-id=42-15"
Actions:
- 1. Parse URL to extract fileKey=
kL9xQn2VwM8pYrTb4ZcHjF and nodeId= INLINECODE19 - Run INLINECODE20
- Run
get_screenshot(fileKey="kL9xQn2VwM8pYrTb4ZcHjF", nodeId="42-15") for visual reference - Download any button icons from the assets endpoint
- Check if project has existing button component
- If yes, extend it with new variant; if no, create new component using project conventions
- Map Figma colors to project design tokens (e.g.,
primary-500, primary-hover) - Validate against screenshot for padding, border radius, typography
Result: Button component matching Figma design, integrated with project design system.
Example 2: Building a Dashboard Layout
User says: "Build this dashboard: https://figma.com/design/pR8mNv5KqXzGwY2JtCfL4D/Dashboard?node-id=10-5"
Actions:
- 1. Parse URL to extract fileKey=
pR8mNv5KqXzGwY2JtCfL4D and nodeId= INLINECODE25 - Run
get_metadata(fileKey="pR8mNv5KqXzGwY2JtCfL4D", nodeId="10-5") to understand the page structure - Identify main sections from metadata (header, sidebar, content area, cards) and their child node IDs
- Run
get_design_context(fileKey="pR8mNv5KqXzGwY2JtCfL4D", nodeId=":childNodeId") for each major section - Run
get_screenshot(fileKey="pR8mNv5KqXzGwY2JtCfL4D", nodeId="10-5") for the full page - Download all assets (logos, icons, charts)
- Build layout using project's layout primitives
- Implement each section using existing components where possible
- Validate responsive behavior against Figma constraints
Result: Complete dashboard matching Figma design with responsive layout.
Best Practices
Always Start with Context
Never implement based on assumptions. Always fetch get_design_context and get_screenshot first.
Incremental Validation
Validate frequently during implementation, not just at the end. This catches issues early.
Document Deviations
If you must deviate from the Figma design (e.g., for accessibility or technical constraints), document why in code comments.
Reuse Over Recreation
Always check for existing components before creating new ones. Consistency across the codebase is more important than exact Figma replication.
Design System First
When in doubt, prefer the project's design system patterns over literal Figma translation.
Common Issues and Solutions
Issue: Figma output is truncated
Cause: The design is too complex or has too many nested layers to return in a single response.
Solution: Use get_metadata to get the node structure, then fetch specific nodes individually with get_design_context.
Issue: Design doesn't match after implementation
Cause: Visual discrepancies between the implemented code and the original Figma design.
Solution: Compare side-by-side with the screenshot from Step 3. Check spacing, colors, and typography values in the design context data.
Issue: Assets not loading
Cause: The Figma MCP server's assets endpoint is not accessible or the URLs are being modified.
Solution: Verify the Figma MCP server's assets endpoint is accessible. The server serves assets at localhost URLs. Use these directly without modification.
Issue: Design token values differ from Figma
Cause: The project's design system tokens have different values than those specified in the Figma design.
Solution: When project tokens differ from Figma values, prefer project tokens for consistency but adjust spacing/sizing to maintain visual fidelity.
Understanding Design Implementation
The Figma implementation workflow establishes a reliable process for translating designs to code:
For designers: Confidence that implementations will match their designs with pixel-perfect accuracy.
For developers: A structured approach that eliminates guesswork and reduces back-and-forth revisions.
For teams: Consistent, high-quality implementations that maintain design system integrity.
By following this workflow, you ensure that every Figma design is implemented with the same level of care and attention to detail.
Additional Resources
实现设计
概述
本技能提供了一套结构化工作流程,用于将 Figma 设计以像素级精度转化为可投入生产的代码。它确保与 Figma MCP 服务器的一致集成、设计令牌的正确使用,以及与设计保持 1:1 的视觉一致性。
前置条件
- 在继续之前,通过检查 Figma MCP 工具(例如 get
designcontext)是否可用,来验证 Figma MCP 服务器是否已连接。
- 如果工具不可用,则 Figma MCP 服务器可能未启用。引导用户启用插件附带的 Figma MCP 服务器。之后他们可能需要重启 MCP 客户端。
- - 用户必须提供格式为 https://figma.com/design/:fileKey/:fileName?node-id=1-2 的 Figma URL
- :fileKey 是文件密钥
- 1-2 是节点 ID(要实现的特定组件或画框)
必要工作流程
请按顺序执行以下步骤。不要跳过任何步骤。
步骤 1:获取节点 ID
选项 A:从 Figma URL 解析
当用户提供 Figma URL 时,提取文件密钥和节点 ID,以作为参数传递给 MCP 工具。
URL 格式: https://figma.com/design/:fileKey/:fileName?node-id=1-2
提取:
- - 文件密钥: :fileKey(/design/ 之后的部分)
- 节点 ID: 1-2(node-id 查询参数的值)
示例:
- - URL:https://figma.com/design/kL9xQn2VwM8pYrTb4ZcHjF/DesignSystem?node-id=42-15
- 文件密钥:kL9xQn2VwM8pYrTb4ZcHjF
- 节点 ID:42-15
步骤 2:获取设计上下文
使用提取的文件密钥和节点 ID 运行 getdesigncontext。
getdesigncontext(fileKey=:fileKey, nodeId=1-2)
这将提供结构化数据,包括:
- - 布局属性(自动布局、约束、尺寸)
- 排版规范
- 颜色值和设计令牌
- 组件结构和变体
- 间距和内边距值
如果响应过大或被截断:
- 1. 运行 getmetadata(fileKey=:fileKey, nodeId=1-2) 以获取高级节点映射
- 从元数据中识别所需的特定子节点
- 使用 getdesign_context(fileKey=:fileKey, nodeId=:childNodeId) 获取各个子节点
步骤 3:捕获视觉参考
使用相同的文件密钥和节点 ID 运行 get_screenshot 以获取视觉参考。
get_screenshot(fileKey=:fileKey, nodeId=1-2)
此截图作为视觉验证的基准。在实现过程中保持其可访问性。
步骤 4:下载所需资源
下载 Figma MCP 服务器返回的任何资源(图片、图标、SVG)。
重要提示: 遵循以下资源规则:
- - 如果 Figma MCP 服务器为图片或 SVG 返回 localhost 源,请直接使用该源
- 不要导入或添加新的图标包——所有资源应来自 Figma 负载
- 如果提供了 localhost 源,不要使用或创建占位符
- 资源通过 Figma MCP 服务器的内置资源端点提供
步骤 5:转换为项目约定
将 Figma 输出转换为此项目的框架、样式和约定。
关键原则:
- - 将 Figma MCP 输出(通常是 React + Tailwind)视为设计和行为的表示,而非最终代码样式
- 用项目首选的实用工具或设计系统令牌替换 Tailwind 实用类
- 重用现有组件(按钮、输入框、排版、图标包装器),而不是重复功能
- 一致地使用项目的颜色系统、排版比例和间距令牌
- 尊重现有的路由、状态管理和数据获取模式
步骤 6:实现 1:1 视觉一致性
力求与 Figma 设计实现像素级视觉一致性。
指南:
- - 优先考虑 Figma 保真度,以精确匹配设计
- 避免硬编码值——尽可能使用 Figma 的设计令牌
- 当设计系统令牌与 Figma 规范冲突时,优先使用设计系统令牌,但最小限度调整间距或尺寸以匹配视觉效果
- 遵循 WCAG 无障碍要求
- 根据需要添加组件文档
步骤 7:对照 Figma 验证
在标记完成之前,对照 Figma 截图验证最终 UI。
验证清单:
- - [ ] 布局匹配(间距、对齐、尺寸)
- [ ] 排版匹配(字体、大小、字重、行高)
- [ ] 颜色完全匹配
- [ ] 交互状态按设计工作(悬停、激活、禁用)
- [ ] 响应式行为遵循 Figma 约束
- [ ] 资源正确渲染
- [ ] 无障碍标准已满足
实现规则
组件组织
- - 将 UI 组件放置在项目指定的设计系统目录中
- 遵循项目的组件命名约定
- 除非动态值确实需要,否则避免内联样式
设计系统集成
- - 尽可能始终使用项目设计系统中的组件
- 将 Figma 设计令牌映射到项目设计令牌
- 当存在匹配的组件时,扩展它而不是创建新的
- 记录添加到设计系统的任何新组件
代码质量
- - 避免硬编码值——提取到常量或设计令牌
- 保持组件的可组合性和可重用性
- 为组件 props 添加 TypeScript 类型
- 为导出的组件包含 JSDoc 注释
示例
示例 1:实现按钮组件
用户说:实现这个 Figma 按钮组件:https://figma.com/design/kL9xQn2VwM8pYrTb4ZcHjF/DesignSystem?node-id=42-15
操作:
- 1. 解析 URL 以提取 fileKey=kL9xQn2VwM8pYrTb4ZcHjF 和 nodeId=42-15
- 运行 getdesigncontext(fileKey=kL9xQn2VwM8pYrTb4ZcHjF, nodeId=42-15)
- 运行 get_screenshot(fileKey=kL9xQn2VwM8pYrTb4ZcHjF, nodeId=42-15) 获取视觉参考
- 从资源端点下载任何按钮图标
- 检查项目是否已有按钮组件
- 如果有,用新变体扩展它;如果没有,使用项目约定创建新组件
- 将 Figma 颜色映射到项目设计令牌(例如 primary-500、primary-hover)
- 对照截图验证内边距、边框半径、排版
结果: 匹配 Figma 设计的按钮组件,并与项目设计系统集成。
示例 2:构建仪表板布局
用户说:构建这个仪表板:https://figma.com/design/pR8mNv5KqXzGwY2JtCfL4D/Dashboard?node-id=10-5
操作:
- 1. 解析 URL 以提取 fileKey=pR8mNv5KqXzGwY2JtCfL4D 和 nodeId=10-5
- 运行 getmetadata(fileKey=pR8mNv5KqXzGwY2JtCfL4D, nodeId=10-5) 以了解页面结构
- 从元数据中识别主要部分(页眉、侧边栏、内容区域、卡片)及其子节点 ID
- 对每个主要部分运行 getdesigncontext(fileKey=pR8mNv5KqXzGwY2JtCfL4D, nodeId=:childNodeId)
- 运行 getscreenshot(fileKey=pR8mNv5KqXzGwY2JtCfL4D, nodeId=10-5) 获取完整页面
- 下载所有资源(标志、图标、图表)
- 使用项目的布局原语构建布局
- 尽可能使用现有组件实现每个部分
- 对照 Figma 约束验证响应式行为
结果: 匹配 Figma 设计的完整仪表板,具有响应式布局。
最佳实践
始终从上下文开始
永远不要基于假设实现。始终先获取 getdesigncontext 和 get