skills/accessibility-ci/SKILL.md
--- name: accessibility-ci description: Ship accessibility as a CI gate, not a hope. Wires axe-core unit tests (jest-axe or vitest-axe), @axe-core/playwright e2e, Lighthouse CI, aria-live regions for async state, and focus management in modals. Use right after `/ro:cf-ship` as part of `/ro:app-polish` check #7. category: quality-review argument-hint: [--runner vitest|jest] [--lighthouse] [--skip-e2e] allowed-tools: Bash(*) Read Write Edit Glob Grep content-pipeline: - pipeline:review - platf
npx skillsauth add RonanCodes/ronan-skills skills/accessibility-ciInstall 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.
Ship accessibility checks as code, not as a one-time audit. The three-layer stack catches ~80% of real issues:
vitest-axe / jest-axe on critical components.@axe-core/playwright on key flows.Manual testing (screen reader, keyboard navigation) catches the rest. This skill wires the automated layers; the manual layer is a checklist, not automation.
/ro:accessibility-ci # full install: unit + e2e + lighthouse + aria patterns
/ro:accessibility-ci --runner jest # jest-axe instead of vitest-axe
/ro:accessibility-ci --lighthouse # add Lighthouse CI only
/ro:accessibility-ci --skip-e2e # skip Playwright axe wiring
vitest-axe or jest-axe with a helper for component-level tests.@axe-core/playwright for e2e on critical routes.@lhci/cli with PR thresholds for a11y + performance.aria-live regions on async state containers (loading, error, fetched content).pnpm add -D vitest-axe axe-core @testing-library/react
// src/test/axe-helper.ts
import { axe, toHaveNoViolations } from 'vitest-axe'
import { expect } from 'vitest'
expect.extend({ toHaveNoViolations })
export async function expectNoA11yViolations(container: HTMLElement) {
const results = await axe(container)
expect(results).toHaveNoViolations()
}
Test example:
// src/components/ShareButton.test.tsx
import { render } from '@testing-library/react'
import { ShareButton } from './ShareButton'
import { expectNoA11yViolations } from '@/test/axe-helper'
test('ShareButton is accessible', async () => {
const { container } = render(<ShareButton puzzleDate="2026-04-12" />)
await expectNoA11yViolations(container)
})
What to cover:
role= or aria-* attributes you added manually.aria-label).What NOT to cover: every leaf component. Axe is fast but it's not the unit test's job to re-check every render.
pnpm add -D @axe-core/playwright
// e2e/accessibility.spec.ts
import { test, expect } from '@playwright/test'
import AxeBuilder from '@axe-core/playwright'
const routes = ['/', '/how-it-works', '/api/docs']
for (const route of routes) {
test(`a11y: ${route}`, async ({ page }) => {
await page.goto(route)
const results = await new AxeBuilder({ page })
.withTags(['wcag2a', 'wcag2aa', 'wcag21aa'])
.analyze()
expect(results.violations).toEqual([])
})
}
Tag choice matters. wcag2aa is the usual bar. Skipping wcag2aaa (stricter) is fine — almost nothing passes AAA without deliberate tradeoffs.
Common false positives:
color-contrast on disabled buttons — axe flags these. Use .exclude('[disabled]') if the contrast is deliberate per your design system.region on landmarks — if your app is a single-page utility, axe may want a <main> wrapper.pnpm add -D @lhci/cli
// lighthouserc.json
{
"ci": {
"collect": {
"startServerCommand": "pnpm preview",
"url": ["http://localhost:4173/", "http://localhost:4173/how-it-works"],
"numberOfRuns": 3
},
"assert": {
"assertions": {
"categories:accessibility": ["error", { "minScore": 0.95 }],
"categories:best-practices": ["warn", { "minScore": 0.9 }],
"categories:seo": ["warn", { "minScore": 0.9 }],
"categories:performance": ["warn", { "minScore": 0.8 }]
}
},
"upload": {
"target": "temporary-public-storage"
}
}
}
Accessibility score as error at 0.95 means the PR blocks on regression. Other categories as warn lets the team see scores without failing builds on routine fluctuation.
# .github/workflows/accessibility.yml
name: Accessibility
on: [pull_request]
jobs:
a11y:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm test:unit
- run: pnpm exec playwright install --with-deps chromium
- run: pnpm build
- run: pnpm exec playwright test e2e/accessibility.spec.ts
- run: pnpm exec lhci autorun
pnpm test:unit covers the vitest-axe assertions; the Playwright step covers e2e axe; Lighthouse runs last against the built app.
aria-live on async stateAny region that updates after initial render (loading spinner → content, error messages, toast notifications) needs aria-live so screen readers announce the change.
<div role="status" aria-live="polite" aria-busy={isLoading}>
{isLoading && <span>Loading definitions…</span>}
{error && <span role="alert">Failed to load: {error.message}</span>}
{definitions && <DefinitionsList items={definitions} />}
</div>
polite vs assertive:
polite waits for the user to finish what they're saying. Use for most updates.assertive interrupts. Use only for errors or urgent alerts (role="alert" is already assertive).aria-busy toggles off announcements during active loads so the screen reader doesn't read every progressive render.
Most dialog primitives (Radix Dialog, Headless UI Dialog) handle this. If hand-rolling:
const triggerRef = useRef<HTMLButtonElement>(null)
const dialogRef = useRef<HTMLDivElement>(null)
useEffect(() => {
if (open) {
dialogRef.current?.querySelector<HTMLElement>('[data-autofocus]')?.focus()
} else {
triggerRef.current?.focus()
}
}, [open])
<main>TanStack Router:
// src/routes/__root.tsx
import { useEffect } from 'react'
import { useRouter } from '@tanstack/react-router'
function FocusManager() {
const router = useRouter()
useEffect(() => {
const unsub = router.subscribe('onResolved', () => {
document.getElementById('main-content')?.focus()
})
return unsub
}, [router])
return null
}
With <main id="main-content" tabIndex={-1}> in the shell.
First focusable element on the page should be a skip link:
<a
href="#main-content"
className="sr-only focus:not-sr-only focus:absolute focus:top-0 focus:left-0 focus:p-2 focus:bg-white focus:z-50"
>
Skip to main content
</a>
Invisible until focused (via tab). Every page should have one.
prefers-reduced-motion?| Violation | Fix |
|---|---|
| button-name | Icon-only button missing aria-label. Add aria-label="Share". |
| color-contrast | Text too light on background. Darken or thicken the text, don't just add bold. |
| label | Input missing a label. Wrap in <label> or use aria-labelledby. |
| image-alt | <img> without alt. Decorative → alt="", informative → descriptive alt. |
| landmark-one-main | No <main> element. Wrap the main content. |
| heading-order | Skipping heading levels (h1 → h3). Use semantic levels, style with CSS. |
| aria-valid-attr-value | Typo'd aria attribute value. Usually aria-expanded="true" vs aria-expanded={true} in JSX. |
aria-label typos before Playwright or Lighthouse ever run.disabledRules: ['color-contrast'], first ask whether the design is wrong.<input> that looks labelled in JSX may not be — check the rendered DOM./ro:app-polish — umbrella; this is check #7/ro:keyboard-shortcuts — complementary; focus + keyboard nav live together/ro:visual-regression — catches focus-ring regressions that axe misses/ro:playwright-check — the underlying browser tooldevelopment
--- name: worktree description: Coordinate multiple agents on one repo via a worktree-lock pool, so two agents never clobber each other's working tree. Acquire the first free slot (main, then beta/gamma… worktrees, created on demand), work there on your own branch, release when you've pushed. Use before modifying any repo that might be in use by another agent (factory, dataforce, etc.), or whenever you're told a repo is being worked on. Backed by `ro worktree`. category: development argument-hin
testing
--- name: ship description: Ship a feature branch the local-CI-first way — run the full local gate, push, open a PR, squash-merge, then deploy, without waiting on GitHub Actions. Use when a branch is ready for main and you want it merged and deployed now. Reads CI policy from `ro ci` (default skips remote CI because GitHub Actions billing keeps hitting limits). Sibling to /ro:gh-ship (waits on GitHub checks) and /ro:cf-ship (the deploy half). Triggers on "ship it", "ship this", "merge and deploy
testing
--- name: setup-logging description: Set up (or audit) the observability stack in a TanStack Start + Cloudflare Workers app so it is "diagnosable by default" — structured logging (logtape) with a request context carrying trace_id + userId + tenant/orgId, a trace_id propagated FE→BE→logs→Sentry→PostHog, Cloudflare Workers observability enabled, and Sentry + PostHog wired. Two modes: `setup` (wire it into an app) and `audit` (check an existing app + report gaps). Use when scaffolding a new app, wh
development
Manage credentials INSIDE the active ~/.claude/.env file — read which token/account to use for a given app (Simplicity vs Dataforce vs Ronan-personal), add or update a secret WITHOUT it passing through the chat (an interactive Terminal window prompts for it), and track secrets that were exposed in a transcript so they get rotated. Sibling to /ro:context (which switches WHICH env file is active). Use when the user wants to add an API key/token/secret, asks "which credential do I use for X", needs the env organized/labelled, or a secret was pasted into the chat and should be rotated.