figma-migration-deep-dive
БесплатноБез исполняемых скриптовНе проверенMigrate design systems between Figma files, or from other tools to Figma via API. Use when migrating design tokens between files, syncing variables across…
от jeremylongshore★ 2 961 звезда на GitHubОб этом скилле
Figma Migration Deep Dive
Overview
Automate migration of design data between Figma files, from other tools to Figma, or from Figma styles to the Variables API. Covers inventory, extraction, transformation, and validation.
Prerequisites
- Source and destination Figma file keys
FIGMA_PATwithfile_content:readandfile_variables:write(Enterprise) scopes- Understanding of source file structure
Instructions
Step 1: Inventory Source File
const PAT = process.env.FIGMA_PAT!;
async function inventoryFile(fileKey: string) {
const res = await fetch(
`https://api.figma.com/v1/files/${fileKey}`,
{ headers: { 'X-Figma-Token': PAT } }
);
const file = await res.json();
const inventory = {
name: file.name,
pages: file.document.children.map((p: any) => p.name),
componentCount: Object.keys(file.components).length,
styleCount: Object.keys(file.styles).length,
styles: {
fills: Object.values(file.styles).filter((s: any) => s.style_type === 'FILL').length,
text: Object.values(file.styles).filter((s: any) => s.style_type === 'TEXT').length,
effects: Object.values(file.styles).filter((s: any) => s.style_type === 'EFFECT').length,
grids: Object.values(file.styles).filter((s: any) => s.style_type === 'GRID').length,
},
};
// Count total nodes
let nodeCount = 0;
function countNodes(node: any) {
nodeCount++;
if (node.children) node.children.forEach(countNodes);
}
countNodes(file.document);
(inventory as any).totalNodes = nodeCount;
return inventory;
}
// Usage
const inv = await inventoryFile(process.env.FIGMA_FILE_KEY!);
console.log(`File: ${inv.name}`);
console.log(`Pages: ${inv.pages.join(', ')}`);
console.log(`Components: ${inv.componentCount}, Styles: ${inv.styleCount}`);
console.log(`Total nodes: ${(inv as any).totalNodes}`);
Step 2: Extract Styles from Source
async function extractAllStyles(fileKey: string) {
const file = await fetch(
`https://api.figma.com/v1/files/${fileKey}`,
{ headers: { 'X-Figma-Token': PAT } }
).then(r => r.json());
const styleNodeIds = Object.keys(file.styles);
const nodesRes = await fetch(
`https://api.figma.com/v1/files/${fileKey}/nodes?ids=${styleNodeIds.join(',')}`,
{ headers: { 'X-Figma-Token': PAT } }
).then(r => r.json());
const extracted = [];
for (const [nodeId, styleMeta] of Object.entries(file.styles) as any[]) {
const node = nodesRes.nodes[nodeId]?.document;
if (!node) continue;
extracted.push({
name: styleMeta.name,
type: styleMeta.style_type,
nodeId,
data: {
fills: node.fills,
strokes: node.strokes,
effects: node.effects,
style: node.style, // typography
characters: node.characters,
},
});
}
return extracted;
}
Step 3: Transform and Map to Target
// Map extracted styles to design tokens JSON
interface MigrationToken {
name: string;
category: 'color' | 'typography' | 'effect';
source: { file: string; nodeId: string };
value: any;
}
function transformStyles(styles: any[], sourceFileKey: string): MigrationToken[] {
return styles.map(style => {
switch (style.type) {
case 'FILL':
const fill = style.data.fills?.[0];
return {
name: style.name,
category: 'color' as const,
source: { file: sourceFileKey, nodeId: style.nodeId },
value: fill?.color
? {
r: Math.round(fill.color.r * 255),
g: Math.round(fill.color.g * 255),
b: Math.round(fill.color.b * 255),
a: fill.color.a ?? 1,
}
: null,
};
case 'TEXT':
return {
name: style.name,
category: 'typography' as const,
source: { file: sourceFileKey, nodeId: style.nodeId },
value: style.data.style
? {
fontFamily: style.data.style.fontFamily,
fontSize: style.data.style.fontSize,
fontWeight: style.data.style.fontWeight,
lineHeight: style.data.style.lineHeightPx,
}
: null,
};
default:
return {
name: style.name,
category: 'effect' as const,
source: { file: sourceFileKey, nodeId: style.nodeId },
value: style.data.effects,
};
}
}).filter(t => t.value !== null);
}
Step 4: Write to Target (Variables API)
// Enterprise only: create variables in the target file
async function migrateToVariables(
targetFileKey: string,
tokens: MigrationToken[]
) {
const colorTokens = tokens.filter(t => t.category === 'color');
// Create variable collection and variables
const payload = {
variableCollections: [{
action: 'CREATE' as const,
id: 'temp_collection_1',
name: 'Migrated Colors',
}],
variables: co
Установить figma-migration-deep-dive в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditBash(npm:*)Bash(node:*)Вложенные файлы
FAQ
Что делает скилл figma-migration-deep-dive?
Migrate design systems between Figma files, or from other tools to Figma via API. Use when migrating design tokens between files, syncing variables across libraries, or building automated migration pipelines for Figma. Trigger with phrases like "migrate figma", "figma migration", "move figma library", "figma file migration", "sync figma files".
Как установить скилл figma-migration-deep-dive?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл figma-migration-deep-dive запускает скрипты?
Нет, скилл состоит только из инструкций (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