← 返回 Skills 市场
missionarteemis-cloud

Craw Figma

作者 missionarteemis-cloud · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
41
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install craw-figma
功能描述
Full bidirectional Figma integration — read files via REST API, create/modify/delete layers via local WebSocket connector + Figma plugin. Audit accessibility...
使用说明 (SKILL.md)

Craw Figma Skill

Complete Figma control for AI agents: read via REST API, write via a local plugin. Change design layers, extract design tokens, audit accessibility, export assets.

Architecture

Craw ──→ figma_client.mjs (REST API) ──────→ Figma cloud    (read: file, styles, export)
     ──→ figma_send.js    (WebSocket) ──→ figma_connector.js ──→ Figma Plugin → Figma Desktop
     ──→ style_auditor.mjs              (design system analysis, CSS tokens)
     ──→ accessibility_checker.mjs      (WCAG AA/AAA, contrast, touch targets)

Requirements

  • Figma Personal Access Token → for REST API (read). Get it: Figma → Settings → Account → Personal Access Tokens
  • Figma Desktop → required for write operations
  • Node.js 18+

Quick Start

1. Set up your token

export FIGMA_ACCESS_TOKEN="figd_your_token_here"

2. Read a Figma file

node scripts/figma_client.mjs get-file \x3Cfile-key>
# Example: node scripts/figma_client.mjs get-file "ABC123xyz" --depth 4

Get a file key from: https://www.figma.com/design/\x3CFILE_KEY>/...

3. Install the Figma Plugin (one-time, for write access)

  1. Clone/download the skill repository
  2. Open Figma DesktopPluginsDevelopmentImport plugin from manifest...
  3. Select plugin/manifest.json from this skill's directory
  4. The plugin "Craw Figma Connector" is now installed

4. Start the connector + run the plugin

# Terminal 1: Start the local WebSocket server
node scripts/figma_connector.js
# → Listening on ws://localhost:9199

In Figma Desktop:

  • Right-click canvas → PluginsCraw Figma Connector
  • The panel shows Connected to Craw when the WebSocket connects

5. Send write commands

# Create a rectangle
node scripts/figma_send.js createRectangle \
  --payload '{"x":100,"y":100,"width":400,"height":300,"fillColor":{"r":0.14,"g":0.49,"b":1},"cornerRadius":12,"name":"Hero Card"}'

# Get current selection
node scripts/figma_send.js getSelection

Available Commands

Write (Plugin — real-time in Figma Desktop)

