token-contrast-auditor — Claude Code skill: contrast auditing
The token-contrast-auditor skill for Claude Code verifies color pair contrast against WCAG standards. It runs during project analysis to check design tokens and CSS styles.
MIT ★ 529 updated 2026-11-17
npx skills add ShuaiMXu/happyhands --skill token-contrast-auditor -a claude-codeWhat token-contrast-auditor does
This tool computes the contrast ratio for color pairs defined as text and background elements. It evaluates both explicitly declared token roles and specific CSS rules where foreground and background colors are paired. The analysis relies on luminance ratio calculations to provide an objective readability score.
The results are categorized into failures, partial compliance for large text, and AA-level compliance per WCAG 2.2. The skill reports specific ratios and source locations, leaving manual adjustments to the developer based on the design system requirements. Colors with alpha channels are skipped to avoid inaccurate results caused by unknown backdrops.
A design foundation with color tokens and access to component stylesheets are required for operation. This audit does not serve as a full accessibility certification and should be used as a support tool in the development process.
What it helps with
- audit color contrast in CSS files
- verify design tokens against WCAG 2.2
- identify inaccessible text and background combinations
- generate a list of color pairs needing adjustment
Example prompts for the agent
- /token-contrast-auditor check contrast in
theme.css - audit token contrast defined in
design-system.json
How to install token-contrast-auditor
1Skills CLI (Vercel)
npx skills add ShuaiMXu/happyhands --skill token-contrast-auditor -a claude-code2Manually: put the files in place
~/.claude/skills/token-contrast-auditor/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/token-contrast-auditor/
1Skills CLI (Vercel)
npx skills add ShuaiMXu/happyhands --skill token-contrast-auditor -a codex2Manually: put the files in place
.agents/skills/token-contrast-auditor/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add ShuaiMXu/happyhands --skill token-contrast-auditor -a cursor2Manually: put the files in place
.cursor/skills/token-contrast-auditor/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install ShuaiMXu/happyhands skills/product-design/token-contrast-auditor2Manually: put the files in place
.github/skills/token-contrast-auditor/SKILL.md1Skills CLI (Vercel)
npx skills add ShuaiMXu/happyhands --skill token-contrast-auditor -a gemini-cli2Platform CLI
gemini skills install https://github.com/ShuaiMXu/happyhands --path skills/product-design/token-contrast-auditorManually: put the files in place
.devin/skills/token-contrast-auditor/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about token-contrast-auditor
How to install token-contrast-auditor in Claude Code?
Run the command npx skills add ShuaiMXu/happyhands --skill token-contrast-auditor -a claude-code in your project terminal.
What does token-contrast-auditor do?
It calculates the contrast ratio for color pairs and identifies those failing WCAG 2.2 guidelines for web accessibility.
What is required to use token-contrast-auditor?
You need a design foundation using color tokens and access to your component and stylesheet source files.
Source text
SKILL.md · MIT
--- name: token-contrast-auditor description: "Compute WCAG contrast for colour pairs the token names or the source state, and report which fail." --- # Token Contrast Auditor Whether a colour pair is legible is arithmetic, not taste. A team that darkens its danger colour is arguing about how it looks; the ratio against the surface it sits on is a number, and WCAG says what that number has to be. ## Required evidence - a design foundation with colour tokens - component and stylesheet sources, when pairs stated in code are also to be measured ## Which pairs are measured Only pairs that something states: - **Declared.** A role that has both a text token and a surface token — danger text on danger surface, success text on success surface. The names say these are used together. - **Observed.** A declaration that sets a text colour and a background together, in a CSS rule or a style object. It states a pairing whatever the token names say. A pair nobody expressed is not invented. Measuring every colour against every other produces a long list of failures that describe combinations the product never renders. ## Thresholds WCAG 2.2 AA asks for 4.5:1 for normal text and 3:1 for large text and non-text contrast. A token pair does not carry the size or weight of the text it will hold, so the result reports which band a pair falls in rather than pretending to know: - below 3:1 — fails every use - 3:1 to 4.5:1 — carries large text or non-text only, and whether that is what it carries has to be checked in the interface - 4.5:1 and above — passes AA ## Decisions - Report the ratio, both values and where the pair came from, so the result can be checked by hand. - Leave the fix open. Darkening the foreground, lightening the surface and restricting the pair to large text are all valid answers, and which one is right depends on the rest of the system. - Skip a colour with an alpha channel and say so. What it renders as depends on what is behind it, and a ratio computed against the wrong backdrop is worse than no ratio. ## Boundary Contrast is necessary, not sufficient. A pair that passes can still be illegible over a photograph, behind a gradient, or at a weight the ratio does not describe. Passing this audit is not an accessibility certification, and failing it is not always a defect — a disabled control is meant to recede. Return structured evidence, findings, proposed updates and limitations. Use `needs-evidence` when required inputs or professional review are missing. Never invent an Experience Score or promote a project observation into a universal rule.
© ShuaiMXu · MIT · ShuaiMXu/happyhands