From Accessibility Audit
Creates and manages design token systems — the single source of truth for visual decisions (color, spacing, typography, shadow, radius, motion, z-index). Use when setting up a design system, defining CSS custom properties, generating a Tailwind theme config, extracting tokens from Figma, auditing inconsistent hardcoded values, or migrating scattered magic numbers into a structured token architecture.
How this skill is triggered — by the user, by Claude, or both
Slash command
/accessibility-audit:design-tokensThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Design tokens are **named design decisions**, not just variables. Every token carries intent:
Design tokens are named design decisions, not just variables. Every token carries intent:
--color-text-danger explains purpose; #ef4444 explains nothing. A well-structured token
system lets a codebase change its visual language by editing one file — and lets a team
communicate in shared vocabulary instead of hex codes.
The goal is a layered system where primitive values feed semantic aliases, which feed component-level overrides. Never skip layers to add speed — a flat list of hex codes is not a token system.
Primitives → Semantics → (Components)
──────────────────────────────────────────
Raw values Purpose- Scoped
(no context) named aliases overrides
Tier 1 — Primitives: Every raw value the design uses, named by what it is.
--color-red-500: #ef4444;
--space-4: 1rem;
--font-size-lg: 1.125rem;
Tier 2 — Semantics: Aliases that express how a primitive is used. This tier is what components consume. Never consume primitives directly in component styles.
--color-text-danger: var(--color-red-500);
--space-component-gap: var(--space-4);
Tier 3 — Component tokens (optional, for large systems): Scoped overrides per component. Add this tier only when a semantic token doesn't cover a specific component need without becoming too narrow to share.
/* In button context */
--button-bg-destructive: var(--color-bg-danger);
Before writing any tokens, answer:
get_variable_defs
or get_design_context. Don't approximate.px sizes, and
font stacks. These are your primitive candidates.Define every raw value first. Include the full scale for each category — don't pre-filter based on assumed usage.
| Category | Scale strategy |
|---|---|
| Color | Per-hue numeric scale (50–950), plus neutrals |
| Space | Powers-of-two rem scale (0.25rem → 4rem), then named |
| Font size | Modular scale (1.125 ratio or custom) |
| Font weight | Named weights only (400, 500, 600, 700) |
| Line height | Unitless values (1, 1.25, 1.5, 1.75) |
| Radius | Named scale (none, sm, md, lg, full) |
| Shadow | Named scale (none, sm, md, lg, xl) |
| Duration | Named scale (instant, fast, normal, slow) |
| Easing | Named functions (ease-in, ease-out, spring) |
| Z-index | Named layers (base, raised, dropdown, modal, toast) |
Map primitives to semantic roles. For each category, define:
Generate output in the target format(s). See output-formats.md for complete templates covering:
:root + scoped layers)theme.extend and v4 @themeBefore completing:
See token-naming.md for the complete naming reference.
Quick rules:
--[category]-[role]-[variant]-[state]--color-text-secondary not --color-gray-hover, -active, -focus, -disabled, -placeholderWhen a Figma file is available, extract tokens rather than authoring them:
get_variable_defs to pull the file's variable collections directly.get_design_context on representative frames and
extract colors, spacing, and type styles from the generated code hints.| Mistake | Fix |
|---|---|
Semantic names describing appearance (--color-blue-button) | Rename to describe purpose (--color-action-primary) |
| Components consuming primitives directly | Add a semantic alias; components reference semantics only |
| Flat list of variables with no tier separation | Restructure into primitives + semantics files |
| Missing interactive states in semantics | Add -hover, -focus, -disabled variants for interactive tokens |
| Color-only token system | Add spacing, typography, radius, shadow, motion — incomplete systems breed hardcoded values |
| Separate dark mode token files | Use CSS [data-theme="dark"] or @media (prefers-color-scheme: dark) to override semantic tokens only; primitives don't change |
For a new token system, deliver:
For an audit of an existing codebase, deliver:
npx claudepluginhub adamj/productdesign-skills --plugin productdesign-skillsCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.