audit-tokens
Find hardcoded hex/rgb/hsl colors in frontend files that should be using CSS variable tokens (bg-background, text-foreground, etc.). Use after UI changes and during design-system audits.
SKILL.md.claude/skills/audit-tokens/SKILL.md
GitHubaudit-tokens
Per ADR 003, all colors come from CSS variable tokens defined in apps/web/src/index.css (HSL emerald hue 160). Hardcoded colors break dark mode and theme consistency.
What to look for
- Hex codes:
#fff,#10b981,#22c55e, etc. rgb(...),rgba(...),hsl(...)literals- Tailwind palette classes:
bg-emerald-500,text-red-600,border-gray-300, etc. - Inline
style={{ color: '...' }}
What's allowed
- CSS variable references:
bg-background,text-foreground,text-muted-foreground,bg-card,bg-primary,text-primary-foreground,border-border,bg-destructive,text-destructive,bg-warning, etc. - Arbitrary values referencing variables:
bg-[hsl(var(--warning)/0.3)] - Anything in
apps/web/src/index.css(the source of truth)
Steps
- Grep for hex patterns:
#[0-9a-fA-F]{3,8}inapps/web/src/**/*.{tsx,ts,css} - Grep for
rgb(,rgba(,hsl(literals (excludingvar(--...)references) - Grep for Tailwind palette classes:
(bg|text|border|ring|fill|stroke)-(red|green|blue|yellow|emerald|amber|gray|slate|...)-\d+ - Filter allowed exceptions:
index.cssitself- Storybook / dev-only files
- Files in
tests/(test fixtures may use hardcoded values)
- Group by file with proposed token replacements:
bg-emerald-500→bg-primarytext-red-600→text-destructivebg-gray-50→bg-mutedborder-gray-200→border-border
- Report the violations and ask before fixing.
Verification
- All frontend files scanned
-
index.cssexcluded - Replacements suggested per match
- User asked before bulk-replacing
Notes
- The project's destructive token uses
hsl(0 72% 51%)(softened from default 84% saturation) - See [[Architecture/Frontend Structure]] in the vault for the full token list