Skip to content
Back to skills

Design System Tokens

ASecurity

Create or tidy a design system from the code: inventory colours, type, spacing, radii, shadows and components, merge near-duplicates, name tokens by role, define scales, light and dark themes, component states and variants, then deliver a tokens file, a reference page and migration notes. Use for "create design tokens", "clean up our colours", "set up a design system", "add dark mode tokens", "unify the styles".

  • 11 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 5, 2026
ai-agentsgo

Security analysis

A100/100

Scanned December 5, 2026

npx -y skills add kinzarra/vibetrack --skill design-system-tokens --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Design System Tokens?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Design System Tokens
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/kinzarra-design-system-tokens/badge)](https://www.skillsdirectory.com/skills/kinzarra-design-system-tokens)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: design-system-tokens
description: 'Create or tidy a design system from the code: inventory colours, type, spacing, radii, shadows and components, merge near-duplicates, name tokens by role, define scales, light and dark themes, component states and variants, then deliver a tokens file, a reference page and migration notes. Use for "create design tokens", "clean up our colours", "set up a design system", "add dark mode tokens", "unify the styles".'
---

# Design system tokens

The result is a small, named set of values that the whole product can run on, a page that shows them, and a migration path that does not change how existing screens look until someone decides it should.

## 1. Inventory from the code

Do not start from a blank palette. Extract what is really used.

- **Find the sources**: stylesheets, theme and config files, CSS custom properties, preprocessor variables, tokens JSON, inline styles, style objects in components, SVG fills. Note the project's existing token format and naming, if any: the new work continues it.
- **Count every raw value** with a search over the source (skip dependencies and build output) and record `value | count | example files`:
  - colours (HEX, rgb, hsl, named), normalised to one notation so `#FFF`, `#ffffff` and `white` count as one;
  - font families, sizes, weights, line heights, letter spacing;
  - margin, padding and gap values; widths and breakpoints;
  - border radii, border widths, shadows, z-index values, opacity, durations and easing curves.
- **Components**: list each UI component (button, input, select, checkbox, card, modal, table, tab, badge, toast, tooltip) with its variants, sizes and where duplicates exist (three different buttons built by hand).
- When a browser is available, screenshot 5 to 10 key screens now. They are the baseline for step 5.

## 2. Merge

- **Colours**: group by hue and lightness. Two colours with a difference a person cannot see side by side (Delta E under about 3, or within 2 to 3% lightness at the same hue) become one: keep the one used most, or the one that passes contrast. Typical target: 1 neutral ramp, 1 to 2 brand ramps, 4 status hues.
- **Sizes**: snap spacing and type to the scale (step 3). A value within 1 to 2 px of a step moves to it; a value far from any step is listed as an exception with its place, not silently changed.
- **Radii and shadows**: reduce to 3 to 5 radii and 3 to 4 elevation levels.
- Keep a **mapping table** `old value -> token -> visual change (none / N px / shade)` for everything merged. This table is the migration.

## 3. Scales and names

Three layers. Components use only the semantic layer.

1. **Primitive** (raw scale, named by position): `color.blue.500`, `space.4`, `font.size.300`, `radius.2`. Never used directly in screens.
2. **Semantic** (named by role, points to a primitive): `color.text.primary`, `color.text.muted`, `color.bg.surface`, `color.bg.canvas`, `color.border.default`, `color.action.primary.bg`, `color.action.primary.text`, `color.status.danger.bg`, `color.focus.ring`, `space.inset.md`, `radius.control`, `shadow.overlay`.
3. **Component** (only where a component must differ): `button.primary.bg.hover`.

Naming rules: by role, never by value or look (`color.text.danger`, not `color.red`; `space.md`, not `space.16`); `category.property.variant.state` order; lower case; one separator in the project's style (`--color-text-primary` in CSS); no abbreviations that need a glossary; states spelled `hover`, `active`, `focus`, `disabled`, `selected`.

Scales, unless the project already has sound ones:

- **Colour ramps**: 11 steps (50, 100 to 900, 950) per hue, even in perceived lightness. On a white surface, steps 600 and darker reach 4.5:1 for text; step 500 reaches 3:1 for UI parts.
- **Spacing**: base 4 px: 0, 2, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 80, 96.
- **Type**: sizes 12, 14, 16, 18, 20, 24, 30, 36, 48 px, stored in `rem`; each size paired with a line height (1.5 for body sizes, 1.2 to 1.3 for 24 px and up); weights 400, 500 or 600, 700.
- **Radius**: 0, 2, 4, 8, 12, 16, full. **Border**: 1, 2 px. **Shadow**: 3 to 4 levels, each a named elevation. **Z-index**: named layers (base, dropdown, sticky, overlay, modal, toast) with gaps of 100. **Motion**: durations 100, 150, 200, 300, 400 ms and 3 easing curves. **Breakpoints**: the ones in the code, named.

## 4. Themes, states, variants

- **Light and dark**: the same semantic names, different primitives behind them. Dark is not an inversion: canvas near black but not `#000`, raised surfaces lighter than the canvas, less saturated accents, borders by lightness instead of shadow. Switch by `prefers-color-scheme` and by an attribute on the root element (`data-theme`), following what the project already does.
- **Contrast**, checked in both themes and written in a table: text on each background 4.5:1; large text, icons, input borders and the focus ring 3:1; disabled text is exempt but must stay readable.
- **Component states**: for each interactive component define default, hover, active, focus-visible, disabled, and where relevant selected, loading, invalid and read-only, each as tokens. Focus ring: 2 px, offset 2 px, one token for all components.
- **Variants and sizes**: fix the allowed set per component (button: primary, secondary, ghost, danger; sizes sm 32 px, md 40 px, lg 48 px high). Anything outside the set found in the inventory maps to the nearest allowed one in the mapping table.

## 5. Migrate without breaking screens

1. **Add** the tokens first; change no screen. Old variables stay as aliases that point to the new tokens, marked deprecated.
2. **Replace raw values with tokens of the same value** (visual change: none). This is safe to do in bulk; list the search patterns used.
3. **Apply the merges that change pixels** as a separate step, component by component, each listed with its before and after. Do this only when the task asks for the migration; otherwise leave it as the plan.
4. **Verify**: screenshot the same key screens and compare with the baseline. Report every visible difference and whether it was intended.
5. **Guard**: propose a lint rule or a search check that fails on new raw colours and off-scale spacing, using tooling the project already has.

## Output

Under `design/system/` in the task's repository, unless the task or the project's structure says otherwise (tokens that the code will import go where the project keeps its styles):

- **The tokens file in the project's format**: CSS custom properties, preprocessor variables, a theme or config object, or JSON in the Design Tokens Community Group shape (`{"$value": ..., "$type": ...}`) when no format exists. Primitive, semantic and component layers, light and dark.
- `reference.html`: one page with no build step, reading the tokens file: colour swatches with name, value and contrast ratio, the type scale as real text, spacing bars, radii, shadows, each component in every variant and state, and a theme toggle.
- `inventory.md`: the counts from step 1 and the mapping table from step 2.
- `migration.md`: the steps in order, which are done and which are proposed, deprecated aliases, the exceptions list, the visual differences found, the guard rule.

Do not commit, push or deploy unless the task says so. If brand colours or fonts are undecided, or a merge would change a visible brand colour, do not choose silently: list the options with their contrast numbers and say what decision is needed.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.