figma-api
БесплатноБез исполняемых скриптовНе проверенThe Figma REST API returns design files as JSON and renders nodes to images. Use it to read files, export icons and images, list published components, extract…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Figma API
Overview
The Figma REST API (base URL https://api.figma.com) exposes every file as a tree of nodes in JSON, renders nodes to PNG, JPG, SVG or PDF, lists published components and styles, and manages comments and webhooks. This skill covers the read-oriented workflows used for developer handoff: fetch a file, extract styles into tokens, export assets, and react to changes. The machine-readable contract is the OpenAPI spec in the figma/rest-api-spec repository.
Instructions
Authentication. Send the token in the X-Figma-Token header. Create a personal access token in Figma under Settings, Security, "Generate new token"; you choose an expiration and scopes, and the value is shown once. Scopes needed here: file_content:read (file JSON and image rendering), library_content:read (published components and styles), webhooks:write and webhooks:read. The older files:read scope still works but is deprecated and broad. For organization automation such as CI use a plan access token (Organization and Enterprise plans); for apps acting on behalf of other users use an OAuth app, which sends an Authorization: Bearer header carrying the OAuth access token. Keep the token in an environment variable, never in code or in the repository.
export FIGMA_TOKEN="figd_..." # personal access token, scopes above
export FIGMA_WEBHOOK_PASSCODE="$(openssl rand -hex 16)"
File key and node ids. The key is the part of the file URL after /design/ (or /file/): https://www.figma.com/design/hP3kQw8mZxT2nVbR4cYdLs/Icons?node-id=12-34 (key hP3kQw8mZxT2nVbR4cYdLs). In the URL a node id is written 12-34; the API wants 12:34.
Endpoints used here:
| Task | Request |
|---|---|
| File JSON | GET /v1/files/:key with optional ids, depth, geometry=paths, version |
| Subset of a file | GET /v1/files/:key/nodes?ids=12:34,56:78 |
| Render images | GET /v1/images/:key?ids=...&format=png|jpg|svg|pdf&scale=0.01-4 |
| Published components | GET /v1/files/:key/components (main file key, not a branch) |
| Published styles | GET /v1/files/:key/styles |
| Webhooks | POST /v2/webhooks, GET /v2/webhooks?context=team&context_id=... |
Variables (/v1/files/:key/variables/local) are available only to full members of Enterprise organizations.
Rate limits. Limits depend on the seat type, the endpoint tier and the plan of the file. GET file, GET file nodes and GET images are Tier 1: on a View or Collab seat only about 20 requests per month, on a Dev or Full seat a per-minute budget of 10 (Starter), 15 (Professional) or 20 (Organization, Enterprise) requests. Limits follow the plan the file lives in, and Figma's own example cites a Starter-plan file limited to 6 requests per month, so cache hard. A limited request returns HTTP 429 with Retry-After (seconds), X-Figma-Plan-Tier, X-Figma-Rate-Limit-Type and X-Figma-Upgrade-Link headers. Fetch large files once, use ids and depth to narrow requests, and cache results.
Examples
Example 1: Pull color and text styles into a tokens object
User request: "Read our design system file and give me the color and typography tokens as JSON"
// src/figma/client.ts — authenticated GET helper with 429 handling.
const FIGMA_BASE = process.env.FIGMA_API_BASE ?? 'https://api.figma.com';
export async function figmaGet<T>(path: string, params: Record<string, string> = {}): Promise<T> {
const token = process.env.FIGMA_TOKEN;
if (!token) throw new Error('Set FIGMA_TOKEN (a personal access token with file_content:read)');
const url = new URL(path, FIGMA_BASE);
for (const [key, value] of Object.entries(params)) url.searchParams.set(key, value);
for (let attempt = 0; attempt < 4; attempt++) {
const res = await fetch(url, { headers: { 'X-Figma-Token': token } });
if (res.status === 429) {
const wait = Number(res.headers.get('Retry-After') ?? '30');
if (wait > 120) throw new Error(`Rate limited for ${wait}s (${res.headers.get('X-Figma-Rate-Limit-Type')}); try later or use a seat with a higher limit`);
await new Promise((r) => setTimeout(r, wait * 1000));
continue;
}
if (!res.ok) throw new Error(`Figma API ${res.status} on ${url.pathname}: ${await res.text()}`);
return (await res.json()) as T;
}
throw new Error(`Figma API still rate limited after retries: ${url.pathname}`);
}
// src/figma/tokens.ts — collect color and text styles from a file response.
interface FileResponse {
document: any;
styles: Record<string, { name: string; styleType: 'FILL' | 'TEXT' | 'EFFECT' | 'GRID' }>;
}
export interface DesignTokens {
colors: Record<string, string>;
typography: Record<string, { fontFamily: string; fontSize: number; fontWeight: number; lineHeightPx?: number }>;
}
const toHex = (v: number) => Math.round(v * 255).toString(16).padStart(2, '0');
function paintToHex(paint: { color: { r: number; g: number;
Установить figma-api в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл figma-api?
The Figma REST API returns design files as JSON and renders nodes to images. Use it to read files, export icons and images, list published components, extract color and text styles as design tokens, and receive webhooks when files change. Use when the user asks to automate design handoff, sync Figma styles to code, export assets from Figma in a script or CI job, or integrate Figma with a build pipeline. Trigger words: figma api, figma token, figma export, design tokens, figma webhook.
Как установить скилл figma-api?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл figma-api запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic