figma
БесплатноБез исполняемых скриптовНе проверенIntegrate with Figma API for design automation and code generation. Use when extracting design tokens, generating React/CSS code from Figma components…
Об этом скилле
Figma API Integration
Extract design data, generate code from components, and automate design workflows with Figma's API.
Quick Start
Authentication
const FIGMA_TOKEN = process.env.FIGMA_TOKEN;
const headers = {
'X-Figma-Token': FIGMA_TOKEN
};
// Get file
const response = await fetch(
`https://api.figma.com/v1/files/${FILE_KEY}`,
{ headers }
);
File Key & Node IDs
// Extract from Figma URL: figma.com/file/FILE_KEY/Name?node-id=NODE_ID
const figmaUrl = 'https://www.figma.com/file/abc123/MyDesign?node-id=1%3A2';
const fileKey = figmaUrl.match(/file\/([^/]+)/)?.[1]; // abc123
const nodeId = new URL(figmaUrl).searchParams.get('node-id'); // 1:2
Core API Endpoints
Get File
// Full file
GET https://api.figma.com/v1/files/:file_key
// Specific nodes (components)
GET https://api.figma.com/v1/files/:file_key/nodes?ids=1:2,1:3
// With geometry for SVG paths
GET https://api.figma.com/v1/files/:file_key?geometry=paths
// With plugin data
GET https://api.figma.com/v1/files/:file_key?plugin_data=shared
Get Components
// Get all components in a file
GET https://api.figma.com/v1/files/:file_key/components
// Get component sets (variants)
GET https://api.figma.com/v1/files/:file_key/component_sets
// Get team's published components
GET https://api.figma.com/v1/teams/:team_id/components
Export Images
// Export nodes as images
GET https://api.figma.com/v1/images/:file_key?ids=1:2,1:3&format=png&scale=2
// Export as SVG
GET https://api.figma.com/v1/images/:file_key?ids=1:2&format=svg
// Response
{
"images": {
"1:2": "https://s3.amazonaws.com/...",
"1:3": "https://s3.amazonaws.com/..."
}
}
Component Code Generation
Figma Node to React Component
interface FigmaNode {
id: string;
name: string;
type: string;
children?: FigmaNode[];
absoluteBoundingBox?: { x: number; y: number; width: number; height: number };
fills?: Fill[];
strokes?: Stroke[];
effects?: Effect[];
cornerRadius?: number;
paddingLeft?: number;
paddingRight?: number;
paddingTop?: number;
paddingBottom?: number;
itemSpacing?: number;
layoutMode?: 'HORIZONTAL' | 'VERTICAL' | 'NONE';
primaryAxisAlignItems?: string;
counterAxisAlignItems?: string;
characters?: string;
style?: TextStyle;
}
async function getComponentCode(fileKey: string, nodeId: string): Promise<string> {
const response = await fetch(
`https://api.figma.com/v1/files/${fileKey}/nodes?ids=${nodeId}`,
{ headers: { 'X-Figma-Token': process.env.FIGMA_TOKEN! } }
);
const data = await response.json();
const node = data.nodes[nodeId].document;
return generateReactComponent(node);
}
function generateReactComponent(node: FigmaNode): string {
const componentName = toPascalCase(node.name);
const styles = extractStyles(node);
const children = node.children?.map(child => generateJSX(child)).join('\n') || '';
return `
import React from 'react';
export function ${componentName}() {
return (
<div style={${JSON.stringify(styles, null, 2)}}>
${children}
</div>
);
}
`;
}
function extractStyles(node: FigmaNode): React.CSSProperties {
const styles: React.CSSProperties = {};
// Dimensions
if (node.absoluteBoundingBox) {
styles.width = node.absoluteBoundingBox.width;
styles.height = node.absoluteBoundingBox.height;
}
// Background
if (node.fills?.length) {
const fill = node.fills.find(f => f.visible !== false && f.type === 'SOLID');
if (fill?.color) {
styles.backgroundColor = rgbaToHex(fill.color);
}
}
// Border radius
if (node.cornerRadius) {
styles.borderRadius = node.cornerRadius;
}
// Padding
if (node.paddingLeft) styles.paddingLeft = node.paddingLeft;
if (node.paddingRight) styles.paddingRight = node.paddingRight;
if (node.paddingTop) styles.paddingTop = node.paddingTop;
if (node.paddingBottom) styles.paddingBottom = node.paddingBottom;
// Flexbox (Auto Layout)
if (node.layoutMode && node.layoutMode !== 'NONE') {
styles.display = 'flex';
styles.flexDirection = node.layoutMode === 'HORIZONTAL' ? 'row' : 'column';
styles.gap = node.itemSpacing;
// Alignment
const alignMap: Record<string, string> = {
'MIN': 'flex-start',
'CENTER': 'center',
'MAX': 'flex-end',
'SPACE_BETWEEN': 'space-between',
};
if (node.primaryAxisAlignItems) {
styles.justifyContent = alignMap[node.primaryAxisAlignItems] || 'flex-start';
}
if (node.counterAxisAlignItems) {
styles.alignItems = alignMap[node.counterAxisAlignItems] || 'flex-start';
}
}
return styles;
}
function generateJSX(node: FigmaNode): string {
const styles = extractStyles(node);
if (node.type === 'TEXT') {
return `<span style={${JSON.stringify(styles)}}>${node.characters || ''}</span>`;
}
if (node.type === 'VECTOR' || node.type === 'BOOLEAN_O
Установить figma в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл figma?
Integrate with Figma API for design automation and code generation. Use when extracting design tokens, generating React/CSS code from Figma components, syncing design systems, building Figma plugins, or automating design-to-code workflows. Triggers on Figma API, design tokens, Figma plugin, design-to-code, Figma export, Figma component, Dev Mode.
Как установить скилл figma?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл figma запускает скрипты?
Нет, скилл состоит только из инструкций (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