cris-achiardi/claude-skills/figma-variables-generator
Claude Code and agent skill by cris-achiardi/claude-skills
- community
Checking that the SKILL.md file is still in the repository.
Generate JSON files for creating Figma variable collections from text descriptions or design token data. Use when designers need to create or convert design tokens (colors, spacing, typography, etc.) into Figma variables format. Supports multiple modes (Light/Dark), code syntax definitions, variable references/aliases, and hierarchical organization. Triggers include requests to "create Figma variables", "generate variables JSON", "convert design tokens", or working with design system tokens.
Install
npx vskill@latest install cris-achiardi/claude-skills/figma-variables-generatorSKILL.md
Figma Variables Generator
Generate properly formatted JSON files for creating Figma variable collections from text descriptions, existing design token data, or images showing design systems.
Core Capabilities
This skill helps designers create Figma variable collections by generating the JSON format required by Figma variable import/export plugins. The output can be directly imported into Figma using plugins like "Variables Import Export" or similar tools.
Supported Variable Types
Figma supports only 4 core variable types:
- Color (
$type: "color") - RGB hex values, rgba, or variable references - Number (
$type: "number") - Numeric values (spacing, sizes, radius, weights, etc.) - String (
$type: "string") - Text values (font families, names, etc.) - Boolean (
$type: "boolean") - True/false values
Important: Types like spacing, borderRadius, fontSize, fontWeight should use number type. Use semantic naming in your variable paths to indicate their purpose (e.g., spacing.xs, radius.md, fontSize.body)
Key Features
- Multiple Modes: Support for different modes (e.g., Light/Dark themes)
- Variable References: Use
{collection.subcategory.variableName}syntax to reference other variables - Code Syntax: Optional platform-specific naming conventions (WEB, iOS, ANDROID)
- Hierarchical Organization: Group variables into collections, categories, and subcategories
- Flexible Input: Accept design tokens from text, structured data, or images
Workflow
Step 0: Check for Existing JSON (For Updates or Reformatting)
CRITICAL: When the user asks to update, add to, or reformat an existing JSON file, you MUST:
- Read the existing file first - Use the Read tool to load the current JSON
- Preserve all naming exactly - Collection names, category names, subcategory names, and variable names must match EXACTLY
- Understand Figma's behavior: Figma uses names as unique identifiers:
- Same name = overwrites/updates the variable
- Different name = creates a new variable/collection/category
- Maintain hierarchy - Keep the exact same nesting structure
- Reorder for readability - If JSON is messy or poorly organized, reorder it following the guidelines in Step 2.5
Example Scenario:
- Existing:
{"Spacing": {"space": {"sm": {"$type": "number", "$value": 8}}}} - User asks: "Add a medium spacing value"
- ✅ Correct: Add to existing structure:
{"Spacing": {"space": {"sm": {...}, "md": {...}}}} - ❌ Wrong: Create new structure:
{"Spacing": {"spacing": {"md": {...}}}}(creates duplicate category)
Step 1: Gather Information
Before generating the JSON, ask the user:
- New or Update: Is this a new collection or updating an existing one?
- If updating: Request the existing JSON file to preserve naming
- Collection Name: What should the variable collection be named?
- Variable Content: What variables need to be created? (Accept text descriptions, existing JSON, or analyze uploaded images)
- Modes: Does this collection need multiple modes (e.g., Light/Dark)? What should they be named?
- Code Syntax: Should code syntax be included? If yes:
- Which platforms? (WEB, iOS, ANDROID)
- What naming convention? (camelCase, snake_case, kebab-case, PascalCase)
- Organization: How should variables be organized? (category/subcategory structure)
Step 2: Generate JSON Structure
Create a JSON file following this structure:
Step 2.5: Format and Order for Readability
When generating or reformatting JSON, follow these ordering principles for maximum human readability:
1. Property Order within Each Variable:
2. Variable Ordering within Categories:
- Size-based: Order by size (xs → sm → md → lg → xl)
- Numeric: Order numerically (0 → 1 → 2 → 3...)
- Semantic priority: Order by importance (primary → secondary → tertiary)
- Alphabetical: Use as fallback when no other logic applies
3. Category Ordering: Order categories logically:
- Primitives/base values first (colors, raw values)
- Semantic/functional tokens second (text, background, border)
- Component-specific tokens last (button, card, modal)
4. Indentation and Formatting:
- Use 2-space indentation
- Each property on its own line
- Consistent spacing between objects
- No trailing commas
Example of Well-Ordered JSON:
Step 3: Generate the JSON File
Create a JSON file following this structure:
Step 4: Apply Naming Conventions
When code syntax is requested:
camelCase (default for WEB):
foreground.base→foregroundBasebackground.interactive.primary→backgroundInteractivePrimary
snake_case (common for Python, some backend systems):
foreground.base→foreground_basebackground.interactive.primary→background_interactive_primary
kebab-case (common for CSS):
foreground.base→foreground-basebackground.interactive.primary→background-interactive-primary
PascalCase (common for some component systems):
foreground.base→ForegroundBasebackground.interactive.primary→BackgroundInteractivePrimary
Step 5: Convert Units to Pixels
CRITICAL: Figma only works with pixel values. Always convert relative units to pixels:
Common Conversions (assuming 16px base font size):
1rem→16(pixels)2rem→32(pixels)0.875rem→14(pixels)1em→16(pixels, context-dependent)1.5em→24(pixels, context-dependent)
Percentage/Viewport Units (ask user for context if needed):
100%→ ask for parent container size50vw→ ask for viewport width or use common breakpoint10vh→ ask for viewport height or use common breakpoint
Other Units:
1pt→1.333(pixels)1pc→16(pixels, 1 pica = 12 points)
When encountering unit-based values, automatically convert to pixels without units in the JSON output.
Example:
- Input:
font-size: 1.5rem→ Output:"$value": 24 - Input:
spacing: 2rem→ Output:"$value": 32 - Input:
line-height: 1.5em→ Output:"$value": 24
Step 6: Handle Variable References
For variables that reference other variables (aliases), use the reference syntax:
The reference format is: {CollectionName.category.subcategory.variableName}
Examples
Example 1: Simple Color Tokens
Input: "Create a collection called 'Brand Colors' with primary (#389fba), secondary (#c9a0dc), and white (#ffffff) colors for light and dark modes"
Output:
Example 2: Spacing Scale with Code Syntax
Input: "Create a spacing scale collection with values 0, 8, 16, 24, 32px. Use camelCase for web."
Output:
Example 3: Unit Conversion from rem to pixels
Input: "Create typography tokens: body is 1rem, heading-sm is 1.25rem, heading-md is 1.5rem, heading-lg is 2rem"
Output:
Example 4: Semantic Colors with References
Input: "Create semantic colors that reference primitives. Text primary should use gray900 in light mode and gray100 in dark mode."
Output:
Example 5: Updating an Existing Collection
Existing JSON:
User Request: "Add medium (16px) and large (24px) spacing values"
Correct Output (preserves naming and structure):
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/figma-variables-generator/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/cris-achiardi/claude-skills/figma-variables-generator)