mcpField

A11y Audit Until Clean

FeaturedOn demand
Code QualityUp to 8 rounds

About A11y Audit Until Clean

This loop cleans up accessibility problems in changed UI. Each round runs the accessibility audit, then edits code based on the report, for at most 8 rounds.

Key features

  1. 01Manual trigger, so the user decides when it starts
  2. 02Judges success by the exit code of npm run test:a11y
  3. 03Capped at 8 rounds to avoid endless retries
  4. 04Currently supports Cursor

Use cases

  1. 01Before submitting a PR with UI changes
  2. 02After adding a new form or dialog component
  3. 03Working through serious violations in an audit report
Goal
Changed UI has zero serious accessibility violations, as confirmed by the audit command.
Exit when
Stop when npm run test:a11y exits 0, or after 8 rounds if it still fails.
Between iterations run
npm run test:a11y

Launch prompt

Paste into Cursor. The agent repeats the steps below until the exit condition is met.

prompt.md
Start the "A11y Audit Until Clean" loop.
Goal: Changed UI has zero serious accessibility violations, as confirmed by the audit command.
Max iterations: 8.
Step 1: Run the a11y audit — Execute npm run test:a11y and read the reported violations. If the command exits 0, the check has passed and the loop ends. `npm run test:a11y`
Step 2: Locate serious violations — Pick out the serious issues that relate to the changed UI and trace them to the affected components and elements.
Step 3: Edit the code — Make a minimal fix for each issue, such as adding a label, adjusting contrast or correcting semantic structure, then move on to the next round and audit again.
Between iterations run: `npm run test:a11y`
Exit when: Stop when npm run test:a11y exits 0, or after 8 rounds if it still fails.

Steps

Each round runs in order; if the exit condition isn’t met, another round starts, up to 8.

01
Run the a11y audit

Execute npm run test:a11y and read the reported violations. If the command exits 0, the check has passed and the loop ends.

$npm run test:a11y
02
Locate serious violations

Pick out the serious issues that relate to the changed UI and trace them to the affected components and elements.

03
Edit the code

Make a minimal fix for each issue, such as adding a label, adjusting contrast or correcting semantic structure, then move on to the next round and audit again.

Not met → next roundExits when met

Supported agents

Coding agents that can run this loop directly.

Cursor
Claude Code

Comments

Markdown supported