About figma-setup-design-tokens
A skill for bootstrapping Figma design tokens by creating a variable collection, modes, and variables in one atomic script. It is intended for new token systems or additional collections; failed scripts apply no changes.
Key features
- 01Create a variable collection and modes
- 02Create variables in one operation
- 03Set scopes for individual variables
- 04Run changes as an atomic script
- 05Return results and provide validation steps
Use cases
- 01Initialize tokens for a new design system
- 02Add a variable collection to an existing file
- 03Limit token availability by property type
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ southleft/ figma-console-mcp-skills --skill figma-setup-design-tokensAfter installing, type/figma-setup-design-tokensin Claude Code to confirm it loaded.
Bundled filesscripts/setup-tokens.js
Details
From the project READMEfigma-setup-design-tokens — atomic token-system bootstrap
Create a variable collection + modes + all variables in a single use_figma call. This is the
fastest way to stand up a new token system (or a new collection within one). Because it runs as one
atomic script, either everything is created or nothing is (failed scripts apply no changes).
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).- Incremental CRUD / batch edits to an existing system →
figma-manage-variables. - Sync from a code token file →
figma-import-tokens.
Workflow
- Agree the v1 scope. List the collection name, the modes (first one is the default), and the full token set with per-mode values. Lock this before writing — it's much cheaper than editing afterward.
- Fill the constants in
scripts/setup-tokens.js:COLLECTION_NAME,MODES,TOKENS(values keyed by mode name), and optional per-variableSCOPES. - Run via
use_figma(skillNames: "figma-setup-design-tokens"). It returns{ collectionId, modes, created, errors }. - Validate with
get_variable_defsor thefigma-export-tokensread script, then screenshot if you also created swatches.
Notes
- Two-tier systems: create primitives (raw values) with this skill, then create semantic
tokens that alias them using
figma-import-tokens(which has the alias pass) orfigma-manage-variables. Keep primitives single-mode and put theming on the semantic layer. - Set scopes: the default
ALL_SCOPESclutters every property picker. PassSCOPESfor the surfaces each token belongs to (FRAME_FILL/SHAPE_FILLfor backgrounds,TEXT_FILLfor text,GAPfor spacing,CORNER_RADIUSfor radii,WIDTH_HEIGHTfor sizing). - Keep one bootstrap per collection. Multiple collections = multiple runs.
Comments
Markdown supported