new-token
Skill9 starsChanged 7 days agoMITView on GitHub
Add a new design token (or token family) to the system, with every home it needs to reach. Use when asked to add a token, a new colour or motion token, or a token category.
In this repository33 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- accessibility-auditSkill
- animation-jump-checkSkill
- api-consistencySkill
- chat-qualitySkill
- checkpointSkill
- component-consistency-auditSkill
- component-doc-pageSkill
- content-auditSkill
- dependency-advisorySkill
- design-qaSkill
- dogfoodSkill
- drift-auditSkill
- first-deploySkill
- landSkill
- link-rotSkill
- new-componentSkill
- new-pageSkill
- new-presetSkill
- new-templateSkill
- new-validatorSkill
- parkSkill
- pre-deploySkill
- release-postSkill
- releaseSkill
- responsive-sweepSkill
- security-auditSkill
- seo-auditSkill
- shipSkill
- super-shipSkill
- token-auditSkill
- token-renameSkill
- visual-reviewSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Add a design token so it exists in every home the system requires — a token that exists only in CSS is incomplete.
- Very specific: line 15
Use this skill when asked to add or change a design token or token family — phrases like "add a token", "add a --color-… token", "new …
- Very specific: line 35
If component code mirrors the token's value outside CSS (a var() fallback, a serialized config), route the mirror through a validator so it …
- Very specific: line 41
Never hand-edit src/tokens/registry.json, src/tokens/values.json or website/public/schema/tokens/ — they regenerate from the CSS
- Distinctive: line 42
Never skip a tier: components reference semantic tokens, semantic tokens reference primitives
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
new-token
Add a design token so it exists in every home the system requires — a token that exists only in CSS is incomplete.
When invoked
Use this skill when asked to add or change a design token or token family — phrases like "add a token", "add a --color-… token", "new motion duration", "extend the chart ramp".
Instructions
CLAUDE.md's How to Add a New Token section is the authoritative checklist — read it first and follow its numbered steps. This skill adds the operational detail the checklist compresses.
- Decide the tier. A primitive (
--primitive-*intokens-primitives.css) is a raw value; a semantic token is a role. New roles reference existing primitives viavar()— add a primitive first only when no suitable one exists. Semantic colour tokens must chain to a primitive or another--color-*token;scripts/validate-token-references.mjsfails the build on a literal. - Put it in the file its category lives in —
SEMANTIC_FILESinscripts/generate-token-registry.mjsis the authoritative list of what the registry reads. Colour: bothsrc/tokens/tokens-light.cssandsrc/tokens/tokens-dark.css, always; the registry validator enforces light/dark parity for colour, so identical values in both is fine and a missing side is not. Shadow: both files too — the elevation tokens carry different values per theme — but parity is build-enforced for colour only, so a shadow token added to the light file alone ships silently unchanged in dark mode; checktokens-dark.cssyourself. Spacing, radius, border, icon size, control height:tokens-light.cssalone. A control-height step is also a row ofCONTROL_HEIGHT_STEPSinwebsite/src/lib/theme/theme-overrides.ts, which the density lever scales andscripts/validate-theme-mirrors.mjsholds to the primitives in both directions. Typography:tokens-typography.css. Motion:tokens-motion.css. Stacking (--layer-*):tokens-light.css, in its ladder lowest to highest, with a trailing comment saying what sits on the layer (/foundations/layoutprints it;scripts/validate-stacking.mjsrequires it and the order). Nothing but colour and shadow is theme-split; a typography or spacing token copied intotokens-dark.cssregisters from the light file anyway and leaves a dead duplicate no validator reports. A colour token that carries a state a reader must see (a checked or selected fill, a count, anything whose meaning is its fill) also needs a value insrc/tokens/tokens-forced-colors.css, a system colour (Highlight,Mark…): high contrast modes flatten every other fill to the page, and design.md's Forced colors section owns which roles are re-pointed. The page-level check inscripts/validate-website-a11y.mjs(FORCED_CHECKS) proves the ones on the table bench; a new state outside it needs a row there. - Check the prefix. If the token starts a new prefix, generation fails until the prefix is added to
CATEGORY_PREFIXESinscripts/generate-token-registry.mjs— deliberately, so a new category gets a display home at the same time. An existing prefix (--color-,--motion-,--radius-, …) needs nothing here; the registry regenerates on every build. - Give it its documentation homes (the build enforces the first, a drift audit catches the rest):
- Colour tokens need a swatch on
/foundations/colour-mode— build-enforced in both directions byscripts/validate-website-surfaces.mjs. The values those pages print beside a swatch are build-checked too (scripts/validate-foundation-mirrors.mjs), so a caption must state what the token actually resolves to. Other categories go on their matching foundations page (CLAUDE.md's checklist maps category → page). - The matching Storybook doc:
src/stories/Tokens.stories.tsx, whose story exports are the list (spacing's story carries the control heights too);src/stories/Typography.stories.tsxfor a type style (add it to the matching tier story,DisplayStyles,HeadingStylesorBodyTextStyles, and toAllStyles). A new type style also needs aTYPE_STYLESrow inwebsite/src/lib/theme/theme-overrides.ts(style, tier, weight, tracking):scripts/validate-theme-mirrors.mjsholds the table to the CSS in both directions and requires the display and heading tiers to hold one weight each, so decide the tier before picking the weight; a body-tier row is shifted by the body weight lever along with the paragraph, so its shipped weight is its distance from the paragraph's, not a fixed value. - A sentence in
design.mdrecording the role and how it relates to its neighbours (never a colour value: design.md is theme-agnostic), in the section that owns the token's subject. If that section states the family's size in words ("a four-step size scale"),scripts/validate-design-counts.mjsholds the words to the token files, so a new step fails the build until the sentence moves with it.
- Colour tokens need a swatch on
- A TypeScript-side token (a shared constant, like the JS timing constants in
src/tokens/motion.ts) has packaging steps CSS tokens do not:- A subpath entry in
SUBPATHSinscripts/package-manifest.mjs, mirrored by hand into the rootpackage.jsonexports(scripts/validate-package-exports.mjsfails the build if they drift), plus a matching entry invite.lib.config.ts. - Or, if it is internal-only, an entry in
INTERNAL_MODULESinscripts/validate-package-exports.mjswith the reason. - If component code mirrors the token's value outside CSS (a
var()fallback, a serialized config), route the mirror through a validator so it cannot drift — the chart palette guard inscripts/validate-token-references.mjsis the pattern to copy.
- A subpath entry in
- Verify:
npm run validate-registrymust pass end to end (it regeneratessrc/tokens/registry.json,src/tokens/values.jsonwith the DTCG files underwebsite/public/schema/tokens/(scripts/validate-token-values.mjsholds them; CLAUDE.md's How to Add a New Token step 5 says what fails when a token has no family or its value no mapper) and the other derived surfaces that carry token names or values, the consumer skills' token reference among them, and re-checks every home; the generator scripts at the front of thevalidate-registryentry in the rootpackage.jsonare the authoritative list, so commit every file the chain rewrites), thennpm run buildfor the type-check. Displayed counts update themselves — never hardcode one.
Guardrails
- Never hand-edit
src/tokens/registry.json,src/tokens/values.jsonorwebsite/public/schema/tokens/— they regenerate from the CSS - Never skip a tier: components reference semantic tokens, semantic tokens reference primitives
- A token with no consumer is not a token — if nothing will reference it, don't add it
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.

