Extract design assets and metadata from Figma using the Figma REST API. Supports exporting frames/components as images, extracting node metadata, design tokens, and file structure...
Extract design assets, metadata, and specifications from Figma files using the Figma REST API.
Obtain a Figma Personal Access Token:
The skill checks for FIGMA_ACCESS_TOKEN in this order:
export FIGMA_ACCESS_TOKEN="your-token".env.claude/.env.claude/skills/.env.claude/skills/figma-analyzer/.envpip install requests python-dotenv
Figma URLs contain the file key and optional node ID:
https://www.figma.com/file/{file_key}/{file_name}?node-id={node_id}
https://www.figma.com/design/{file_key}/{file_name}?node-id={node_id}
Examples:
https://www.figma.com/file/ABC123/MyDesignhttps://www.figma.com/file/ABC123/MyDesign?node-id=1-234python scripts/figma_export.py \
--url "https://www.figma.com/file/ABC123/Design?node-id=1-234" \
--output docs/research/ui/design.png \
--scale 2
python scripts/figma_export.py \
--url "https://www.figma.com/file/ABC123/Design" \
--metadata-only \
--output docs/research/ui/figma-metadata.json
python scripts/figma_export.py \
--url "https://www.figma.com/file/ABC123/Design" \
--extract-tokens \
--output docs/research/ui/design-tokens.json
python scripts/figma_export.py \
--url "https://www.figma.com/file/ABC123/Design" \
--node-ids "1-234,1-235,1-236" \
--output docs/research/ui/frames/ \
--scale 2
| Endpoint | Purpose |
|---|---|
| GET /v1/files/:key | Get file metadata and structure |
| GET /v1/files/:key/nodes | Get specific node data |
| GET /v1/images/:key | Export nodes as images |
| GET /v1/files/:key/styles | Get published styles |
| GET /v1/files/:key/components | Get published components |
{
"file_key": "ABC123",
"name": "My Design",
"last_modified": "2024-01-15T10:30:00Z",
"thumbnail_url": "https://...",
"nodes": {
"1-234": {
"name": "Hero Section",
"type": "FRAME",
"absoluteBoundingBox": {
"x": 0, "y": 0,
"width": 1440, "height": 800
},
"children": [...]
}
}
}
{
"colors": {
"primary": {"value": "#3B82F6", "name": "Blue 500"},
"secondary": {"value": "#10B981", "name": "Green 500"}
},
"typography": {
"heading-1": {
"fontFamily": "Inter",
"fontSize": 48,
"fontWeight": 700,
"lineHeight": 1.2
}
},
"effects": {
"shadow-md": {
"type": "DROP_SHADOW",
"offset": {"x": 0, "y": 4},
"radius": 6,
"color": "rgba(0,0,0,0.1)"
}
},
"spacing": {
"xs": 4, "sm": 8, "md": 16, "lg": 24, "xl": 32
}
}
After exporting images, use ai-multimodal for visual analysis:
# Step 1: Export from Figma
python .claude/skills/figma-analyzer/scripts/figma_export.py \
--url "$FIGMA_URL" \
--output docs/research/ui/design.png \
--scale 2
# Step 2: Analyze with Gemini Vision
python .claude/skills/ai-multimodal/scripts/gemini_batch_process.py \
--files docs/research/ui/design.png \
--task analyze \
--prompt "Analyze layout and extract component specifications" \
--output docs/research/ui/analysis.md \
--model gemini-2.5-flash
| Error Code | Meaning | Resolution |
|---|---|---|
| 400 | Bad request | Check URL format and node IDs |
| 403 | Forbidden | Verify access token and file permissions |
| 404 | Not found | Check file key and node ID exist |
| 429 | Rate limited | Implement backoff, wait and retry |
| 500 | Server error | Retry with exponential backoff |
This skill is designed to work with:
Main script for Figma API interaction:
python scripts/figma_export.py --help
Options:
--url Figma file or frame URL (required)
--output Output path for images/data
--scale Export scale (1, 2, 3, 4)
--format Export format (png, jpg, svg, pdf)
--node-ids Comma-separated node IDs to export
--metadata-only Only fetch metadata, no image export
--extract-tokens Extract design tokens
--verbose Enable verbose output