← 返回
未分类 中文

Figma Agent

Figma MCP integration for OpenClaw. Use when the user wants to read Figma designs, inspect design tokens/variables, work with Code Connect, or create/edit Fi...
Figma MCP 与 OpenClaw 的集成。用于读取 Figma 设计、检查设计标记/变量、使用 Code Connect 或创建/编辑。
rasimme rasimme 来源
未分类 clawhub v0.3.0 1 版本 99789.5 Key: 无需
★ 0
Stars
📥 474
下载
💾 0
安装
1
版本
#latest

概述

Figma Agent

Figma Remote MCP integration for OpenClaw. Reads designs via figma__ tools; creates and edits via CC sessions using mcp__figma__ tools.

Route First

Read/Inspect → call figma__* tools directly. No CC session needed.

Write/Create/Edit → requires CC session via mcp__figma__* tools.

Seeing or understanding a design? → Direct. Do not start a session.

Changing or creating something? → Start a CC session. Follow the matching playbook below.

Execution model:

  1. Route & Brief — choose the workflow, identify the real risks, and write a lean execution brief
  2. Execute — perform the direct read or CC-based write flow
  3. Done Gate — do not report success until the applicable structural and visual validation checks pass

Workflow Routing

First: Determine the user's intent, then follow the matching path.

This is an abridged routing summary. For the full matrix and decision logic, see references/workflow-selection.md.

→ Full routing matrix: references/workflow-selection.md

IntentPathRoute
---------------------
Build a production screenNative Screen GenerationCC
Create next step / state variant from an existing screenNative Screen GenerationCC
Prototype from HTML/URLHTML-to-Figma PrototypingCC
Read-only inspectionget_design_context / get_screenshotDirect
Review + Edit a screenScreen Review LoopCC
Apply design tokensColor TokenizationCC
Import + clean up Stitch exportStitch Import CleanupCC
Discover variables/stylesVariable DiscoveryDirect
Audit design systemDesign System CleanupCC
Inspect finished designDesign Audit ReviewDirect

Image Delivery (MANDATORY after every write)

Screenshots must reach the user as Telegram photo attachments — not as inline base64 text.

Workflow:

  1. Save to file — use --out flag so the PNG is written directly:

```bash

node scripts/figma-mcp-cli.mjs get_screenshot \

fileKey= nodeId= scale=2 \

--out ~/workspace-dev-botti/screenshots/.png

```

  1. Deliver to user — put MEDIA: on its own line in your reply:

```

Hier ist der aktuelle Stand:

MEDIA:screenshots/validate.png

```

OpenClaw extracts every MEDIA: line and sends the file as a native Telegram photo.

The path is workspace-relative (screenshots/...) or absolute.

Two different tools — don't mix them up:

ToolPurposeUsed for Image Delivery?
-----------------------------------------
image toolSend to Vision model for analysis❌ No — analysis only
MEDIA: in reply textSend as Telegram attachment✅ Yes — actual delivery

Why --out?

Without it, the Figma API returns base64-encoded JSON → renders as inline text in Telegram, not a photo. The --out flag decodes and writes a real PNG file that MEDIA: sends as an attachment.

Screenshot directory: ~/workspace-dev-botti/screenshots/ (create if missing)

Validation pattern (every write operation):

# After use_figma call — save screenshot → MEDIA: in reply
node scripts/figma-mcp-cli.mjs get_screenshot fileKey=<key> nodeId=<id> scale=2 \
  --out ~/workspace-dev-botti/screenshots/validate.png
# Reply with:
# MEDIA:screenshots/validate.png

Stitch comparison:

Stitch delivers via MEDIA: (HTTP URL). Figma delivers via MEDIA: (file). Mechanism identical — only the source differs.


Hard Rules (Top 6)

These are non-negotiable. Full rule set: references/core-rules.md

  1. Validate after every writeget_screenshot or get_metadata after each use_figma call. Never assume success.
  2. Read → Understand → Fix → Retry — never blindly retry failed code, never rebuild as first response.
  3. Explicit over implicit — name exact variables, components, layout modes. Leave nothing to inference.
  4. Design-system-first — check local variables, styles, Code Connect, then libraries before creating anything raw.
  5. Component-instance-first — if a suitable existing design-system component exists, instantiate it instead of recreating it with local frames.
  6. Section-by-section — one logical section per use_figma call, validate between sections.

Known Gotchas

Before writing any use_figma code, know these failure modes:

→ Full reference: references/plugin-api-gotchas.md

  • Paint binding: setBoundVariableForPaint returns a new paint — reassign the fills/strokes array (#paint-binding)
  • Opacity reset: Paint binding resets opacity to 1.0 — save and restore explicitly (#opacity)
  • Page context: Always set page explicitly — figma.currentPage may reset between calls (#page-context)
  • FILL sizing: appendChild to auto-layout parent before setting layoutSizingHorizontal: "FILL" (#append-before-fill)
  • Async: Always await async operations — loadFontAsync, importComponentByKeyAsync, etc. (#promises)

Prompting Guidance

→ Full patterns: references/prompting-patterns.md

Key patterns: variable-first code structure, section-by-section execution, explicit design-system usage, validation loops, error recovery framing.


Install / Setup

If dependencies are missing, install them from the skill repo root:

npm install

Then run one-time bootstrap:

Setup (One-Time Bootstrap)

node ~/.openclaw/skills/figma-agent/scripts/auth.mjs

Reads CC OAuth token from ~/.claude/.credentials.json, writes it into ~/.openclaw/openclaw.json. Then restart the OpenClaw gateway.

Token check: node ~/.openclaw/skills/figma-agent/scripts/auth.mjs --check

On 401 errors: Open CC → use any Figma tool (auto-refreshes token) → re-run bootstrap script.


URL Parsing

figma.com/design/:fileKey/:name?node-id=:nodeId

Convert - to : in nodeId (e.g. 123-456123:456). For FigJam: figma.com/board/:fileKey/:name → use get_figjam.


Tool & Rate-Limit Reference

references/figma-api.md

版本历史

共 1 个版本

  • v0.3.0 当前
    2026-05-03 06:28 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

design-media

Openai Whisper

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

UI/UX Pro Max

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

Video Frames

steipete
使用 ffmpeg 从视频中提取帧或短片。
★ 133 📥 52,688