Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

design-tokens

БесплатноБез исполняемых скриптовНе проверен

Use when pulling design tokens from Figma into `packages/but-ui`, regenerating `tokens.css`, or reviewing a token change: sync/export/update tokens, a Figma…

gitbutlerappот gitbutlerapp★ 22 059 звёзд на GitHub

Об этом скилле

Design tokens

Figma variables are the source. packages/but-ui/tokens/json/*.tokens.json is their export. The build makes tokens/tokens.css from it, and writes the same values as data to tokens/tokens.json (the tokens) and tokens/settings.json (the choices a person can make). None is edited by hand. The package README has the pipeline in full. Run everything below from packages/but-ui.

1. Export from Figma

Every route writes the same four files: core, semantic, ramps and fx.tokens.json.

  • A snapshot through the file API (the route that works on GitButler's plan). Figma's variables REST API is Enterprise-only, so the CLI's own fetch answers 403. Instead, dump the variables with the Figma MCP and convert them with the CLI's snapshot mode:

    1. With use_figma, collect getLocalVariableCollectionsAsync(), getLocalVariablesAsync() and getLocalEffectStylesAsync() as plain objects (the fields in tokens-bruecke's schemas/tokens-snapshot.schema.json), and write the JSON into a text layer on a new page named tmp: tokens snapshot. A use_figma result can't carry it: it caps at 48 KB.
    2. Fetch that layer with the regular file API, which any plan has: GET https://api.figma.com/v1/files/$FIGMA_FILE_KEY/nodes?ids=<node id> with the X-Figma-Token: $FIGMA_API_KEY header, both keys from a .env here. The snapshot is the node's characters.
    3. Decode the HTML entities in descriptions (Figma returns &#39;; the plugin decodes them, snapshot mode doesn't), then delete the page.
    4. npx tokens-bruecke@latest --input snapshot.json -c figma-export.config.json -o tokens/json --split-by-collection
  • Figma agent. /export-tokens in the tokens file, choosing hex, everything, one file per collection; copy the four files into tokens/json/.

  • A PR from the plugin's GitHub PR server. It carries only the JSON: check out its branch and continue from step 2.

figma-export.config.json holds the settings the committed tokens were made with. Changing it rewrites every file, so don't, unless that is the point.

A token's CSS name is its Figma path with dashes under --but- (primary/soft/foreground is --but-primary-soft-foreground); a group's own variable (primary beside primary/foreground) takes the group's name. The ramps follow the same rule (ramps/teal/9 is --but-teal-9). cssVarName in scripts/terrazzo-css-helpers.mjs is the one rule.

2. Check something changed

Every export moves a createdAt stamp, so a diff alone means nothing:

git diff -U0 tokens/json | grep '^[+-]' | grep -v '^[+-][+-]' | grep -v createdAt

No output: git checkout -- tokens/json, tell the user Figma has no changes, and stop.

3. Build and review

pnpm build
git show HEAD:packages/but-ui/tokens/tokens.css > "$TMPDIR/tokens-before.css"
node scripts/diff-css-vars.mjs "$TMPDIR/tokens-before.css" tokens/tokens.css

The report lists added, changed and removed variables. A token that changed in the JSON but not in the CSS is probably in a collection Terrazzo doesn't read; say so rather than patching the CSS.

4. Fix what reads a removed or renamed variable

pnpm --filter @gitbutler/but-ui-react check:tokens

It names every var(--…) nothing declares any more. Fix those in the same change, and search the rest of the repo too: packages/but-mcp-app, the GPUI theme in crates/but-ui-gpui, whose build reads its colours from tokens/tokens.json by name, so cargo check -p but-ui-gpui fails on one that's gone, and whose src/illustration.rs colours but-ui-react's illustrations by the names in their SVGs. For a rename, scripts/rename-tokens.mjs reads token-map.json; add the old name and its replacement there and run it. Projects outside the monorepo (but-dev) pin a commit and pick the change up when they move it; mention removals to the user so they know.

A changed --but-font-weight-* reaches the GPUI client through font files cut at that weight, not through the token itself: run crates/but-ui-gpui/assets/fonts/cut-inter.py (its README says how) and commit the files it writes with the tokens. cargo test -p but-ui-gpui fails until they match.

5. Commit

tokens/json, tokens/tokens.css, tokens/tokens.json, tokens/settings.json and tokens/accent-samples.json go in one commit, with the GitButler skill, and the message says what changed in the tokens. There is no version bump or release: the package is not published.

Полный SKILL.md на GitHub

Установить design-tokens в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл design-tokens?

Use when pulling design tokens from Figma into `packages/but-ui`, regenerating `tokens.css`, or reviewing a token change: sync/export/update tokens, a Figma variable was added, renamed or changed, or `pnpm check` says tokens.css is stale. Not for using tokens in components; that is the gitbutler-ui skill.

Как установить скилл design-tokens?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл design-tokens запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить design-tokens с