Accessibility Check
Audit frontend code for WCAG 2.1 AA compliance. Triggers on phrases like 'a11y check', 'accessibility audit', 'check WCAG', or when reviewing JSX/TSX components in the frontend/ tree. Reports ARIA mis
SKILL.md.claude/skills/skill-accessibility-check/SKILL.md
GitHubPurpose
Provide fast, local, deterministic WCAG 2.1 AA feedback on Next.js/React components before they reach CI or manual QA. The skill does not replace axe-core or Pa11y CI; it catches the top-N recurring a11y defects early and names the exact fix.
When to Invoke
- A developer is editing a component under
frontend/src/components/orfrontend/src/app/. - A PR touches JSX/TSX and the author says "a11y check" or "accessibility audit".
- A reviewer wants a structured a11y report on a file or changed range.
- Before requesting accessibility sign-off on a feature flagged for launch.
When NOT to Invoke
- For non-frontend files (API, Terraform, Alembic).
- As a substitute for axe-core runs in CI — this is fast feedback, not certification.
- On generated files (
.next/,node_modules/, snapshots).
Inputs
- target: active file, an explicit path (e.g.
frontend/src/components/search/SearchBar.tsx), orgit diffrange. - scope (optional):
file(default) orchanged(only the added lines from the current diff).
Procedure
- Resolve target file(s). If none provided, use the active editor file. Refuse non-
.tsx|.ts|.jsx|.jsfiles. - Read the file(s). Collect component names, JSX elements, handlers.
- Run the following deterministic checks:
<img>andnext/imagewithoutalt=<button>nested in<a>or vice versa- Clickable
<div>/<span>withoutrole+tabIndex={0}+ key handler - Form controls without associated
<label htmlFor>oraria-label aria-*attributes on elements that do not support them (cross-reference ARIA-in-HTML allowed list)- Missing
langon any custom<html>usage - Heading-order skips within the same component (h1 to h3)
- Icon-only buttons without
aria-label onClickwithout keyboard equivalent (onKeyDown/onKeyUp)- Color literals (
#xxxxxx) bypassing USWDS tokens — flag for contrast review
- Cross-reference against
documentation/rules/frontend-*.mdfor project-specific directives. - Emit the Output Format below. Do not modify files.
Outputs
Accessibility Check — frontend/src/components/search/SearchBar.tsx
WCAG target: 2.1 AA
Findings (3):
[ERROR] L42 Icon-only <button> missing aria-label
Fix: <button aria-label="Clear search"> ...
WCAG: 4.1.2 Name, Role, Value
[WARN] L58 onClick on <div> without keyboard handler
Fix: convert to <button type="button"> or add onKeyDown
WCAG: 2.1.1 Keyboard
[INFO] L71 Hard-coded color #0050d8 — use USWDS token
Fix: color-primary (token in frontend/src/styles/_uswds-theme.scss)
Summary: 1 error, 1 warning, 1 info. Block merge: yes.
Exit convention: error count > 0 → block; warn → comment; info → advisory.
Safety
- Read-only. Never rewrites files.
- Never claims the component is "fully accessible" — this is a lint-grade pass, not an audit.
- Flags but does not resolve contrast ratios; defers to USWDS tokens.
- Never invents ARIA roles. If uncertain, recommends removing the attribute.
- PII: never emit component text content containing user data in reports.
Examples
Example 1 — Active file audit
Developer opens OpportunityCard.tsx and types "a11y check". Skill reports a missing alt on the agency logo next/image and flags <div onClick> on the card wrapper; suggests <article> with <button> inside.
Example 2 — Diff-scoped audit
/skill-accessibility-check scope=changed before pushing. Skill reads git diff --unified=0 for staged changes and reports only on added lines, useful for hot-fix PRs.
Example 3 — Cross-referenced with conventions
Finding includes a link back to documentation/rules/frontend-components.md when a violation matches a MUST directive there.
Related
.cursor/agents/visual-regression.md— pairs well for launch QA..cursor/skills/skill-cross-browser-checklist/— run together before release./check-conventions— catches non-a11y frontend rule violations.