theme-token-audit
Skill0 starsChanged 29 days agoMITView on GitHub
Audit light and dark themes against the design tokens: no hardcoded colours, contrast in both themes, borders and surfaces, states and focus in dark mode. Use when touching colours or themes, adding a UI component, and in any interface review.
In this repository12 other files it gives its agents.
- templates/CLAUDE.mdCLAUDE.md
- accessibility-basicsSkill
- approvalsSkill
- backlog-itemSkill
- component-statesSkill
- department-briefSkill
- forms-feedbackSkill
- grill-before-buildSkill
- handoffSkill
- layout-and-hierarchySkill
- release-checklistSkill
- ui-review-checklistSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use when touching colours or themes, adding a component, or reviewing a screen in both themes.
- Distinctive: line 16
Every new surface, border, chip, focus ring and state works in light and dark (and in "system", if the app follows the OS setting).
- Distinctive: line 18
Use semantic tokens by meaning, not by look: main text, secondary text, muted labels and meta, surface and raised surface, border, success, …
- Distinctive: line 43
Search the diff for hardcoded colours:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Theme and token audit
Use when touching colours or themes, adding a component, or reviewing a screen in both themes.
Rules
- Colours come only from the design tokens (CSS custom properties or the theme config of your design system). No
hex values,
rgb(,bg-black,text-whiteor raw palette hues such asbg-blue-600in components or inline styles. If a needed colour has no token, add a token in the app's own theme file; do not edit a vendored design system to get it. - Every new surface, border, chip, focus ring and state works in light and dark (and in "system", if the app follows the OS setting).
- Use semantic tokens by meaning, not by look: main text, secondary text, muted labels and meta, surface and raised surface, border, success, warning, danger. Tone carries meaning: the warning tone only for what needs the user, never for decoration.
- Contrast: body text 4.5:1, large text and meaningful icons 3:1, in both themes, measured from the token values or the screenshot, never judged by feel. Muted label text on a raised or hover surface is the pair to check first: it is the smallest, palest text.
- Surfaces and borders: a card in dark must still separate from the page (a border token, not a shadow that vanishes on dark). Pale text on a pale surface, or a dark button on a dark surface, is a defect.
- States and focus in dark: hover, selected, disabled and the focus ring all exist and keep contrast.
- Embedded content with its own styles (an iframe preview, a rendered email, user HTML) may keep its own colours, but the frame around it follows the tokens.
Examples
- An email preview pane with a hardcoded white background. It may be deliberate, because emails assume a white canvas. If so, mark it in the code as a named exception with a comment; otherwise it is a hardcoded colour that glares in dark mode. Ask before calling it a defect.
- Status chips for "paid", "pending" and "failed" that all render the same grey in dark mode because they used fixed light-theme values. Fix with success, warning and danger tokens that have dark values, not with per-theme overrides in the component.
- A table row's state on the right uses the success token for "shipped" and the warning token for "needs you"; the same row in dark picks up the dark token values with no extra code. That is the target.
How to test
Search the diff for hardcoded colours:
git diff | grep -nE '#[0-9a-fA-F]{3,8}\b|rgba?\(|hsla?\(|bg-(black|white)|text-(black|white)|-(red|blue|green|amber|yellow|gray|slate)-[0-9]'Capture light and dark at desktop and phone width; for the smallest text compute contrast against its background in both themes. Use test data only, no secrets in screenshots.
How to report
One finding per problem, ranked by cost to the user: the exact element by its visible text, the offending value, the measured contrast in each theme, the token that replaces it, and the file.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

