跳到正文
cccskills
免费在 GitHub 公开

figma

Figma design-to-code workflow. Read Figma files, inspect components, extract design tokens, and translate designs to implementation. Use when working with Figma designs, extracting styles, or building design systems.

中文简介正在准备中。当前显示原文说明。

集成工具Figma
查看安装方法

包含的文件(10)

  • SKILL.md7.9 KB
  • commands/figma.md105 B
  • hooks/post-execute.cjs163 B
  • hooks/pre-execute.cjs269 B
  • references/research-requirements.md614 B
  • rules/figma.md749 B
  • schemas/input.schema.json578 B
  • schemas/output.schema.json381 B
  • scripts/main.cjs593 B
  • templates/implementation-template.md272 B

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Figma

Extract design information from Figma files for implementation. Covers design token extraction, component inspection, and design-to-code translation.

When to Use

  • Translating Figma designs into frontend code
  • Extracting design tokens (colors, typography, spacing) from Figma
  • Inspecting Figma component structure for implementation planning
  • Building or updating a design system from Figma sources
  • Mapping Figma auto-layout properties to CSS

Prerequisites

  • Figma Personal Access Token (set as FIGMA_ACCESS_TOKEN env var)
  • Figma file URL or file key

Core API Endpoints

Get File

curl -H "X-Figma-Token: $FIGMA_ACCESS_TOKEN" \
  "https://api.figma.com/v1/files/FILE_KEY"

Get File Nodes (specific components)

curl -H "X-Figma-Token: $FIGMA_ACCESS_TOKEN" \
  "https://api.figma.com/v1/files/FILE_KEY/nodes?ids=NODE_ID1,NODE_ID2"

Get Image Exports

curl -H "X-Figma-Token: $FIGMA_ACCESS_TOKEN" \
  "https://api.figma.com/v1/images/FILE_KEY?ids=NODE_ID&format=svg"

Get File Styles

curl -H "X-Figma-Token: $FIGMA_ACCESS_TOKEN" \
  "https://api.figma.com/v1/files/FILE_KEY/styles"

Get File Components

curl -H "X-Figma-Token: $FIGMA_ACCESS_TOKEN" \
  "https://api.figma.com/v1/files/FILE_KEY/components"

Design Token Extraction Workflow

Step 1: Fetch File Styles

# Get all published styles
curl -s -H "X-Figma-Token: $FIGMA_ACCESS_TOKEN" \
  "https://api.figma.com/v1/files/FILE_KEY/styles" | jq '.meta.styles'

Step 2: Map to CSS Variables

/* Colors */
:root {
  --color-primary: #2563eb; /* From Figma: Primary/500 */
  --color-secondary: #7c3aed; /* From Figma: Secondary/500 */
  --color-surface: #ffffff; /* From Figma: Surface/Default */
}

/* Typography */
:root {
  --font-heading: 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --text-xl: 1.25rem; /* From Figma: Heading/XL */
  --text-base: 1rem; /* From Figma: Body/Base */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
}

/* Spacing */
:root {
  --space-1: 0.25rem; /* 4px */
  --space-2: 0.5rem; /* 8px */
  --space-4: 1rem; /* 16px */
  --space-8: 2rem; /* 32px */
}

Step 3: Auto-Layout to CSS Mapping

Figma Auto-LayoutCSS Equivalent
Horizontaldisplay: flex; flex-direction: row;
Verticaldisplay: flex; flex-direction: column;
Space betweenjustify-content: space-between;
Packed (start)justify-content: flex-start;
Gap: 16gap: 1rem;
Padding: 16,24padding: 1rem 1.5rem;
Fill containerflex: 1; or width: 100%;
Hug contentswidth: fit-content;

Step 4: Component Inspection

For each Figma component, extract:

  1. Name - Component name and variant properties
  2. Structure - Child node tree (frames, text, images)
  3. Styles - Applied color, text, and effect styles
  4. Constraints - Responsive behavior rules
  5. Variants - All component variants and their properties

