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★ 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:- With
use_figma, collectgetLocalVariableCollectionsAsync(),getLocalVariablesAsync()andgetLocalEffectStylesAsync()as plain objects (the fields in tokens-bruecke'sschemas/tokens-snapshot.schema.json), and write the JSON into a text layer on a new page namedtmp: tokens snapshot. Ause_figmaresult can't carry it: it caps at 48 KB. - 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 theX-Figma-Token: $FIGMA_API_KEYheader, both keys from a.envhere. The snapshot is the node'scharacters. - Decode the HTML entities in descriptions (Figma returns
'; the plugin decodes them, snapshot mode doesn't), then delete the page. npx tokens-bruecke@latest --input snapshot.json -c figma-export.config.json -o tokens/json --split-by-collection
- With
Figma agent.
/export-tokensin the tokens file, choosing hex, everything, one file per collection; copy the four files intotokens/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.
Установить 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), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic