figma-import-tokens
Skill83 starsChanged 6 months agoMITView on GitHub
Push design tokens from code INTO Figma as variables — DTCG / tokens.json / a token object → Figma variable collections, modes, and values. Use when the user wants to sync tokens code→Figma: triggers 'import tokens into Figma', 'create Figma variables from my tokens.json / DTCG / Tailwind config', 'sync design tokens to Figma', 'push tokens to Figma'. Non-destructively matches existing variables (by saved id/key/name) so re-imports update instead of duplicating. Works on ANY Figma plan. For the reverse (Figma → code) use figma-export-tokens.
In this repository22 other files it gives its agents.
- figjam-create-contentSkill
- figma-analyze-component-setSkill
- figma-annotationsSkill
- figma-arrange-component-setSkill
- figma-audit-accessibilitySkill
- figma-blame-nodeSkill
- figma-check-design-paritySkill
- figma-commentsSkill
- figma-component-propertiesSkill
- figma-deep-componentSkill
- figma-design-system-inventorySkill
- figma-export-tokensSkill
- figma-extract-design-systemSkill
- figma-generate-changelogSkill
- figma-generate-component-docSkill
- figma-library-variablesSkill
- figma-lint-designSkill
- figma-manage-variablesSkill
- figma-scan-code-accessibilitySkill
- figma-setup-design-tokensSkill
- figma-slidesSkill
- figma-version-historySkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Create and update Figma variables from a token source (DTCG tokens.json, a Tailwind/SCSS export, or a plain token object).
- Distinctive: line 30
Decide conflict policy: Default: code wins on values, but never delete Figma-only variables without asking.
- Very specific: line 32
Apply: Put the parsed data into the constants at the top of scripts/apply-tokens.js and run it via use_figma (skillNames: …
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
figma-import-tokens — design tokens → Figma variables
Create and update Figma variables from a token source (DTCG tokens.json, a Tailwind/SCSS export, or
a plain token object). Aliases and multi-mode values are supported. Re-running is safe: variables are
matched by saved Figma id → key → exact name, so an update edits in place rather than duplicating.
Skill boundaries
use_figmarules — load the officialfigma-useskill first; it is the full Figma Plugin API reference. Essentials these scripts rely on: plain JS with top-levelawait+return(no IIFE, nofigma.closePlugin();console.logis not returned), inputs inlined asconstat the top of each script, colors in 0–1 range, load fonts before any text op,await figma.getNodeByIdAsync(...), and atomic errors (a failed script applies nothing — read the error, fix, retry).- Reverse direction (Figma → code) →
figma-export-tokens.
Workflow
- Parse the source into the canonical token list — deterministically. For DTCG input (incl.
anything
figma-export-tokensproduced), run the bundled parser instead of flattening by hand:
It prints the exactnode scripts/parse-tokens.mjs tokens.tokens.json --default-mode Light --collection Brand # --strip-prefix "ds-" drops a leading name prefix on import (e.g. ds-color/x → color/x)COLLECTION_NAME/MODES/TOKENSconstants to paste into the apply script — handling$type→Figma type,{ref}aliases, multi-mode ($extensions…modes),dimensionunit stripping, andvariableIdround-trip. For non-DTCG sources (a Tailwind/SCSS export), export to DTCG first or hand-build theTOKENSarray:{ name: "Color/Brand/Primary", type: "COLOR"|"FLOAT"|"STRING"|"BOOLEAN", values: { <mode>: literal | { reference: "{Color.Brand.500}" } }, figmaVariableId? }. - Decide conflict policy. Default: code wins on values, but never delete Figma-only variables without asking. Confirm the target collection name and the mode list (first = default).
- Apply. Put the parsed data into the constants at the top of
scripts/apply-tokens.jsand run it viause_figma(skillNames: "figma-import-tokens"). It runs two passes — literals first, then aliases — and returns{ created, updated, errors, variableIds }. - Report & validate. Surface created/updated counts and any
errors. Run a read-back (thefigma-export-tokensread script orget_variable_defs) to confirm values landed.
Notes & gotchas
- Two-pass is required — alias targets must exist before
createVariableAlias. The script handles this; don't collapse it into one pass. - Colors accept hex strings (3/6/8 digit) and are converted to
{r,g,b,a}0–1 automatically. - Scopes: new variables default to
ALL_SCOPES, which pollutes every picker. After import, consider settingvariable.scopes(seefigma-manage-variables) to the right surfaces. - Round-trip: importing a file previously produced by
figma-export-tokensis the happy path — the stashedvariableIdmakes matching exact.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