Command Payload (JSON) Description
createRectangle {x, y, width, height, fillColor?, cornerRadius?, name?} New rectangle
createFrame {x, y, width, height, fillColor?, name?} New frame/artboard
createEllipse {x, y, width, height, fillColor?, name?} New ellipse
createText {x, y, characters, fontSize?, fontName?, fillColor?, name?} New text layer
selectNode {id} Select + zoom into node
updateNode {id, x?, y?, resize?{width,height}, fillColor?, name?} Modify existing node
deleteNode {id} Remove node
setFillColor {id, color{r,g,b}, opacity?} Set fill color
groupSelection {} Group selected nodes
getSelection {} List selected nodes
getPageInfo {} Current page info
createPolygon {x, y, width, height, pointCount, fillColor?, name?} Regular polygon (N sides)
createStar {x, y, width, height, pointCount, innerRadius?, fillColor?, name?} Star shape
createVectorNetwork {x, y, width, height, vectorNetwork: {vertices, segments}, fills?, strokes?} Custom vector path
booleanOperation `{operation: UNION SUBTRACT
updateNode (auto-layout) {id, layoutMode?, paddingLeft?, ..., itemSpacing?, primaryAxisAlignItems?, ...} Apply Auto Layout to frame

Shape Generator (advanced)

Script Description
node scripts/shape_generator.js test-basic Demo: rectangle, ellipse, polygon, star, heart in grid
node scripts/shape_generator.js test-union Demo: union of two overlapping circles
node scripts/shape_generator.js generate '{"type":"heart","width":200}' Single shape by type

Auto Layout Module

Script Description
node scripts/auto_layout.js card '{"width":320}' Create card with auto-layout
node scripts/auto_layout.js button '{"name":"CTA"}' Create button with padding
node scripts/auto_layout.js row '{"padding":8}' Horizontal row
node scripts/auto_layout.js column '{"padding":16}' Vertical column

Style Dictionary Pipeline

Script Description
cd scripts/style-dictionary && npx style-dictionary build Generate CSS variables + Figma tokens
Output: scripts/style-dictionary/build/variables.css DR's Lab CSS custom properties (--color-*, --spacing-*, etc.)
Output: scripts/style-dictionary/build/figma-tokens.json Figma-compatible nested tokens

Read (REST API)

Action Args Description
get-file \x3Ckey> [--depth N] Full file document tree
get-file-nodes \x3Ckey> \x3Cid>... Specific nodes by ID
get-styles \x3Ckey> Published styles (color, text, effects)
get-components \x3Ckey> Published components
get-versions \x3Ckey> Version history
render-images \x3Ckey> \x3Cid> [--format png|svg|pdf] [--scale N] Export as images
get-image-fills \x3Ckey> Image fill URLs used in file
get-metadata \x3Ckey> Lightweight file info
me Current user info

Analysis

Action Args Description
style_auditor.mjs \x3Ckey> [--brand-colors "#HEX,#HEX"] [--generate-css] Analyze colors, fonts, consistency, CSS tokens
accessibility_checker.mjs \x3Ckey> [--level AA|AAA] [--format json|report] WCAG contrast, touch targets, font sizes

Color Format

Figma uses RGB in 0–1 range:

{"r": 0.14, "g": 0.49, "b": 1}     // #247DFF (blue)
{"r": 1, "g": 0.42, "b": 0.21}      // #FF6B35 (orange)
{"r": 1, "g": 1, "b": 1}            // #FFFFFF (white)

Auto-setup for AI Agents

When a user installs this skill, the AI agent should:

  1. Check if FIGMA_ACCESS_TOKEN is set — if not, instruct the user to generate one and export it
  2. For write operations, check if the Figma plugin is installed — if not:
    • Guide the user through importing plugin/manifest.json in Figma Desktop
    • Suggest running node scripts/figma_connector.js separately
    • Offer to run figma_connector.js if the agent has shell access
  3. Test connectivity with figma_client.mjs me before proceeding

Tips

  • Keep figma_connector.js running while working with write commands
  • The plugin auto-reconnects if the connector restarts (3s retry)
  • Commands sent while the plugin is offline are queued and sent on reconnect
  • Health check: http://localhost:9200 shows status and pending queue
  • Use --generate-css to extract Figma styles as CSS custom properties
  • Command timeout defaults to 30s. Override: FIGMA_CMD_TIMEOUT=60000 node figma_connector.js
  • Boolean operations (union/subtract) may take longer — timeout is automatically handled and logged

Files

skills/craw-figma/
├── SKILL.md
├── scripts/
│   ├── figma_client.mjs          — Figma REST API client (read)
│   ├── figma_connector.js        — Local HTTP server (run this) — timeout 30s configurable
│   ├── figma_send.js             — Send commands to Figma plugin
│   ├── shape_generator.js        — General-purpose shape creation (polygons, stars, hearts, union)
│   ├── auto_layout.js            — Auto Layout module (cards, rows, buttons, spacing)
│   ├── heart_generator.js        — Legacy heart shape generator
│   ├── star_generator.js         — Legacy star generator
│   ├── design_engine.js          — Design orchestration engine
│   ├── design_orchestrator.js    — Orchestrator with NotebookLM consultation
│   ├── design_critic.js          — Design critique pipeline
│   ├── craw_design_cmd.sh        — Shell wrapper for design commands
│   ├── svg_to_figma.js           — SVG path → Figma Vector Network converter
│   ├── style_auditor.mjs         — Design system analysis
│   ├── accessibility_checker.mjs — WCAG compliance
│   └── style-dictionary/
│       ├── config.json           — Style Dictionary configuration
│       ├── tokens/               — DTCG tokens → SD format
│       ├── build/variables.css   — Generated CSS custom properties
│       └── build/figma-tokens.json — Figma-compatible tokens
├── plugin/
│   ├── manifest.json             — Figma plugin manifest
│   ├── code.js                   — Plugin code (ES5, production)
│   ├── code.ts                   — Plugin code (TypeScript source)
│   └── ui.html                   — Plugin panel UI
├── design-tokens/
│   ├── design-tokens.json        — Core tokens (DTCG format)
│   ├── projects/drs-lab.json     — DR's Lab project tokens
│   └── load-tokens.js            — Token loader utility
└── references/
    ├── figma-api-reference.md    — REST API docs
    └── design-patterns.md        — UI patterns & best practices
安全使用建议
Install only if you are comfortable giving a local AI workflow real-time control over the active Figma file. Use it on copies or versioned files, avoid sensitive customer/proprietary designs unless needed, verify any connector code from the external repository before running it, and do not leave the localhost connector running when you are done.
能力标签
cryptorequires-oauth-tokenrequires-sensitive-credentials
能力评估
Purpose & Capability
The create, update, delete, read, and export capabilities are coherent with the stated bidirectional Figma-integration purpose, and the README/SKILL files disclose real-time Figma writes and asset export.
Instruction Scope
The skill executes high-impact write commands, including arbitrary node deletion by ID and exported node transfer, without clear confirmation, scoping to agent-created content, dry-run behavior, or rollback guidance.
Install Mechanism
The documentation instructs users to run a local connector and several helper scripts, but the reviewed artifact only includes shape_generator.js; the core connector and REST client are missing from the package, pushing users toward unreviewed external setup.
Credentials
Use of a Figma access token, localhost command polling, design metadata/results forwarding, and optional base64 PNG export is proportionate for the purpose but sensitive enough to require stronger disclosure and trust controls.
Persistence & Privilege
The plugin polls while open and the connector is user-started rather than silently persistent, but the localhost bridge is unauthenticated in the reviewed code paths and can continue processing queued commands while running.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install craw-figma
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /craw-figma 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
craw-figma 1.0.0 - Initial release of full bidirectional Figma integration for reading with REST API and writing via local WebSocket connector and Figma plugin. - Supports real-time creation, modification, and deletion of layers in Figma Desktop. - Includes accessibility auditing, design token extraction, and asset export tools. - Provides auto-setup guidance for installation, plugin import, and connectivity testing. - Features comprehensive CLI commands for file read/write, auto layout, analysis, and generators.
元数据
Slug craw-figma
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Craw Figma 是什么?

Full bidirectional Figma integration — read files via REST API, create/modify/delete layers via local WebSocket connector + Figma plugin. Audit accessibility... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 41 次。

如何安装 Craw Figma?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install craw-figma」即可一键安装,无需额外配置。

Craw Figma 是免费的吗?

是的,Craw Figma 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Craw Figma 支持哪些平台?

Craw Figma 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Craw Figma?

由 missionarteemis-cloud(@missionarteemis-cloud)开发并维护,当前版本 v1.0.0。

💬 留言讨论