.claude/skills/accessibility-review/SKILL.md
Audits Rails application accessibility against WCAG 2.2 Level AA, detects violations with axe-core / Lighthouse / Pa11y, and reports remediation guidance for ERB views, ViewComponents, Stimulus controllers, and Turbo-powered interactions. Use when the user wants an accessibility audit, WCAG compliance check, a11y review, or mentions screen readers, keyboard navigation, ARIA, color contrast, or Section 508 / ADA / EAA. WHEN NOT: Implementing fixes (use viewcomponent-agent, stimulus-agent, tailwind-agent), running a security audit (use security-audit), or general code review (use code-review).
npx skillsauth add ThibautBaissac/rails_ai_agents accessibility-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an expert in web accessibility, WCAG 2.2 Level AA, WAI-ARIA authoring practices, and Rails/Hotwire UI patterns. You NEVER modify code — you only read, analyze, and report findings with remediation guidance.
WCAG 2.2 Level AA (W3C Recommendation, October 2023) is the enforceable baseline for ADA Title II, Section 508, and the EU Accessibility Act (in force since 2025-06-28). WCAG 3.0 remains a Working Draft and is not yet conformance- eligible — flag it only as forward-looking context.
Evaluate using the POUR principles:
# axe-core via RSpec system specs (covers ~30–40% of WCAG issues)
bundle exec rspec spec/system/ --tag a11y
# Lighthouse CI (optional — if configured)
npx lighthouse <url> --only-categories=accessibility --quiet
# Pa11y CLI (optional — if configured)
npx pa11y --standard WCAG2AA <url>
# Herb Linter for ERB structural / a11y issues (if configured)
bundle exec herb lint app/views app/components
Treat automated results as facts, not the whole picture. Automated tools catch roughly 30–57% of issues; keyboard + screen-reader + manual review is mandatory for the rest.
Inspect these paths for WCAG 2.2 issues:
app/views/**/*.html.erbapp/components/**/*.{rb,html.erb}app/javascript/controllers/**/*.js (Stimulus — focus, live regions, keys)app/assets/stylesheets/ and Tailwind classes (contrast, focus rings)app/helpers/ (avoid generating non-semantic markup)For each finding use: Issue → WCAG SC (e.g. 1.4.3 Contrast Minimum) → Location (file:line) → Impact (who is affected and how) → Fix (code example).
<%# Bad — decorative image announced to screen readers %>
<%= image_tag "icon-arrow.svg" %>
<%# Good — meaningful image %>
<%= image_tag "chart.png", alt: "Monthly revenue trend, Jan to Mar 2026" %>
<%# Good — decorative image hidden from AT %>
<%= image_tag "icon-arrow.svg", alt: "", role: "presentation" %>
<%# Bad — styled div posing as heading %>
<div class="text-2xl font-bold">Settings</div>
<%# Good — semantic heading in correct order %>
<h2 class="text-2xl font-bold">Settings</h2>
<%# Bad — gray-400 on white ≈ 2.8:1, fails AA (needs 4.5:1 for body text) %>
<p class="text-gray-400">Saved 3 minutes ago</p>
<%# Good — gray-600 on white ≈ 4.7:1 %>
<p class="text-gray-600">Saved 3 minutes ago</p>
UI component and state indicators (focus rings, input borders, icons conveying meaning) require ≥ 3:1 contrast.
<%# Bad — div with click handler, unreachable by keyboard %>
<div data-action="click->modal#open">Open</div>
<%# Good — real button, keyboard-activatable and announced %>
<button type="button" data-action="click->modal#open">Open</button>
<%# Bad — removes focus indicator entirely %>
<button class="focus:outline-none">Save</button>
<%# Good — visible, high-contrast focus ring %>
<button class="focus:outline-none focus-visible:ring-2
focus-visible:ring-blue-600 focus-visible:ring-offset-2">
Save
</button>
Sticky headers, cookie banners, and Turbo-driven toasts must not fully cover the currently focused element. Check with keyboard navigation through long forms.
Interactive targets must be at least 24×24 CSS pixels (with spacing exceptions). Icon-only buttons often fail.
<%# Bad — 16px icon button %>
<button class="p-0"><%= inline_svg "x.svg", class: "h-4 w-4" %></button>
<%# Good — padded to ≥ 24×24 %>
<button class="p-2" aria-label="Close">
<%= inline_svg "x.svg", class: "h-4 w-4" %>
</button>
<%# Bad — placeholder-as-label; vanishes on input %>
<%= f.email_field :email, placeholder: "Email" %>
<%# Good — explicit label associated by `for`/`id` %>
<%= f.label :email %>
<%= f.email_field :email, autocomplete: "email" %>
<%# Good — errors linked via aria-describedby, live region announces them %>
<%= f.label :email %>
<%= f.email_field :email,
"aria-invalid": user.errors[:email].any?,
"aria-describedby": ("email-error" if user.errors[:email].any?) %>
<% if user.errors[:email].any? %>
<p id="email-error" role="alert" class="text-red-700">
<%= user.errors[:email].to_sentence %>
</p>
<% end %>
Prefer native elements. Use ARIA only to fill gaps HTML cannot express, and follow the ARIA Authoring Practices patterns verbatim.
<%# Bad — invented role; no keyboard semantics %>
<div role="button" onclick="...">Delete</div>
<%# Good — real button %>
<%= button_to "Delete", entity_path(@entity), method: :delete,
data: { turbo_confirm: "Delete this entity?" } %>
<%# Good — flash region announces updates without moving focus %>
<div id="flash" role="status" aria-live="polite" aria-atomic="true">
<%= flash[:notice] %>
</div>
When Turbo Stream replaces the region, screen readers announce the new text.
Use role="alert" / aria-live="assertive" only for errors.
<h1> by
default — implement a Stimulus controller that focuses the main landmark or
announces the route change, otherwise 2.4.3 Focus Order fails.turbo:frame-load.<dialog> element (or a library
that traps focus, restores it on close, and hides background from AT).aria-expanded, aria-controls, roving tabindex, and Escape/arrow keys
per the ARIA Authoring Practices Guide.be_axe_clean.aria-label or visually-hidden text.hidden when content must remain reachable by AT during animation —
prefer aria-hidden="true" and inert with care.sr-only for screen-reader text; never display:none for
content that should be announced.alt; decorative use alt=""<html lang="..."> set; language changes marked (3.1.1, 3.1.2)autocomplete (1.3.5, 3.3.2)ids; proper nesting (4.1.1)This skill ships deep-dive material in references/. SKILL.md stays
lightweight; open these only when the current task needs that level of detail.
references/wcag-2.2-criteria.md — all 87 success criteria with Rails
notes. Load when mapping a finding to its exact SC or scoping an audit
by level.references/common-failures.md — expanded catalog of failure patterns
beyond the top offenders above. Load when the issue at hand is not in
the main SKILL.md remediation list.references/aria-patterns.md — ARIA Authoring Practices recipes
(disclosure, modal, menu, tabs, combobox, tooltip, toast, accordion)
translated to ERB + Stimulus. Load when reviewing or building a custom
widget.references/screen-reader-testing.md — NVDA / VoiceOver / JAWS smoke-
test playbook and Hotwire-specific checks. Load when planning a manual
test pass.references/rails-snippets.md — drop-in layouts, form remediations,
focus-on-navigate Stimulus controller, icon-button ViewComponent,
be_axe_clean spec helpers. Load when recommending concrete fixes.development
Creates Turbo Streams, Turbo Frames, and morphing patterns for real-time UI updates. Use when adding real-time updates, partial page rendering, form submissions, or broadcasting. WHEN NOT: For Stimulus JavaScript controllers (see stimulus-patterns skill). For general view conventions (see rules/views.md).
testing
Writes Minitest tests with fixtures following 37signals conventions. Uses Minitest (not RSpec) and fixtures (not factories). Use when writing tests, adding test coverage, or creating fixtures. WHEN NOT: For RSpec or FactoryBot patterns (this project uses Minitest + fixtures exclusively). For test configuration/CI setup (see project docs).
tools
Builds focused, single-purpose Stimulus controllers for progressive enhancement. Use when adding JavaScript behavior, UI interactions, form enhancements, or building reusable client-side components. WHEN NOT: For Turbo Stream/Frame patterns (see turbo-patterns skill). For server-side view logic (see rules/views.md).
testing
Implements the state-as-records-not-booleans pattern for rich state tracking. Use when modeling state changes, replacing boolean flags with record-based state, or when user mentions state records, closures, publications, or toggling state. WHEN NOT: Technical flags like cached/processed (use booleans), concern extraction (use concern-patterns), general model work (use model-patterns).