← 返回
未分类 Key 中文

Figma Design Integration

Figma design asset reading, code generation, and MCP integration. Covers REST API direct calls and MCP Server capabilities for design-to-code workflows. **Us...
Figma 设计资源读取、代码生成及 MCP 集成。涵盖通过 REST API 直接调用以及 MCP Server 在设计转代码工作流中的功能。**Us...
chenyqthu chenyqthu 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 497
下载
💾 1
安装
1
版本
#latest

概述

Figma Skill

Installation

For OpenClaw agents (ClawHub)

clawhub install figma

For Claude Code (MCP Server)

# Add Figma MCP (one-time, global)
claude mcp add --scope user --transport http figma https://mcp.figma.com/mcp

# Or install the official Figma plugin (includes Skills)
claude plugin install figma@claude-plugins-official

For Codex CLI

codex mcp add figma --transport http https://mcp.figma.com/mcp

Environment

Set FIGMA_TOKEN (Personal Access Token) in your environment or .env file.

Generate at: https://www.figma.com/settings → Account → Personal access tokens


Quick Reference

Two access methods

MethodUse caseAuth
------------------------
REST API (scripts/figma_api.py)Read file structure, components, export imagesFIGMA_TOKEN
MCP Server (https://mcp.figma.com/mcp)Interactive design-to-code, write to canvasOAuth (auto)

1. REST API — Direct File Access

Use scripts/figma_api.py to query Figma files directly. Supports full URLs or file keys.

Commands

# File structure
python3 scripts/figma_api.py pages <file_key_or_url>

# Frame tree (depth controls levels)
python3 scripts/figma_api.py tree <file_key> --node <page_id> --depth 3

# Published components (--group to aggregate by frame)
python3 scripts/figma_api.py components <file_key> --group

# Component sets
python3 scripts/figma_api.py component-sets <file_key>

# Styles
python3 scripts/figma_api.py styles <file_key>

# Export as PNG/SVG
python3 scripts/figma_api.py export <file_key> --nodes <id1>,<id2> --format png --scale 2

# Node JSON detail
python3 scripts/figma_api.py node <file_key> --node <node_id> --depth 4

# Current user info
python3 scripts/figma_api.py me

2. MCP Server — 14 Tools

Read tools (any Figma plan)

ToolPurpose
---------------
get_design_contextDesign context → code (default React+Tailwind, customizable)
get_variable_defsVariables and styles (colors, spacing, typography)
get_metadataSparse XML: layer IDs, names, types, positions, sizes
get_screenshotScreenshot of selection
get_code_connect_mapFigma node → code component mapping (needs Code Connect)
search_design_systemSearch library components, variables, styles
whoamiAuthenticated user info

Write tools (beta free, needs Full seat + edit permission)

ToolPurpose
---------------
use_figmaExecute Figma Plugin API JS: create/modify frames, components, variables, auto layout
generate_figma_designConvert live browser UI → editable Figma layers
create_new_fileCreate new file in Drafts
generate_diagramMermaid syntax → FigJam diagram

Helper tools

ToolPurpose
---------------
create_design_system_rulesGenerate design system rules file for AI code generation
add_code_connect_mapAdd Figma node → code component mapping
get_code_connect_suggestionsCode Connect mapping suggestions

Write limitations

  • 20KB response limit per call
  • No image/asset import support
  • Full seat required (Dev seat = read-only)
  • Large changes: inspect first → incremental create/update → verify

3. Design-to-Code Workflow

For Claude Code / Codex (via MCP)

Step 1 — Provide the Figma frame URL in your prompt:

Using this Figma frame: https://www.figma.com/design/<key>?node-id=<id>
Generate React components using [your component library].

Step 2 — For large pages, ask the agent to inspect first:

1. Use get_metadata on the frame to understand the structure
2. Use search_design_system to find matching library components
3. Use get_design_context on each section to generate code

Step 3 — Write back to Figma (if editor permission):

Using this file: <url>, create a new page and build [description]
using existing components. Use auto layout.

For OpenClaw agents (via REST API)

  1. figma_api.py pages → identify target page
  2. figma_api.py tree --node → understand structure
  3. figma_api.py export --nodes → get screenshot
  4. figma_api.py node --node --depth 4 → get component details
  5. Generate code using the structural data + screenshot

Best practices

  • Always specify frontend framework and component library in prompts
  • Large pages: get_metadata overview first, then get_design_context per section
  • Use get_screenshot for layout-sensitive components
  • Rate limit: space REST API calls ≥500ms apart
  • Keep depth ≤ 4 to avoid timeouts on large files

4. Asset Registry

Register your Figma files in references/omada-assets.md for quick lookup.

See references/guide-for-agents.md for the complete agent operation manual.

See references/guide-for-humans.md for the human-facing usage guide.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-03 05:40 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

design-media

Openai Whisper

steipete
使用 Whisper CLI 进行本地语音转文字(无需 API 密钥)
★ 330 📥 93,318
design-media

Nano Banana Pro

steipete
使用 Nano Banana Pro (Gemini 3 Pro Image) 生成或编辑图像。支持文生图、图生图及 1K/2K/4K 分辨率,适用于图像创建、修改及编辑请求,使用 --input-image 指定输入图像。
★ 427 📥 116,452
design-media

UI/UX Pro Max

xobi667
提供 UI/UX 设计智能与实现指导,帮助打造精美界面。适用于 UI 设计、UX 流程、信息架构、视觉风格、设计系统/标记、组件规格、文案/微文案、无障碍及前端 UI(HTML/CSS/JS、React、Next.js、Vue、Svelte
★ 216 📥 46,899