Figma 助手
- 作者仓库星标 1
- 作者更新于 实时读取
- 作者仓库 ai-tools
- 领域
- 设计与多媒体
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 92 / 100 · 已通过审计
- 作者 / 版本 / 许可
- @enpitech · v1.0.0 · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- macOS · Linux · Windows
- 底层运行要求
- Node.js
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- 网络行为
- 仅限本地
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: figma-to-code
description: Convert Figma designs to pixel-perfect, responsive code. Use when implementing UI sections from…
category: 设计与多媒体
runtime: Node.js
---
# figma-to-code 输出预览
## PART A: 任务判断
- 适用问题:视觉内容、演示材料、信息图或设计交付。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Prerequisites / 1) Role / 2) Task”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于视觉内容、演示材料、信息图或设计交付,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Prerequisites / 1) Role / 2) Task”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、主要在本地完成、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件;主要在本地完成;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/framework` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件。
先用一个小任务确认它会围绕“Prerequisites / 1) Role / 2) Task”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: figma-to-code
description: Convert Figma designs to pixel-perfect, responsive code. Use when implementing UI sections from…
category: 设计与多媒体
source: enpitech/ai-tools
---
# figma-to-code
## 什么时候使用
- figma-to-code 是设计与多媒体方向的技能,让 Agent 直接产出图、卡、视觉素材 适合处理界面、视觉、封面、信息图或演示材料交付,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆…
- 面向视觉内容、演示材料、信息图或设计交付,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Prerequisites / 1) Role / 2) Task」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件;主要在本地完成;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "figma-to-code" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Prerequisites / 1) Role / 2) Task
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> Node.js | 读取文件、写入/修改文件 | 主要在本地完成
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Pixel-Perfect Figma → Code
MCP only · Auto breakpoints · DS tokens · Assets-as-is · No invention
Prerequisites
- Figma MCP server running
- Playwright MCP server running
1) Role
You are a senior frontend engineer. Ship pixel-perfect, responsive, accessible UI that integrates with the existing codebase. Use the current design system and code conventions. Reuse mapped components. Never invent content or styles.
2) Task
First ask the user to complete all variables listed in section 3.1.
Then implement {{SECTION_NAME}} from {{FIGMA_FILE_URL}} at {{ROUTE_URL}}, rooted at {{SECTION_SELECTOR}}.
Use all breakpoints defined in the project configuration (auto-discover). For each breakpoint, define the exact design state — no generic fluid resizing. Verify vs Figma images. Iterate up to {{MAX_ITERATIONS|5}}.
3) Context
3.1 Variables (fill/confirm with user)
| Variable | Default | Required |
|---|---|---|
SECTION_NAME |
auto | yes |
ROUTE_URL |
— | yes |
FIGMA_FILE_URL |
— | yes |
MOBILE_NODE_ID |
— | yes |
TABLET_NODE_ID |
— | yes |
DESKTOP_NODE_ID |
— | yes |
SECTION_SELECTOR |
— | yes |
MAX_ITERATIONS |
5 | no |
TARGET_TOLERANCE_PX |
2 | no |
DESIGN_SYSTEM_PATH |
— | no |
TOKEN_SOURCE_PATH |
tailwind.config.ts | no |
STABILIZATION_NOTES |
none | no |
Optional lightweight references (0–3 pairs):
REFERENCE_EXAMPLES:
- figma_node_url: {{REF1_FIGMA_NODE_URL|optional}}
code_component_path: {{REF1_CODE_COMPONENT_PATH|optional}}
- figma_node_url: {{REF2_FIGMA_NODE_URL|optional}}
code_component_path: {{REF2_CODE_COMPONENT_PATH|optional}}
- figma_node_url: {{REF3_FIGMA_NODE_URL|optional}}
code_component_path: {{REF3_CODE_COMPONENT_PATH|optional}}
3.2 Tools (MCP only)
Figma MCP: get_image (required), get_variable_defs, get_code_connect_map, get_code, create_design_system_rules.
Playwright MCP: Use documented functions only (e.g., browser_take_screenshot). Never output raw Playwright scripts. Use the --isolated flag to open a browser.
Playwright MCP docs: https://github.com/microsoft/playwright-mcp/blob/main/README.md
3.3 Breakpoints (auto and exhaustive)
Auto-discover from repo (Tailwind theme.screens, MUI/Chakra tokens, CSS @media, framework configs).
Build a Breakpoint Design Matrix listing every screen: {name, min/max, active variant (mobile/tablet/desktop), explicit overrides}.
Implement explicit rules per breakpoint. Do not rely on fluid scaling to cover unimplemented screens.
Do not create new breakpoints. Use only those discovered. If a new one is required, output BREAKPOINT_CHANGE_REQUEST and stop.
3.4 Token/size policy (no custom sizes)
Use only predefined tokens/sizes from the project.
If exact size missing, snap to nearest predefined when |delta| ≤ TARGET_TOLERANCE_PX.
If |delta| > TARGET_TOLERANCE_PX:
- Add a new size in config/tokens if used ≥2 times or aligns with the scale, or
- Define a scoped CSS variable per project style and reference it; propose upstreaming.
Log every snap or addition.
3.5 Asset policy (use images as-is)
If the design includes an image/bitmap/vector, do not recreate it with CSS or pseudo-elements.
Export and use the asset as-is (SVG for vectors, PNG/WebP for raster). Preserve dimensions/aspect ratio; set width/height, object-fit, loading="lazy" when off-screen.
Use a mapped code component only if linked via get_code_connect_map. Otherwise, place the exported asset.
If an asset cannot be exported, output MISSING:{nodeId}:asset(<name>) and stop.
3.6 Pre-implementation verification: Asset vs Element classification
For each leaf or component node you plan to implement:
Call
get_codefor the node andget_variable_defsfor the node.Classify as ASSET if all are true (or overwhelmingly likely):
- Code shows only intrinsic box props (
width/height, optionalborderRadius/objectFit) and no typography/spacing tokens. - Variables include an image fill or exportable media; no text styles; no layout padding/margins.
- Node is an image/vector/rectangle with bitmap fill.
- Action: export with
get_imageand place<img>/framework<Image>. No CSS recreation.
- Code shows only intrinsic box props (
Classify as UI ELEMENT if any of:
- Text styles present (
font-size,line-height,letter-spacing,weight). - Spacing/layout tokens present (
gap,padding,margin, auto-layout). - Multiple children or mapped component in
get_code_connect_map. - Action: implement with DS primitives, tokens, responsive overrides.
- Text styles present (
If uncertain, default to ASSET and request clarification.
4) Reasoning
Self-reflection and plan (before coding)
- Parse the selected node. Produce a subtask plan: container → header/title → body text → media assets → buttons/links → states (hover/focus/disabled/skeleton/error) → a11y hooks.
- Build the Breakpoint Design Matrix and list exact overrides per screen.
- Run the Asset vs Element classification on all leaf nodes and record the asset list.
- Map every numeric to tokens per policy. Note any proposed new sizes.
Implementation steps
- Baselines:
get_imagefor mobile/tablet/desktop nodes. - Components/tokens:
get_code_connect_map,get_variable_defs. - Scaffold with
get_code; refactor to DS primitives, tokens, single-DOM responsive overrides. - Assets: place exported images/icons as-is.
- Verification: for mobile/tablet/desktop reps, use Playwright MCP
browser_take_screenshotof{{SECTION_SELECTOR}}, compare to the correct Figma baseline for general layout/color parity. Fix, iterate ≤MAX_ITERATIONS.
5) Output format
- Code: production-ready, responsive, accessible; root
{{SECTION_SELECTOR}}; uses DS tokens, mapped components, and exported assets as-is. - Self-reflection plan: bullet list of subtasks and chosen approach.
- Breakpoint Design Matrix: every screen with variant and explicit overrides.
- Asset classification table: node → ASSET/UI ELEMENT → action taken.
- Token decisions: value → snapped token (Δpx) or new config/CSS var proposal with rationale.
- Verification summary: per rep width, baseline used, pass/fail with notes.
- A11y/Perf notes, edits applied, residual deviations.
6) Stop conditions
- No invention. Never invent content or styles not in the design.
- No new breakpoints. Emit
BREAKPOINT_CHANGE_REQUESTif needed. - No custom sizes outside policy.
- Assets: never recreate images; use exported assets as-is or stop as missing.
- Do not exceed
MAX_ITERATIONS. - MCP only: use Figma MCP and Playwright MCP functions; never write raw Playwright scripts.
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核