Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Export images, icons, and assets from Figma files via the REST API. Use when building an asset pipeline, exporting icons as SVG/PNG, or rendering frames to images for documentation or previews. Trigger with phrases like "figma export", "figma images", "export figma icons", "figma assets", "figma render".
.claude/skills/jeremylongshore-figma-core-workflow-b/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 2% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 118% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 65% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 97% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 247% | 0% |
Export images, icons, and assets from Figma files using the REST API. Render specific nodes as PNG, SVG, JPG, or PDF. Build automated asset pipelines for icons, illustrations, and component previews.
figma-install-auth setupfigma-hello-world)FIGMA_PAT and FIGMA_FILE_KEY env vars settypescriptconst PAT = process.env.FIGMA_PAT!; const FILE_KEY = process.env.FIGMA_FILE_KEY!; // GET /v1/images/:file_key?ids=X,Y&format=png&scale=2 // Supported formats: png, svg, jpg, pdf // Scale: 0.01 to 4 (SVG always exports at 1x) // Max image size: 32 megapixels (larger images are auto-scaled down) async function exportImages( nodeIds: string[], format: 'png' | 'svg' | 'jpg' | 'pdf' = 'png', scale = 2 ): Promise<Record<string, string | null>> { const params = new URLSearchParams({ ids: nodeIds.join(','), format, scale: String(format === 'svg' ? 1 : scale), // SVG is always 1x }); const res = await fetch( `https://api.figma.com/v1/images/${FILE_KEY}?${params}`, { headers: { 'X-Figma-Token': PAT } } ); if (!res.ok) throw new Error(`Image export failed: ${res.status}`); const data = await res.json(); // data.images: { "nodeId": "https://..." | null } // null means the node failed to render (invisible, 0% opacity, or invalid ID) // URLs expire after 30 days return data.images; }
typescriptimport { writeFileSync, mkdirSync } from 'fs'; import { join } from 'path'; async function downloadAssets( nodeIds: string[], outputDir: string, format: 'png' | 'svg' = 'svg' ) { mkdirSync(outputDir, { recursive: true }); const imageUrls = await exportImages(nodeIds, format); const results: { nodeId: string; path: string; success: boolean }[] = []; for (const [nodeId, url] of Object.entries(imageUrls)) { if (!url) { console.warn(`Node ${nodeId}: render returned null (invisible or invalid)`); results.push({ nodeId, path: '', success: false }); continue; } const res = await fetch(url); const buffer = Buffer.from(await res.arrayBuffer()); const filename = `${nodeId.replace(':', '-')}.${format}`; const filepath = join(outputDir, filename); writeFileSync(filepath, buffer); results.push({ nodeId, path: filepath, success: true }); } return results; }
typescript// Find all COMPONENT children in an "Icons" frame, then export each as SVG async function exportIconsFromFrame(frameNodeId: string) { // Fetch the frame and its children const res = await fetch( `https://api.figma.com/v1/files/${FILE_KEY}/nodes?ids=${frameNodeId}`, { headers: { 'X-Figma-Token': PAT } } ); const data = await res.json(); const frame = data.nodes[frameNodeId]?.document; if (!frame?.children) throw new Error('Frame has no children'); // Collect component node IDs const iconIds = frame.children .filter((n: any) => n.type === 'COMPONENT' || n.type === 'INSTANCE') .map((n: any) => n.id); console.log(`Found ${iconIds.length} icons to export`); // Export as SVG (batch -- up to 100 IDs per request) const batchSize = 100; for (let i = 0; i < iconIds.length; i += batchSize) { const batch = iconIds.slice(i, i + batchSize); await downloadAssets(batch, './assets/icons', 'svg'); } }
typescript// Use component metadata for better filenames async function exportNamedIcons(frameNodeId: string) { const fileRes = await fetch( `https://api.figma.com/v1/files/${FILE_KEY}/nodes?ids=${frameNodeId}`, { headers: { 'X-Figma-Token': PAT } } ); const fileData = await fileRes.json(); const frame = fileData.nodes[frameNodeId].document; // Build nodeId -> name map const nameMap = new Map<string, string>(); for (const child of frame.children ?? []) { const safeName = child.name .toLowerCase() .replace(/[^a-z0-9]+/g, '-') .replace(/^-|-$/g, ''); nameMap.set(child.id, safeName); } // Export const nodeIds = Array.from(nameMap.keys()); const imageUrls = await exportImages(nodeIds, 'svg'); mkdirSync('./assets/icons', { recursive: true }); for (const [nodeId, url] of Object.entries(imageUrls)) { if (!url) continue; const name = nameMap.get(nodeId) ?? nodeId.replace(':', '-'); const res = await fetch(url); const svg = await res.text(); writeFileSync(`./assets/icons/${name}.svg`, svg); console.log(`Exported: ${name}.svg`); } }
| Error | Cause | Solution | |-------|-------|----------| | null in images map | Node is invisible or has 0% opacity | Make node visible in Figma | | 400 Bad Request | Invalid node ID format | Use pageId:nodeId format (e.g., 0:1) | | 429 Rate Limited | Images endpoint is Tier 1 | Batch requests, honor Retry-After | | Image URL expired | URLs expire after 30 days | Re-export; do not cache URLs long-term | | SVG has scale > 1 | SVG ignores scale param | SVG always exports at 1x |
bash# Export a single node as PNG at 2x curl -s -H "X-Figma-Token: ${FIGMA_PAT}" \ "https://api.figma.com/v1/images/${FIGMA_FILE_KEY}?ids=0:1&format=png&scale=2" \ | jq -r '.images["0:1"]' # Returns a temporary URL to the rendered image
For common errors, see figma-common-errors.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 15,345 | 9,036 | -41% | 1 | 1 | 0% | 3,370 | 3,426 | +2% | 0 | 0 | — |
case-02 | fail→pass | 8,070 | 8,119 | +1% | 1 | 1 | 0% | 1,515 | 3,296 | +118% | 0 | 0 | — |
case-03 | fail→pass | 14,008 | 8,643 | -38% | 1 | 1 | 0% | 2,132 | 3,514 | +65% | 0 | 0 | — |
case-04 | pass→pass | 5,737 | 3,681 | -36% | 1 | 1 | 0% | 1,037 | 2,533 | +144% | 0 | 0 | — |
case-05 | pass→pass | 9,781 | 5,663 | -42% | 1 | 1 | 0% | 1,831 | 2,919 | +59% | 0 | 0 | — |
case-06 | pass→pass | 16,699 | 10,075 | -40% | 1 | 1 | 0% | 2,379 | 3,481 | +46% | 0 | 0 | — |
case-07 | fail→pass | 11,196 | 6,878 | -39% | 1 | 1 | 0% | 1,567 | 3,093 | +97% | 0 | 0 | — |
case-08 | pass→pass | 18,755 | 12,180 | -35% | 1 | 1 | 0% | 3,849 | 4,193 | +9% | 0 | 0 | — |
case-09 | pass→pass | 3,603 | 2,208 | -39% | 1 | 1 | 0% | 613 | 2,228 | +263% | 0 | 0 | — |
case-10 | pass→pass | 12,025 | 4,701 | -61% | 1 | 1 | 0% | 2,074 | 2,550 | +23% | 0 | 0 | — |
case-11 | pass→pass | 14,066 | 7,258 | -48% | 1 | 1 | 0% | 2,021 | 3,133 | +55% | 0 | 0 | — |
case-12 | pass→pass | 9,852 | 5,484 | -44% | 1 | 1 | 0% | 1,715 | 2,660 | +55% | 0 | 0 | — |
case-13 | pass→pass | 3,834 | 1,954 | -49% | 1 | 1 | 0% | 584 | 2,139 | +266% | 0 | 0 | — |
case-14 | pass→pass | 10,867 | 3,501 | -68% | 1 | 1 | 0% | 1,692 | 2,585 | +53% | 0 | 0 | — |
case-15 | pass→pass | 5,969 | 1,959 | -67% | 1 | 1 | 0% | 1,021 | 2,160 | +112% | 0 | 0 | — |
case-16 | fail→pass | 4,075 | 1,686 | -59% | 1 | 1 | 0% | 620 | 2,154 | +247% | 0 | 0 | — |
case-17 | pass→pass | 5,753 | 2,492 | -57% | 1 | 1 | 0% | 987 | 2,293 | +132% | 0 | 0 | — |
case-18 | fail→pass | 11,725 | 23,086 | +97% | 1 | 1 | 0% | 2,028 | 3,233 | +59% | 0 | 0 | — |
case-19 | pass→pass | 6,293 | 2,900 | -54% | 1 | 1 | 0% | 933 | 2,375 | +155% | 0 | 0 | — |
case-20 | pass→pass | 2,449 | 2,723 | +11% | 1 | 1 | 0% | 432 | 2,306 | +434% | 0 | 0 | — |
case-21 | pass→pass | 7,579 | 7,018 | -7% | 1 | 1 | 0% | 1,457 | 2,954 | +103% | 0 | 0 | — |
case-22 | pass→pass | 10,786 | 7,962 | -26% | 1 | 1 | 0% | 1,528 | 3,300 | +116% | 0 | 0 | — |
case-23 | pass→pass | 5,422 | 9,275 | +71% | 1 | 1 | 0% | 998 | 3,231 | +224% | 0 | 0 | — |
case-24 | pass→pass | 13,412 | 13,968 | +4% | 1 | 1 | 0% | 2,695 | 4,739 | +76% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted. The headline lift of +25 percentage points is the difference between those two pass rates over the 24 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.