Skip to content
Back to skills

Accessibility Audit

ASecurity

Audit a web page, local file, or published artifact against WCAG 2.2 AA, then fix what it finds. Use whenever the user asks whether something is accessible, says "a11y", "WCAG", "ADA", "Section 508", "screen reader", "color contrast", "keyboard navigation", "tab order", or asks to run Lighthouse for accessibility - and also proactively right after building or restyling any page, because contrast and keyboard defects ship silently. Covers the theme matrix (one Lighthouse run only tests whichev...

  • 5 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 22, 2026
ai-agentspythonrustgobashdebugginggit

Works with

  • cli
  • mcp

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned December 5, 2026

npx -y skills add wormeyman/wormeyman-skills --skill accessibility-audit --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Accessibility Audit?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Accessibility Audit
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wormeyman-accessibility-audit/badge)](https://www.skillsdirectory.com/skills/wormeyman-accessibility-audit)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: accessibility-audit
description: Audit a web page, local file, or published artifact against WCAG 2.2 AA, then fix what it finds. Use whenever the user asks whether something is accessible, says "a11y", "WCAG", "ADA", "Section 508", "screen reader", "color contrast", "keyboard navigation", "tab order", or asks to run Lighthouse for accessibility - and also proactively right after building or restyling any page, because contrast and keyboard defects ship silently. Covers the theme matrix (one Lighthouse run only tests whichever theme the browser happens to be in), computed contrast sweeps, the checks Lighthouse does not run, and auditing published artifacts, which cannot be audited at their claude.ai URL.
---

# Accessibility Audit

Audit a page, report findings with severity, fix on approval, then re-run to prove the score moved.

## Relationship to `a11y-debugging`

The chrome-devtools plugin ships an `a11y-debugging` skill. It is good and this does not replace it. Split the work:

| Use `a11y-debugging` for | Use this skill for |
|---|---|
| Reading the accessibility tree | The theme matrix |
| Form labels, orphaned inputs | Computed contrast sweeps |
| ARIA attributes and roles | Checks Lighthouse omits entirely |
| Focus traps in modals | Auditing published artifacts |
| Per-element tap-target checks | The fix-and-verify loop |

If a page has forms, modals, or heavy ARIA, run that skill too. Do not re-derive its material here.

## The one rule that matters most

**Lighthouse only ever audits the theme the browser is currently rendering.** It does not test both. A theme-aware page audited once has been half audited, and the half you skipped is usually the worse one.

A real page scored **87 in dark mode with zero contrast findings**. Forced to light, the same page scored **77 with 41 failing elements**. The single run was not a smaller version of the truth. It was the wrong answer.

The score does not even have to move. The skill's fixture scores **62 in both themes**, and the contrast failures behind that identical number do not overlap. **A stable score across themes is not evidence the themes are equally sound.** Always run the matrix in Step 2.

---

## Step 1 - Get an auditable URL

Three cases. Pick the right one before running anything.

**A live site.** Audit the URL directly. Nothing to set up.

**A local file.** Serve it over HTTP. Never audit `file://` - Lighthouse behaves differently and some audits silently skip.

```bash
cd <dir> && python3 -m http.server 8731 --bind 127.0.0.1
```

Run it with `run_in_background: true`, and kill it when finished.

**A published artifact.** This is the case people get wrong. Pointing Lighthouse at `https://claude.ai/code/artifact/<uuid>` audits the claude.ai wrapper page, not your content. The score is meaningless.

Instead, wrap your source file in the same skeleton the publisher applies and serve that locally:

```html
<!doctype html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<style>*{margin:0;padding:0}</style></head>
<body>
<!-- your artifact source file, verbatim -->
</body></html>
```

Build a second copy with `<html lang="en">`. You author body content, not the `<html>` tag, so `html-has-lang` is the publisher's to fix and it costs 7 points. Auditing both copies separates your score from theirs - report the with-lang number as your content's true score and name the gap.

## Step 2 - Run the theme matrix

Never a single run. Desktop and mobile, each in every theme the page has:

| Run | Setup |
|---|---|
| Desktop light | `emulate` with `colorScheme: "light"`, then `lighthouse_audit` |
| Desktop dark | `emulate` with `colorScheme: "dark"`, then `lighthouse_audit` |
| Mobile light and dark | the same `emulate` call, then `lighthouse_audit` with `device: "mobile"` |

Mobile runs the same audits as desktop (76 on Lighthouse 13.7.0, measured 2026-12-04; `target-size` runs on both). It is worth running because the page itself changes at 412px: a menu button appears, tables stack, columns hide. Lighthouse has no reflow audit at all; the 320px check is in Step 4.

`emulate` persists across navigations, so run everything for one theme before switching. **But each `emulate` call resets every setting it leaves out.** A later call with only a viewport puts the theme back to the system's, and one with only `colorScheme` puts the viewport back to the window's width. So pass every setting you need in each call, and read the theme back (Step 4, Reflow, shows how).

No chrome-devtools MCP (CI, a git hook, a headless box)? Use the Lighthouse CLI, and read `references/lighthouse-cli.md` before the first CLI run. With no theme flag the CLI audits the **dark** theme. That file has the flag for each theme and for a true 320px run.

### A page with a theme toggle

**`emulate` sets the system theme, and a toggle overrides it.** A toggle usually writes a class or a `data-theme` attribute on `<html>`, and its CSS beats the `prefers-color-scheme` rule. So the two system runs above test what the page does when the toggle is left alone. They never test the toggle's own light and dark, and a toggle can paint its own set of colours.

Add the two crossed runs, so the matrix is four desktop runs plus mobile:

| Run | Setup |
|---|---|
| Toggle light, system dark | `emulate` dark, press the toggle until the page is light, then audit |
| Toggle dark, system light | `emulate` light, press the toggle until the page is dark, then audit |

- **Read back what the page painted, not `matchMedia`.** `matchMedia` reports the system setting, so it says "dark" while a toggle shows light. Read the toggle's attribute (`document.documentElement.dataset.theme`) and the body's background colour instead.
- **A navigation audit reloads the page.** If the toggle saves its choice (usually in `localStorage`), the reload keeps it. If it does not, the reload throws the choice away. Then run `lighthouse_audit` with `mode: "snapshot"` after pressing the toggle, and run the contrast sweep the same way.

### Reading the results

- **A run reporting 0 across every category, with 0 passed *and* 0 failed, is a failed run, not a score.** Nothing was measured. Check `runtimeError` in the JSON and retry before you conclude anything. A genuine 0 and a failed run look identical in the summary, and only one of them is worth reporting.
- `lighthouse_audit` rejects `outputDirPath` outside the configured workspace roots. Omit it and take the temp path from the result, then copy the HTML report somewhere durable if you want to keep it.
- The result summary's "Failed: N" counts every category, not just accessibility. Read the JSON for the real accessibility failures.
- Never read `report.json` raw. It runs to hundreds of KB. Extract with the script in `references/scripts.md`.

## Step 3 - Sweep contrast by computation

Lighthouse samples. It also cannot see a failure in the theme it did not render. Compute contrast yourself against what the browser actually painted.

Run the **contrast sweep** from `references/scripts.md` via `evaluate_script`, once per theme. It walks every text-bearing element, resolves the real effective background by climbing ancestors until it finds a non-transparent one, and applies the correct threshold for that element's computed size and weight (3:1 for large text, 4.5:1 otherwise).

It reports exact ratios, which is what you need to pick a replacement color.

**It also composites `opacity`.** `opacity` fades the painted text toward its background and leaves `getComputedStyle(el).color` completely unchanged, so a sweep that reads the computed colour reports a clean pass on text that fails. On a page already scoring 100 in both themes, an `opacity: .82` label put three light-theme cases under 4.5:1, worst 3.78, while a computed-colour sweep reported zero failures. Check the `alpha` field on any finding - below 1 means the fade is part of the cause. This applies to your own fixes too: dimming a newly added label is the easiest way to introduce a failure while the tooling insists nothing changed.

Lighthouse's contrast audit (axe) also composites `opacity`, so neither tool is better at everything. The sweep adds exact ratios, every element instead of a sample, and whichever theme you point it at. When the two disagree, find out which is right before believing either.

**If you are also authoring the page, check the palette before building.** Contrast is far cheaper to fix in six token values than in 41 rendered elements. Run the **token pre-check** from `references/scripts.md` against your palette, in both themes, before writing components. Test each foreground against the *darkest* light surface and the *lightest* dark surface - those are the worst cases, and a token that clears white may still fail on a tinted panel.

## Step 4 - Run what Lighthouse does not

These are real WCAG failures with no Lighthouse audit behind them. Run the **structural check** from `references/scripts.md`, then verify by hand:

- **Keyboard access to scrollable regions.** Any `overflow-x: auto` container holding a wide table or code block needs `tabindex="0"`, a role and a label. Lighthouse does not run axe's `scrollable-region-focusable` rule at all. Chrome (158, measured) lets Tab reach a scroller with nothing focusable inside even without `tabindex`, so a hand test in Chrome can reach a region the structural check flags. That is not a contradiction: not every browser does this, and the region still has no name.
- **Table header semantics.** `th` without `scope`, and first-column cells marked up as `td` when they are functionally row headers. Lighthouse's table audits return "not applicable" and tell you nothing.
- **Color as the only signal.** Status shown by red text alone, a colored rail with no text label, a chart series distinguished only by hue. Run the **polarity probe** from `references/scripts.md`, then read what it surfaces.
  The trap is the **full** cell, not the empty one. `+$1,000` and `+$130` are both complete, correct values, and on a real page one was good news and the other bad, told apart only by green or red. **Ask whether the text alone reveals which direction is better.** A signed number, a bare percentage, a date, a name: none of them carry polarity. For the fix, and why `aria-label` is the wrong one, read "The hard case" in `references/fixes.md`.
- **Two colors encoding opposite states.** Run the **status-pair luminance check** from `references/scripts.md`. Contrast tools compare each color to its background; both can pass and still be the same brightness as each other, leaving hue as the only difference. Greyscale and color vision deficiency both erase hue.
- **A light and dark mode toggle.** This is not a WCAG item: report a missing one as a recommendation. When the structural check lists `themeToggle` candidates, run the crossed rows in Step 2, then check each candidate against "No light and dark mode toggle" in `references/fixes.md`.
- **Focus visibility.** Reload the page, then Tab through it from the top. The structural check focuses elements as it runs, so without a reload the first Tab starts wherever it stopped. Anything focusable needs a visible `:focus-visible` state, including containers you just gave `tabindex="0"`.
- **Reflow.** At 320px wide, the page body must not scroll sideways. Wide content scrolls inside its own container. **Use `emulate` to get to 320px, not `resize_page`** - `resize_page` sets the browser window, which has a floor around 500px on macOS and silently gives you a 500px viewport while reporting success. Ask the page what it actually got:

  ```js
  // set BOTH in one call - see below
  emulate({ viewport: "320x800x2,mobile,touch", colorScheme: "light" })
  // then confirm, before trusting anything measured at this size
  evaluate_script(() => ({ width: innerWidth,
    scheme: matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light',
    sideways: document.documentElement.scrollWidth > document.documentElement.clientWidth }))
  ```

  A run that believes it tested 320 and actually tested 500 will pass a page that breaks on a real phone.

  **This is where the reset rule from Step 2 bites.** Measured: `emulate({colorScheme:"light"})`, then `emulate({viewport:"320x800x2,mobile,touch"})`, and the page read back `scheme: "dark"`. The reflow run had silently changed theme, so it was a dark 320px run wearing a light label. Pass both settings in the one call, and read `width` and `scheme` back every time.

  If `width` reads 980 instead of 320, the emulation worked and the page has no `<meta name="viewport">`. Phones will show it as a shrunken desktop page. That is a finding, not a failed run.

## Step 5 - Report

Group by severity, and state clearly which findings are yours to fix versus the host's. A score with an unexplained cap is not useful information.

Report per theme. "95 in both themes" and "95 light, 77 dark" are very different results.

**If the page ships no `prefers-color-scheme` rules at all, say the matrix was confirmatory.** Plenty of sites have one theme. Reporting three identical runs as though they were three independent findings overstates the work and buries the real ones. Say the site has a single theme, that you verified it rather than assumed it, and move on. The structural check reports `prefersDarkSupported` for exactly this call - but treat a `false` there as a prompt to confirm by running the other theme, never as permission to skip it.

**A page with two themes and no toggle gets a recommendation, not a failure.** Say so in plain words, and keep it apart from the WCAG findings so it does not read as a failing grade.

**Compare failure lists across devices, not scores.** Desktop and mobile run the same audits, so a different score means a different element failed at 412px. Find which one before reporting the gap.

## Step 6 - Fix, then verify

Before changing any markup or CSS, find the matching entry in `references/fixes.md`. Apply fixes, then **re-run the full matrix**. A fix verified in one theme is not verified.

State the before and after numbers per theme. If a number did not move, say so rather than implying it did.

## Red flags

| Thought | Reality |
|---|---|
| "Lighthouse says 95, we're good" | In which theme? Run the matrix. |
| "The contrast audit passed" | It only checked the rendered theme, and it samples. Sweep it. |
| "The sweep reported zero failures" | Does it composite `opacity`? A faded label fails while computed colour looks fine. |
| "I resized the window to 320px" | `resize_page` floors near 500 on macOS. Use `emulate` and read back `innerWidth`. |
| "I ran `npx lighthouse` and it scored 95" | That was the **dark** theme. The CLI defaults to it. Pass `preferredColorScheme` both ways. |
| "The polarity count didn't move, so the probe is broken" | Or your label has no leading space and really is one word. Read an element's `textContent`. |
| "I'll audit the artifact URL" | That audits claude.ai's wrapper. Serve it locally. |
| "No tables or forms, so semantics are fine" | Scroll containers and heading order still fail silently. |
| "It's a static page, keyboard access is moot" | Scrollable regions are interactive whether you intended it or not. |
| "I'll read the Lighthouse JSON to find failures" | It is hundreds of KB. Use the extractor. |
| "Score went 77 to 95, done" | Re-run every theme. And name what caps the remaining 5. |
| "It scored 0, the page must be broken" | 0 with nothing passed and nothing failed means the run failed. Check `runtimeError` and retry. |
| "Desktop 96, mobile 95, close enough" | Something failed only at 412px. Compare failure lists, not scores. |
| "I emulated dark and light, so both themes are tested" | Not on a page with a toggle. `emulate` sets the system theme; the toggle's own light and dark are the crossed runs in Step 2. |
| "`matchMedia` says dark, so the page is dark" | It reports the system setting. A toggle can show light at the same time. Read the attribute and the painted background. |

## Verifying this skill still works

After changing this skill or anything in `references/`, read `references/verifying.md` and run the full workflow against `references/fixture.html`. A missed defect that a script should catch means the skill has regressed.

## References

- `references/scripts.md` - contrast sweep, token pre-check, structural check, Lighthouse JSON extractor, polarity probe, status-pair luminance check
- `references/fixes.md` - finding-to-fix patterns, including the theme toggle checklist
- `references/lighthouse-cli.md` - running Lighthouse without the MCP: theme flags, 320px runs, MCP or CLI
- `references/verifying.md` - what a run against the fixture should find
- `references/fixture.html` - page with planted defects, for verifying this skill still works

Files in this skill

  • SKILL.md17.6 KB
  • references/fixes.md6.5 KB
  • references/fixture.html6.8 KB
  • references/scripts.md15.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.