System

new-token

A token that exists only in CSS is incomplete

The new-token skill is a checklist the coding agent follows when it adds or changes a design token. A token has to reach several homes, and most of them are held in place by the build. Below are the steps, then one real token traced from its raw value to every place it shows up. The full skill file is on Skills.

The steps

  1. Read the checklist
    The How to Add a New Token section of CLAUDE.md is the list. The skill adds the detail it leaves out.
  2. Decide the tier
    A primitive is a raw value. A semantic token is a role, and it points at a primitive through var(). Add a primitive only when no existing one fits.
  3. Makes the tokenPut it in its category’s file
    Colour goes in both tokens-light.css and tokens-dark.css. Spacing, radius and the other sizes go in the light file alone. A colour that carries a state, such as a checked fill, also gets a system colour in tokens-forced-colors.css.
  4. Check the prefix
    An existing prefix needs nothing. A new one fails generation until it is added to CATEGORY_PREFIXES, so the new category gets a home on the same day.
  5. Makes the swatch, story and specGive it its documentation homes
    A row on the matching foundations page, an entry in the Storybook token docs, and a sentence in design.md on its role. The sentence never states a colour value, since design.md holds for every theme.
  6. Package a TypeScript token
    Only for a shared constant like the timings in motion.ts: a published subpath, or an entry saying why it stays internal.
  7. Verify
    Run npm run validate-registry, then the build. Commit every file the chain rewrites. Counts update themselves.

The action colour, end to end

--color-action-primary-bg is the action colour. Its light value points at a primitive, its dark value at another step of the same ramp, and its forced colors value at the system highlight. Button’s CSS uses the semantic token, never the primitive. The registry, the resolved values and the DTCG files are written from the CSS on every build.

1 · The tiers, by handprimitive, semantic, component
2 · Documentation, by handwhere a reader finds it
3 · Every buildvalidate-registry
4 · Generatednever edited by hand
Primitivetokens-primitives.css
Light valuetokens-light.css
Dark valuetokens-dark.css
Forced colorstokens-forced-colors.css
Component CSSButton.css
Spec sentencedesign.md
Storybook docTokens.stories.tsx
Swatchfoundations/colour-mode
Generatorstoken registry · token values
Validatorsreferences · parity · usage · mirrors
Token registrysrc/tokens/registry.json
Resolved valuessrc/tokens/values.json
DTCG filesone per theme and mode
var() onlyevery buildboth ways
Three tiers by hand, documented by hand, everything else written by the build.

What holds each home

A build check fails the build the moment a home drifts. An audit home is checked when a drift audit runs.

How each home of the action colour stays true
HomeHeld byKind
Semantic value to primitive
validate-token-references.mjs
Build
Light and dark values
validate-token-registry.mjs
Build
Button.css
validate-token-usage.mjs
Build
Swatch and its caption
validate-website-surfaces.mjs and validate-foundation-mirrors.mjs
Build
Values and DTCG files
validate-token-values.mjs
Build
Storybook doc and design.md
The drift-audit skill
Audit