token-contrast-auditor — скилл для Claude Code: проверка контрастности
Скилл token-contrast-auditor для Claude Code проверяет соответствие цветовых пар стандартам WCAG. Запускается при анализе дизайн-токенов и стилей в коде проекта.
MIT ★ 529 обновлён 2026-11-17
npx skills add ShuaiMXu/happyhands --skill token-contrast-auditor -a claude-codeЧто делает token-contrast-auditor
Этот инструмент высчитывает коэффициент контрастности между парами цветов, используемыми в качестве текста и фона. Скилл анализирует как явно объявленные роли токенов, так и CSS-правила, где цвет текста и фон заданы вместе. Проверка основывается на математическом расчёте отношения яркости, что позволяет объективно оценить читаемость интерфейса.
Результат разделяется на три группы: провал, частичное соответствие для крупного текста и успешное прохождение уровня AA по стандарту WCAG 2.2. Скилл не делает выводов об исправлении, а предоставляет отчёт с коэффициентами и источниками пар, чтобы разработчик вручную выбрал способ адаптации. Цвета с альфа-каналом автоматически пропускаются, так как их итоговый вид зависит от подложки.
Для работы требуется наличие дизайн-системы с цветовыми токенами и доступ к файлам стилей. Инструмент не проводит комплексную оценку доступности и не заменяет экспертную проверку.
Какие задачи решает
- проверить контрастность цветовых пар в CSS
- вычислить соответствие дизайна стандарту WCAG 2.2
- найти недоступные сочетания текста и фона
- сформировать список пар для улучшения дизайна
Примеры запросов агенту
- /token-contrast-auditor проанализируй контрастность в
theme.css - проверь контрастность токенов в
design-system.json
Как установить token-contrast-auditor
1Через Skills CLI (Vercel)
npx skills add ShuaiMXu/happyhands --skill token-contrast-auditor -a claude-code2Вручную: положить файлы
~/.claude/skills/token-contrast-auditor/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/token-contrast-auditor/
1Через Skills CLI (Vercel)
npx skills add ShuaiMXu/happyhands --skill token-contrast-auditor -a codex2Вручную: положить файлы
.agents/skills/token-contrast-auditor/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add ShuaiMXu/happyhands --skill token-contrast-auditor -a cursor2Вручную: положить файлы
.cursor/skills/token-contrast-auditor/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install ShuaiMXu/happyhands skills/product-design/token-contrast-auditor2Вручную: положить файлы
.github/skills/token-contrast-auditor/SKILL.md1Через Skills CLI (Vercel)
npx skills add ShuaiMXu/happyhands --skill token-contrast-auditor -a gemini-cli2Командой платформы
gemini skills install https://github.com/ShuaiMXu/happyhands --path skills/product-design/token-contrast-auditorВручную: положить файлы
.devin/skills/token-contrast-auditor/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Claude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о token-contrast-auditor
Как установить token-contrast-auditor в Claude Code?
Выполните команду npx skills add ShuaiMXu/happyhands --skill token-contrast-auditor -a claude-code в терминале вашего проекта.
Что делает token-contrast-auditor?
Скилл вычисляет коэффициент контрастности для заданных пар цветов и сравнивает его с нормами WCAG 2.2, выявляя потенциальные проблемы с доступностью интерфейса.
Что нужно для работы token-contrast-auditor?
Необходимы наличие дизайн-системы с цветовыми токенами, исходный код компонентов и файлов стилей.
Исходный текст
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