Iron Laws

  1. ALWAYS extract design tokens before building components — building without tokens leads to hardcoded values that break when the design system updates.
  2. NEVER hardcode Figma colors/spacing — always map to CSS variables or design token constants that reference the Figma source.
  3. ALWAYS map Figma auto-layout to CSS flexbox — auto-layout is a direct 1:1 mapping to flexbox; using other layout methods loses design intent.
  4. NEVER export raster images when SVG is available — SVGs scale cleanly and reduce bundle size; only use PNG/JPEG for photographs.
  5. ALWAYS preserve Figma component naming in code component names — divergent naming breaks the design-development feedback loop.

Anti-Patterns

Anti-PatternWhy It FailsCorrect Approach
Hardcoded hex colorsBreaks on design system updateUse CSS variables mapped from Figma tokens
Ignoring auto-layoutLayout doesn't match designMap auto-layout 1:1 to flexbox/grid
Pixel-perfect obsessionWastes time, ignores responsiveMatch design intent, not exact pixels
Skipping component variantsMissing states (hover, disabled)Extract ALL Figma variants
Manual token extractionError-prone, doesn't scaleUse Figma REST API for programmatic extraction

Figma MCP Server Tools (figma/mcp-server-guide)

When the official Figma MCP server is running, these 12 tools are available:

ToolPurpose
get_design_contextGet full design context for a file/node (components, styles, layout)
generate_figma_designGenerate new designs from natural language description
get_variable_defsExtract all design tokens (colors, spacing, typography variables)
get_screenshotCapture rendered screenshot of a frame/component
code_connect_mapMap Figma components to their code counterparts
create_design_system_rulesAuto-generate design system documentation
get_figjamAccess FigJam board content and sticky notes
generate_diagramGenerate Figma diagram from Mermaid input
get_componentsList all published components in a file
get_stylesExtract all defined styles (color, text, effect)
export_assetsExport assets as PNG/SVG/PDF with scale options
get_annotationsRetrieve design annotations and spec notes
get_metadataGet XML layer representation of a file/node for programmatic parsing
whoamiGet current user identity, plan tier, and available seat count

MCP Setup: Install Figma Desktop app -> Settings -> Enable MCP server Auth: Uses active Figma session (no API key needed for local MCP) Key workflow: get_design_context -> code_connect_map -> export_assets for design-to-code Identity check: Use whoami to verify plan tier before calling enterprise-only tools

Memory Protocol (MANDATORY)

Before starting: Read .claude/context/memory/learnings.md

After completing:

  • New pattern -> .claude/context/memory/learnings.md
  • Issue found -> .claude/context/memory/issues.md
  • Decision made -> .claude/context/memory/decisions.md

ASSUME INTERRUPTION: If it's not in memory, it didn't happen.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Ensure accessibility in UI components including semantic HTML, ARIA attributes, keyboard navigation, and WCAG 2.2 AA compliance.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

Use when you want to improve response quality through meta-cognitive reasoning. Applies 15+ reasoning methods to reconsider and refine initial outputs.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

N-round opposing-stance debates for trade-off analysis. Assigns pro/con roles to agents, runs structured debate rounds with quality scoring, and produces a moderator synthesis with confidence-rated recommendation. Generalizable to architecture, technology, security, and design decisions.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

Force adversarial code review stance that eliminates confirmation bias — reviewer must find issues or re-analyze

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

Creates specialized AI agents on-demand when no existing agent matches a request. Use when the Router cannot find a suitable agent for a task. Enables self-evolution by generating persistent agents.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

LLM-as-judge evaluation framework with 5-dimension rubric (accuracy, groundedness, coherence, completeness, helpfulness) for scoring AI-generated content quality with weighted composite scores and evidence citations

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

查看 oimiragieo 的全部技能

报告此技能的问题