From common-skills
当用户需要从 Figma 采集、保存或分析设计数据时加载——无论是提供 Figma URL、引用 Figma Desktop 选中节点、还是提到要对 Figma 设计进行头脑风暴。这是实现前的数据采集 skill:读取 Figma 设计上下文并保存为 figma-context.md、截图、资产、design token,供下游 coding agent 使用。也覆盖规划 Figma 设计实现方案(暂不写代码)、提取设计规范落盘到 vault 等场景。不用于:直接写实现代码、编辑 Figma 节点、创建新 Figma 设计、Figma 配置问题。
How this skill is triggered — by the user, by Claude, or both
Slash command
/common-skills:figma-planThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
从 Figma MCP 采集设计数据并结构化存储。本 skill 的产出物是 `figma-context.md` + 截图 + 已下载资产,后续实现阶段不需要再访问 Figma MCP。
从 Figma MCP 采集设计数据并结构化存储。本 skill 的产出物是 figma-context.md + 截图 + 已下载资产,后续实现阶段不需要再访问 Figma MCP。
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)如果缺少 Figma URL,且当前运行环境不能读取 Figma Desktop 选中节点,先用 AskUserQuestion 要链接或让用户选中节点。
Follow these steps in order. Do not skip steps.
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.
Download any assets (images, icons, SVGs) returned by the Figma MCP server.
IMPORTANT: Follow these asset rules:
localhost source for an image or SVG, download it and save to output_dir/attachments/在写入 figma-context.md 之前,必须先扫描项目中已有的公共组件,避免下游实现阶段重复造轮子。
执行方式:
src/components/, src/ui/, src/common/, src/shared/, lib/components/, packages/ui/, design-system/ 等)。如果项目结构不明确,先读取项目根目录的 README、package.json、或框架配置文件确定组件目录产出格式(写入 figma-context.md):
## Existing Project Components
### 可直接复用
| Figma 元素 | 项目组件 | 文件路径 | 说明 |
|-----------|---------|---------|------|
| Button / Primary | AppButton | src/components/AppButton.tsx | 已有 primary variant |
### 需新建
| Figma 元素 | 原因 |
|-----------|------|
| StatsCard | 项目中无类似卡片组件 |
原则:
将 get_design_context 的完整返回内容写入 output_dir/figma-context.md。这是设计数值的 ground truth——所有 layout、typography、color、spacing、token、component structure 都在里面,零转录。格式:
---
figma-file-key: {fileKey}
figma-node-id: {nodeId}
figma-url: {原始 URL}
---
## Figma Design Context
{get_design_context 的完整返回内容,原样保存,不做任何改写或摘要}
将 get_screenshot 的截图保存到 output_dir/attachments/,在 figma-context.md 顶部用 ![[attachments/figma-screenshot.png]] 嵌入。
将 Step 4 下载的资产保存到 output_dir/attachments/,在 figma-context.md 中记录资产清单和本地路径。
User says: "Plan implementation for this Figma button: 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 referenceattachments/figma-context.md with full design context dataattachments/figma-screenshot.pngResult: figma-context.md + screenshot + assets ready for downstream implementation.
User says: "Plan 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 pageattachments/figma-context.md with all collected design context dataResult: Complete design data captured for downstream implementation.
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.
figma-context.md 已生成且包含完整的 get_design_context 返回内容attachments/attachments/Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub sampeng87/skills --plugin common-skills