Figma Variables Tokens Generator
Generate production-ready Figma Variables JSON ZIPs that import with zero errors.
Approach each system as both senior product designer and senior frontend engineer.
Enforce ID stability across modes and absolute path normalization throughout.
Non-Negotiable Generation Invariants
These rules apply to every architecture, every collection, every naming style, and every user input combination.
One canonical token path per variable
- A token path must have exactly one canonical representation across:
- planning/data maps
prebuild_ids()
create_token()
- emitted JSON nesting keys
aliasData.targetVariableName
- validation registries
- Never preserve one casing in JSON and a different casing in the registry.
- Never let alias targets be normalized differently from emitted variable names.
Variable paths are architecture data, not code syntax
com.figma.codeSyntax may be camelCase, kebab-case, CSS custom properties, Android, or iOS.
- The token path itself must remain a stable collection path.
- Do not convert token paths to match code syntax conventions.
- Preserve semantic separators exactly as required by the references: for example
link-hover, on-brand, on-surface-variant, lineHeight, letterSpacing, borderWidth, minWidth, maxWidth.
Literal path preservation
- When a reference file defines a path literally, emit that path literally.
- Do not silently rewrite kebab-case to camelCase or remove hyphens from semantic names.
- Component and custom collections may introduce new paths, but once chosen, that spelling must remain identical end-to-end.
Artifact-level validation is mandatory
- Do not trust only the internal registry.
- After building all files, flatten the actual emitted JSON keys from every collection and validate every alias target against those emitted paths.
- A build is not safe unless the emitted JSON graph and the internal registry agree exactly.
Scope correctness is mandatory
- Validate scopes from the emitted artifact, not just helper intent.
text/* and all text-role descendants must resolve to TEXT_FILL.
border/* and border-role descendants must resolve to STROKE.
icon/* must resolve to SHAPE_FILL + STROKE.
shadow/*/color must resolve to EFFECT_COLOR.
- Numerical typography paths must resolve to
FONT_SIZE, LINE_HEIGHT, LETTER_SPACING.
- If a path is ambiguous, add an explicit rule before generating. Never rely on a broad fill fallback for semantic text or border tokens.
Coverage floors are contractual
- If the user selected Lean, Standard, or Enterprise, the generated token inventory must satisfy that density floor in the relevant references.
- Do not under-generate because a manual data map happened to stop early.
- Theme/Semantic/Component outputs must be derived from the required path inventories first, then extended as needed.
Backfilling prevents absence, not identity drift
- Backfill missing parent values before saving parent collections.
- But do not assume backfilling solves path-casing, path-spelling, or alias-name mismatches.
- Missing token and mismatched token are different failure classes and must be validated separately.
Output format: Deliver only .zip files containing the JSON tokens. Do not output .skill files or dump raw Python scripts — users expect ready-to-import ZIPs, not code, and dumping scripts into the chat causes context truncation that breaks the generation.
Local IDE / CLI Output Rule
When running in a local IDE or CLI workspace:
- Always create an
exports/ folder if it does not exist
- Save the final token ZIP inside
exports/
- Do not scatter generated artifacts in the project root
- Do not create extra manifests, debug JSON files, helper reports, or generator scripts unless the user explicitly asked for them or they are required to recover from a generation failure
Default expectation:
- one final ZIP in
exports/
- minimal additional files
Read Order — STAGED LOADING
To prevent context pollution, read only the files required for your current load stage:
Load Stage 1: Discovery & Strategy (Read at Turn 1)
| # |
File |
Purpose |
| 1 |
instructions/01-interview-setup.md |
Initial setup & Turns 1–3 |
| 2 |
instructions/02-questionnaire-and-generation.md |
Questionnaire Turns 4–10, generation |
| 3 |
references/01-architecture.md |
Mandatory Strategy: Understanding Tiers and alias rules. |
Load Stage 2: Architecture Confirmation (Read before Phase 2)
| # |
File |
Purpose |
| 4 |
references/05a-collections-core.md |
Design specs for Core collections |
| 5 |
references/05b-collections-semantic-components.md |
Design specs for Semantic/Component collections |
Load Stage 3: Generation Logic (Read before Phase 3)
| # |
File |
Purpose |
| 6 |
references/02-scoping-rules.md |
Technical scoping tables |
| 7 |
references/03-json-format.md |
Exact W3C JSON structure |
| 8 |
references/04-primitives.md |
Raw hex/spacing/font data |
| 9 |
references/06-generator-utility.md |
Python generation script patterns |
| 10 |
scripts/generator_core.py |
Executable Python engine (for local/IDE environments) |
Load Stage 4: Delivery & Handoff (Read after ZIP delivery and token count reporting are complete)
| # |
File |
Purpose |
| 11 |
instructions/03-import-and-handoff.md |
Import guide & ZIP reference table |
Do not read Load Stage 3 implementation files (scoping rules, JSON format, generator utility) until the interview is 100% complete. Reading them early fills context with technical data that is not needed yet.
1---2name: figma-variables-tokens-generator3description: Generate a fully connected design token system instantly from a chat prompt. Supports everything from a simple 1-tier flat architecture, to 2/3-tier systems (Primitives, Semantic with light/dark modes, Component Colors), all the way up to an enterprise 4-tier setup (Primitives, Theme, Semantic, Component Colors + optional collections). The AI will use a dedicated plugin ([Variables Tokens Collections Importer](https://www.figma.com/community/plugin/1619733963699677957)) to instantly get all your variables cleanly generated. View the full documentation and repository to learn more: https://github.com/Shanmus4/figma-variables-tokens-generator. Triggered when user asks to create Figma variables, design tokens, a design system, "Figma token export", "variables for Figma", or any request to set up colours/spacing/ typography as Figma variables.4---56# Figma Variables Tokens Generator78Generate production-ready Figma Variables JSON ZIPs that import with zero errors.9Approach each system as both senior product designer and senior frontend engineer.10Enforce ID stability across modes and absolute path normalization throughout.1112## Non-Negotiable Generation Invariants1314These rules apply to every architecture, every collection, every naming style, and every user input combination.15161. **One canonical token path per variable**17 - A token path must have exactly one canonical representation across:18 - planning/data maps19 - `prebuild_ids()`20 - `create_token()`21 - emitted JSON nesting keys22 - `aliasData.targetVariableName`23 - validation registries24 - Never preserve one casing in JSON and a different casing in the registry.25 - Never let alias targets be normalized differently from emitted variable names.26272. **Variable paths are architecture data, not code syntax**28 - `com.figma.codeSyntax` may be camelCase, kebab-case, CSS custom properties, Android, or iOS.29 - The token path itself must remain a stable collection path.30 - Do not convert token paths to match code syntax conventions.31 - Preserve semantic separators exactly as required by the references: for example `link-hover`, `on-brand`, `on-surface-variant`, `lineHeight`, `letterSpacing`, `borderWidth`, `minWidth`, `maxWidth`.32333. **Literal path preservation**34 - When a reference file defines a path literally, emit that path literally.35 - Do not silently rewrite kebab-case to camelCase or remove hyphens from semantic names.36 - Component and custom collections may introduce new paths, but once chosen, that spelling must remain identical end-to-end.37384. **Artifact-level validation is mandatory**39 - Do not trust only the internal registry.40 - After building all files, flatten the actual emitted JSON keys from every collection and validate every alias target against those emitted paths.41 - A build is not safe unless the emitted JSON graph and the internal registry agree exactly.42435. **Scope correctness is mandatory**44 - Validate scopes from the emitted artifact, not just helper intent.45 - `text/*` and all text-role descendants must resolve to `TEXT_FILL`.46 - `border/*` and border-role descendants must resolve to `STROKE`.47 - `icon/*` must resolve to `SHAPE_FILL` + `STROKE`.48 - `shadow/*/color` must resolve to `EFFECT_COLOR`.49 - Numerical typography paths must resolve to `FONT_SIZE`, `LINE_HEIGHT`, `LETTER_SPACING`.50 - If a path is ambiguous, add an explicit rule before generating. Never rely on a broad fill fallback for semantic text or border tokens.51526. **Coverage floors are contractual**53 - If the user selected Lean, Standard, or Enterprise, the generated token inventory must satisfy that density floor in the relevant references.54 - Do not under-generate because a manual data map happened to stop early.55 - Theme/Semantic/Component outputs must be derived from the required path inventories first, then extended as needed.56577. **Backfilling prevents absence, not identity drift**58 - Backfill missing parent values before saving parent collections.59 - But do not assume backfilling solves path-casing, path-spelling, or alias-name mismatches.60 - Missing token and mismatched token are different failure classes and must be validated separately.6162**Output format:** Deliver only `.zip` files containing the JSON tokens. Do not output `.skill` files or dump raw Python scripts — users expect ready-to-import ZIPs, not code, and dumping scripts into the chat causes context truncation that breaks the generation.6364## Local IDE / CLI Output Rule6566When running in a local IDE or CLI workspace:67- Always create an `exports/` folder if it does not exist68- Save the final token ZIP inside `exports/`69- Do not scatter generated artifacts in the project root70- Do not create extra manifests, debug JSON files, helper reports, or generator scripts unless the user explicitly asked for them or they are required to recover from a generation failure7172Default expectation:73- one final ZIP in `exports/`74- minimal additional files7576## Read Order — STAGED LOADING7778To prevent context pollution, read only the files required for your current load stage:7980### Load Stage 1: Discovery & Strategy (Read at Turn 1)81| # | File | Purpose |82|---|------|---------|83| 1 | `instructions/01-interview-setup.md` | Initial setup & Turns 1–3 |84| 2 | `instructions/02-questionnaire-and-generation.md` | Questionnaire Turns 4–10, generation |85| 3 | `references/01-architecture.md` | **Mandatory Strategy:** Understanding Tiers and alias rules. |8687### Load Stage 2: Architecture Confirmation (Read before Phase 2)88| # | File | Purpose |89|---|------|---------|90| 4 | `references/05a-collections-core.md` | Design specs for Core collections |91| 5 | `references/05b-collections-semantic-components.md` | Design specs for Semantic/Component collections |9293### Load Stage 3: Generation Logic (Read before Phase 3)94| # | File | Purpose |95|---|------|---------|96| 6 | `references/02-scoping-rules.md` | Technical scoping tables |97| 7 | `references/03-json-format.md` | Exact W3C JSON structure |98| 8 | `references/04-primitives.md` | Raw hex/spacing/font data |99| 9 | `references/06-generator-utility.md` | Python generation script patterns |100| 10 | `scripts/generator_core.py` | Executable Python engine (for local/IDE environments) |101102### Load Stage 4: Delivery & Handoff (Read after ZIP delivery and token count reporting are complete)103| # | File | Purpose |104|---|------|---------|105| 11| `instructions/03-import-and-handoff.md` | Import guide & ZIP reference table |106107> Do not read Load Stage 3 implementation files (scoping rules, JSON format, generator utility) until the interview is 100% complete. Reading them early fills context with technical data that is not needed yet.