Help us improve
Share bugs, ideas, or general feedback.
From design-to-code
Extracts design tokens (colors, typography, spacing, shadows) from Figma, Sketch, Penpot files via MCP servers, normalizes to W3C format, and converts to CSS, Tailwind, or Swift.
npx claudepluginhub arustydev/agents --plugin design-to-codeHow this skill is triggered — by the user, by Claude, or both
Slash command
/design-to-code:design-tokens-extractionThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Extract and normalize design tokens from design files into standardized formats.
Extracts design tokens (colors, spacing, typography) and variables from Figma files via MCP server, generating CSS Custom Properties, TypeScript/JS objects, JSON, Tailwind config, and Style Dictionary formats for design systems.
Extracts design tokens including colors, typography, and spacing from Figma files via REST API. Converts to CSS custom properties, JSON, or Tailwind config for design-to-code pipelines.
Export Figma variables to design token files in DTCG, CSS custom properties, Tailwind v4/v3, SCSS, TypeScript, JSON, Style Dictionary, or Tokens Studio. Works on any Figma plan via Plugin API.
Share bugs, ideas, or general feedback.
Extract and normalize design tokens from design files into standardized formats.
This skill enables extraction of design tokens from Figma, Sketch, and Penpot design files using their respective MCP servers. Extracted tokens are normalized to the W3C Design Tokens Community Group format for platform-agnostic storage and conversion.
This skill covers:
This skill does NOT cover:
design-to-swiftui skill)| Server | Tool | Purpose |
|---|---|---|
figma | get_file | Read Figma file structure |
figma | get_styles | Extract published styles |
figma | get_local_variables | Extract variables/tokens |
sketch-context | get_document | Read Sketch document |
sketch-context | get_shared_styles | Extract shared styles |
sketch-context | get_color_assets | Extract color variables |
penpot | get_file | Read Penpot file |
penpot | get_components | List design components |
| Category | Properties Extracted |
|---|---|
| Color | hex, rgb, hsl, opacity, description |
| Typography | family, size, weight, lineHeight, letterSpacing |
| Spacing | value (px, rem), description |
| Shadow | color, offsetX, offsetY, blur, spread |
| Border Radius | value (px, rem) |
| Duration | value (ms) |
Determine the design source and use the appropriate MCP server:
Figma:
Use figma MCP server with get_file tool
Input: file_key from Figma URL (e.g., "abc123" from figma.com/file/abc123/...)
Sketch:
Use sketch-context MCP server with get_document tool
Input: file path to .sketch file
Penpot:
Use penpot MCP server with get_file tool
Input: project_id and file_id from Penpot URL
Query the MCP server for design tokens:
Colors:
get_styles, Sketch: get_shared_styles)get_local_variables, Sketch: get_color_assets)Typography:
Spacing:
Shadows:
Transform extracted data to W3C Design Tokens structure:
{
"$schema": "https://design-tokens.github.io/community-group/format/",
"color": {
"<category>": {
"<name>": {
"$value": "#hexcode",
"$type": "color",
"$description": "From design file"
}
}
},
"typography": {
"fontFamily": { ... },
"fontSize": { ... },
"fontWeight": { ... }
},
"spacing": { ... },
"shadow": { ... }
}
Use the appropriate output style:
design-token-json - W3C DTCG format (default)design-token-swift - Swift extensionsdesign-token-css - CSS custom propertiesdesign-token-tailwind - Tailwind configWhen reading from Figma:
Published Styles (preferred):
get_styles with style_type: "FILL"Variables (Figma variables):
get_local_variablesresolvedType: "COLOR"Component Fills (fallback):
When reading from Sketch:
Shared Styles:
get_shared_styles with style_type: "layer"Color Assets:
get_color_assetsDocument Colors:
When reading from Penpot:
Color Library:
Component Colors:
| Source Format | Target Format |
|---|---|
rgba(r, g, b, a) | #RRGGBBAA |
rgb(r, g, b) | #RRGGBB |
hsl(h, s%, l%) | #RRGGBB (converted) |
{ r, g, b } (0-1) | #RRGGBB (scaled) |
{ r, g, b } (0-255) | #RRGGBB |
| Property | Source Variations | Target |
|---|---|---|
| Font Size | 12px, 0.75rem, 12 | "0.75rem" or 12 |
| Font Weight | "bold", 700, "semibold" | 700 (numeric) |
| Line Height | 1.5, 150%, 24px | 1.5 (unitless ratio) |
| Letter Spacing | 0.5px, 0.02em | "0.02em" |
| Source Style | Target Style | Example |
|---|---|---|
color/primary/500 | color.primary.500 | Nested groups |
Primary Color | primaryColor | camelCase |
primary-color | primaryColor | camelCase |
PRIMARY_COLOR | primaryColor | camelCase |
Preserve source information for traceability:
{
"color": {
"primary": {
"$value": "#2196F3",
"$type": "color",
"$extensions": {
"com.figma": {
"variableId": "VariableID:1234",
"styleId": "S:abc123",
"collectionName": "Brand Colors"
}
}
}
}
}
Symptoms: Extraction returns empty or minimal tokens
Solution:
Symptoms: MCP server returns 401 or access denied
Solution:
FIGMA_ACCESS_TOKEN is set for FigmaSymptoms: Token names don't match expected format
Solution:
design-token-json style - W3C format outputdesign-token-swift style - Swift code outputdesign-to-swiftui skill - Generate SwiftUI views from tokensdesign-system-management skill - Manage token libraries