Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add ShuaiMXu/happyhands --skill token-contrast-auditor -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/token-contrast-auditor/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/token-contrast-auditor/

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

Similar skills

All skills for Frontend and UI →

From the same set34

The whole set →
foundation-extractor Foundation-extractor is a Claude Code skill that builds an inventory of design tokens and component sources. It maps existing design elements in a repository before proposing foundation updates. CX Codex +1 ★ 529repo stars component-inventory component-inventory is a Claude Code skill that maps components to source paths, variants, composition, and known consumers. It supports reuse decisions and drift analysis. CX Codex +1 ★ 529repo stars visual-qa-evaluator Visual-qa-evaluator is a Claude Code skill that prepares evidence for visual QA and regression analysis. It supports matching interface states to evaluate design changes. CX Codex +1 ★ 529repo stars brand-foundation-extractor brand-foundation-extractor is a Claude Code skill that gathers candidate brand principles, voice cues, and visual assets from project files and rendered content. It keeps each finding tied to its source. CX Codex +1 ★ 529repo stars pattern-library-curator pattern-library-curator is a Claude Code skill that gathers accepted interface solutions into a project pattern library. It checks recurring decisions for evidence before they are treated as reusable patterns. CX Codex +1 ★ 529repo stars design-system-drift-detector The design-system-drift-detector skill for Claude Code identifies discrepancies between implementation and design tokens. It detects ungoverned literals, semantic conflicts, and off-scale values. CX Codex +1 ★ 529repo stars fix-planner fix-planner is a Claude Code skill that turns a confirmed finding into a bounded change plan. It ties proposed fixes to project evidence and approved design decisions. CX Codex +1 ★ 529repo stars component-state-auditor The component-state-auditor skill for Claude Code compares documented component states against a versioned rubric in rubric.json. It identifies missing states during UI development and review. CX Codex +1 ★ 529repo stars

Project sponsors

Companies that keep this analytics open