Design Tokens
FreeDefine color, type, radius, and spacing once, then ban raw values in components.
Purpose
Keep generated UI on one system instead of a new hex on every screen.
Procedure
--- name: design-tokens description: Define color, type, radius, and spacing once, then ban raw values in components. ---
Design Tokens
Purpose
Keep generated UI on one system instead of a new hex on every screen.
Procedure
Inspect the codebase before inventing a palette. If tokens already exist, extend them. Do not create a second theme file.
Token set, and no more unless the product already has it:
- Background, canvas, surface, border, primary text, secondary text, one dark control color.
- One danger color for destructive text and borders. Do not add success green unless a status already uses it.
- A type family for UI and, if code is shown, one mono family.
- Radius steps that match existing buttons and inputs.
- Spacing on a 4-based scale. Components use the scale, not custom pixel padding.
Rules for agents editing components:
- No raw hex in JSX or CSS modules after the token file exists.
- No arbitrary spacing or font-size utilities. If a size is missing, add a named token.
- When a background color changes, set the foreground in the same rule.
- Do not add dark mode unless the product already has it and the user asked.
Document the token names in a short comment at the source. Do not generate a style-guide site as part of this task.
Example requests
1. Token pass
Request: Introduce design tokens for this app and replace one-off colors in the settings form. Do not restyle unrelated pages. Expected: A single token source and the form consuming those tokens.
Dependencies
None. Work in the repository that is already open. Do not add packages unless the procedure names one.
Compatibility
This document follows the Agent Skills layout (a folder named design-tokens containing SKILL.md). Claude Code, Cursor, Codex, and Gemini CLI can load that file from the paths in the Skilling installation guide. GitHub Copilot does not load SKILL.md. Use the Copilot instructions copy, and narrow applyTo before you commit it.
Example prompts
Token pass
Introduce design tokens for this app and replace one-off colors in the settings form. Do not restyle unrelated pages.
Expected: A single token source and the form consuming those tokens.
Choose the agent
This skill is installed for one agent at a time. Pick the section you are using.
Related
- Tailwind Discipline
Use the existing Tailwind tokens and scale. No arbitrary values, no copied utility salads.
- Contrast Pairs
Pick text and background pairs that meet WCAG AA, and never encode meaning with color alone.
- Type Rhythm
Set a small type scale, measure, and heading balance so pages read like a product, not a poster.
Reviews
No reviews yet.
Sign in to review.
Report a problem
Inaccurate steps, an unsafe instruction, or a licensing concern.
Sign in to report.