design-tokens
Installation
SKILL.md
Design Tokens
Produces a three-tier token system (primitive, semantic, component) with mode support, delivered as DTCG JSON and CSS custom properties so design files and code share one source of truth.
When to use
- Starting a design system or theming layer
- Replacing hard-coded hex, px and shadow values in a codebase with tokens
- Adding dark mode or a compact density to an existing token set
- Syncing Figma variables with code or preparing input for a token build tool
- Auditing a token set for naming drift, duplicates or broken aliases
Workflow
- Inventory: collect existing values (hex, rgb, px, rem, radii, shadows, durations, z-index) from code or spec. Count unique values per category and flag near-duplicates such as #1F2937 and #1E2937.
- Define primitives as context-free scales: colors from color-system, spacing from layout-spacing, type from typography-system, plus radius, shadow, duration, easing and z-index.
- Define semantic tokens: role-based aliases that reference primitives (color.bg.default, color.text.muted, color.border.subtle, color.action.primary.bg, space.inset.md).
- Add component tokens only where a component must be themed independently (button.primary.bg referencing color.action.primary.bg).
- Define modes: light and dark swap semantic references; density swaps spacing and sizing semantics.
- Export DTCG JSON, CSS custom properties, and a Tailwind mapping if the project uses Tailwind.
- Migrate: replace hard-coded values with semantic tokens, worst offenders first.