figma-implement-design by openai/skills
npx skills add https://github.com/openai/skills --skill figma-implement-design此技能提供了一个结构化的工作流,用于将 Figma 设计转化为生产就绪的代码,并实现像素级完美匹配。它确保与 Figma MCP 服务器的一致性集成、设计令牌的正确使用,以及与设计的 1:1 视觉一致性。
https://figma.com/design/:fileKey/:fileName?node-id=1-2 的 Figma URL
:fileKey 是文件密钥1-2 是节点 ID(要实现的特定组件或框架)figma-desktop MCP 时:用户可以直接在 Figma 桌面应用中选择一个节点(无需提供 URL)请按顺序执行以下步骤。不要跳过任何步骤。
如果任何 MCP 调用因 Figma MCP 未连接而失败,请暂停并设置它:
codex mcp add figma --url https://mcp.figma.com/mcp广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
config.toml 中设置 [features].rmcp_client = true 或者 运行 codex --enable rmcp_clientcodex mcp login figma成功登录后,用户需要重启 codex。你应该完成你的回答并告知他们,以便他们再次尝试时可以继续步骤 1。
当用户提供 Figma URL 时,提取文件密钥和节点 ID 作为参数传递给 MCP 工具。
URL 格式: https://figma.com/design/:fileKey/:fileName?node-id=1-2
提取:
:fileKey(/design/ 之后的片段)1-2(node-id 查询参数的值)注意: 使用本地桌面 MCP(figma-desktop)时,fileKey 不会作为参数传递给工具调用。服务器会自动使用当前打开的文件,因此只需要 nodeId。
示例:
https://figma.com/design/kL9xQn2VwM8pYrTb4ZcHjF/DesignSystem?node-id=42-15kL9xQn2VwM8pYrTb4ZcHjF42-15当使用 figma-desktop MCP 且用户未提供 URL 时,工具会自动使用桌面应用中打开的 Figma 文件里当前选中的节点。
注意: 基于选择的提示仅适用于 figma-desktop MCP 服务器。远程服务器需要一个指向框架或图层的链接来提取上下文。用户必须打开 Figma 桌面应用并选中一个节点。
使用提取的文件密钥和节点 ID 运行 get_design_context。
get_design_context(fileKey=":fileKey", nodeId="1-2")
这将提供结构化数据,包括:
如果响应过大或被截断:
get_metadata(fileKey=":fileKey", nodeId="1-2") 以获取高层级节点映射get_design_context(fileKey=":fileKey", nodeId=":childNodeId") 单独获取各个子节点使用相同的文件密钥和节点 ID 运行 get_screenshot 以获取视觉参考。
get_screenshot(fileKey=":fileKey", nodeId="1-2")
此截图将作为视觉验证的最终依据。在整个实现过程中保持其可访问性。
下载 Figma MCP 服务器返回的任何资源(图像、图标、SVG)。
重要: 请遵循以下资源规则:
localhost 源,请直接使用该源localhost 源,不要使用或创建占位符将 Figma 输出转换为项目的框架、样式和约定。
关键原则:
努力实现与 Figma 设计的像素级完美视觉一致性。
指导原则:
在标记为完成之前,对照 Figma 截图验证最终 UI。
验证清单:
用户说:"实现这个 Figma 按钮组件:https://figma.com/design/kL9xQn2VwM8pYrTb4ZcHjF/DesignSystem?node-id=42-15"
操作:
kL9xQn2VwM8pYrTb4ZcHjF 和 nodeId=42-15get_design_context(fileKey="kL9xQn2VwM8pYrTb4ZcHjF", nodeId="42-15")get_screenshot(fileKey="kL9xQn2VwM8pYrTb4ZcHjF", nodeId="42-15") 以获取视觉参考primary-500、primary-hover)结果: 与 Figma 设计匹配的按钮组件,并集成到项目设计系统中。
操作:
pR8mNv5KqXzGwY2JtCfL4D 和 nodeId=10-5get_metadata(fileKey="pR8mNv5KqXzGwY2JtCfL4D", nodeId="10-5") 以了解页面结构get_design_context(fileKey="pR8mNv5KqXzGwY2JtCfL4D", nodeId=":childNodeId")get_screenshot(fileKey="pR8mNv5KqXzGwY2JtCfL4D", nodeId="10-5") 以获取完整页面截图结果: 与 Figma 设计匹配的完整仪表板,具有响应式布局。
切勿基于假设进行实现。始终先获取 get_design_context 和 get_screenshot。
在实现过程中频繁验证,而不仅仅是在最后。这样可以及早发现问题。
如果必须偏离 Figma 设计(例如,出于可访问性或技术限制),请在代码注释中说明原因。
在创建新组件之前,始终检查是否存在现有组件。跨代码库的一致性比精确复制 Figma 更重要。
当有疑问时,优先选择项目的设计系统模式,而不是字面翻译 Figma。
原因: 设计过于复杂或嵌套层过多,无法在单个响应中返回。
解决方案: 使用 get_metadata 获取节点结构,然后使用 get_design_context 单独获取特定节点。
原因: 实现的代码与原始 Figma 设计之间存在视觉差异。 解决方案: 与步骤 3 中的截图进行并排比较。检查设计上下文数据中的间距、颜色和排版值。
原因: Figma MCP 服务器的资源端点无法访问或 URL 被修改。
解决方案: 验证 Figma MCP 服务器的资源端点是否可访问。服务器在 localhost URL 上提供资源。直接使用这些 URL,不要修改。
原因: 项目的设计系统令牌值与 Figma 设计中指定的值不同。 解决方案: 当项目令牌与 Figma 值不同时,为了保持一致性,优先使用项目令牌,但调整间距/尺寸以保持视觉保真度。
Figma 实现工作流建立了一个可靠的过程,用于将设计转化为代码:
对于设计师: 确信实现将与其设计实现像素级完美匹配。 对于开发者: 一种结构化的方法,消除了猜测并减少了来回修改。 对于团队: 一致、高质量的实现,保持了设计系统的完整性。
通过遵循此工作流,你可以确保每个 Figma 设计都能以同样的细心和关注细节来实现。
每周安装量
942
仓库
GitHub 星标数
15.1K
首次出现
2026年2月1日
安全审计
安装于
codex820
opencode804
github-copilot781
gemini-cli775
kimi-cli720
amp719
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.
https://figma.com/design/:fileKey/:fileName?node-id=1-2
:fileKey is the file key1-2 is the node ID (the specific component or frame to implement)figma-desktop MCP: User can select a node directly in the Figma desktop app (no URL required)Follow these steps in order. Do not skip steps.
If any MCP call fails because Figma MCP is not connected, pause and set it up:
codex mcp add figma --url https://mcp.figma.com/mcp[features].rmcp_client = true in config.toml or run codex --enable rmcp_clientcodex mcp login figmaAfter 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.
When the user provides a Figma URL, extract the file key and node ID to pass as arguments to MCP tools.
URL format: https://figma.com/design/:fileKey/:fileName?node-id=1-2
Extract:
:fileKey (the segment after /design/)1-2 (the value of the node-id query parameter)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.
Example:
https://figma.com/design/kL9xQn2VwM8pYrTb4ZcHjF/DesignSystem?node-id=42-15kL9xQn2VwM8pYrTb4ZcHjF42-15When 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.
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.
Run get_design_context with the extracted file key and node ID.
get_design_context(fileKey=":fileKey", nodeId="1-2")
This provides the structured data including:
If the response is too large or truncated:
get_metadata(fileKey=":fileKey", nodeId="1-2") to get the high-level node mapget_design_context(fileKey=":fileKey", nodeId=":childNodeId")Run get_screenshot with the same file key and node ID for a visual reference.
get_screenshot(fileKey=":fileKey", nodeId="1-2")
This screenshot serves as the source of truth for visual validation. Keep it accessible throughout implementation.
Download any assets (images, icons, SVGs) returned by the Figma MCP server.
IMPORTANT: Follow these asset rules:
localhost source for an image or SVG, use that source directlylocalhost source is providedTranslate the Figma output into this project's framework, styles, and conventions.
Key principles:
Strive for pixel-perfect visual parity with the Figma design.
Guidelines:
Before marking complete, validate the final UI against the Figma screenshot.
Validation checklist:
User says: "Implement this Figma button component: https://figma.com/design/kL9xQn2VwM8pYrTb4ZcHjF/DesignSystem?node-id=42-15"
Actions:
kL9xQn2VwM8pYrTb4ZcHjF and nodeId=42-15get_design_context(fileKey="kL9xQn2VwM8pYrTb4ZcHjF", nodeId="42-15")get_screenshot(fileKey="kL9xQn2VwM8pYrTb4ZcHjF", nodeId="42-15") for visual referenceprimary-500, primary-hover)Result: Button component matching Figma design, integrated with project design system.
User says: "Build this dashboard: https://figma.com/design/pR8mNv5KqXzGwY2JtCfL4D/Dashboard?node-id=10-5"
Actions:
pR8mNv5KqXzGwY2JtCfL4D and nodeId=10-5get_metadata(fileKey="pR8mNv5KqXzGwY2JtCfL4D", nodeId="10-5") to understand the page structureget_design_context(fileKey="pR8mNv5KqXzGwY2JtCfL4D", nodeId=":childNodeId") for each major sectionget_screenshot(fileKey="pR8mNv5KqXzGwY2JtCfL4D", nodeId="10-5") for the full pageResult: Complete dashboard matching Figma design with responsive layout.
Never implement based on assumptions. Always fetch get_design_context and get_screenshot first.
Validate frequently during implementation, not just at the end. This catches issues early.
If you must deviate from the Figma design (e.g., for accessibility or technical constraints), document why in code comments.
Always check for existing components before creating new ones. Consistency across the codebase is more important than exact Figma replication.
When in doubt, prefer the project's design system patterns over literal Figma translation.
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.
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.
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.
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.
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.
Weekly Installs
942
Repository
GitHub Stars
15.1K
First Seen
Feb 1, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
codex820
opencode804
github-copilot781
gemini-cli775
kimi-cli720
amp719
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
Grimoire CLI 使用指南:区块链法术编写、验证与执行全流程
940 周安装
Grimoire Uniswap 技能:查询 Uniswap 元数据与生成代币/资金池快照的 CLI 工具
940 周安装
Grimoire Aave 技能:查询 Aave V3 元数据和储备快照的 CLI 工具
941 周安装
Railway CLI 部署指南:使用 railway up 命令快速部署代码到 Railway 平台
942 周安装
n8n Python 代码节点使用指南:在自动化工作流中编写 Python 脚本
943 周安装
Flutter Platform Views 实现指南:Android/iOS/macOS原生视图与Web嵌入教程
943 周安装