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
- Read the checklistThe How to Add a New Token section of
CLAUDE.mdis the list. The skill adds the detail it leaves out. - Decide the tierA 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.
- Put it in its category’s fileColour goes in both
tokens-light.cssandtokens-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 intokens-forced-colors.css. - Check the prefixAn 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. - Give it its documentation homesA 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.
- Package a TypeScript tokenOnly for a shared constant like the timings in
motion.ts: a published subpath, or an entry saying why it stays internal. - VerifyRun
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.
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.
| Home | Held by | Kind |
|---|---|---|
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 |