Sunday, April 5

Web Accessibility Checker: The Claude Code Agent That Audits Your UI Before Users Do

Accessibility bugs are brutal to find late. A designer closes a ticket, a developer ships the feature, QA passes it, and then six months later you get a support ticket from a screen reader user who can’t complete your checkout flow. Or worse — legal correspondence. The average WCAG audit from a third-party firm runs thousands of dollars and takes weeks. And even then, the remediation work lands back on your developers with a PDF full of jargon and no code examples.

The Web Accessibility Checker agent for Claude Code changes that calculus entirely. It operates as a WCAG compliance specialist embedded directly in your development workflow — capable of auditing HTML structure, analyzing color contrast ratios, validating keyboard navigation, and generating concrete remediation code before anything ships. This isn’t a linter plugin that flags missing alt attributes. It’s a specialist that understands the intent behind WCAG success criteria and can explain exactly how to fix a violation in your specific codebase.

For senior developers who’ve inherited legacy frontends, work in regulated industries, or simply want to build products that don’t exclude 1.3 billion people with disabilities, this agent is worth understanding deeply.

When to Use the Web Accessibility Checker

This agent is explicitly marked as PROACTIVE — meaning you should be reaching for it before problems emerge, not after. Here are the scenarios where it delivers the most value:

New Feature Development

Before merging a new modal, form, or interactive component, run it through the agent. Custom components like date pickers, carousels, and autocomplete fields are notoriously difficult to make accessible. The agent can review your component code, flag ARIA misuse, and suggest corrections before the PR lands.

Legacy Codebase Audits

You’ve inherited a five-year-old React app with zero accessibility consideration. Running a comprehensive audit manually would take days. The agent can systematically work through your component library and generate a prioritized compliance report, separating critical A-level violations from AA and AAA issues so your team can triage effectively.

Design System Validation

When your design team delivers a new color palette or updated typography scale, you need to verify contrast ratios before they propagate across hundreds of components. The agent handles WCAG contrast ratio calculations and flags combinations that fail the 4.5:1 (AA) or 7:1 (AAA) thresholds for normal text.

Pre-Release Compliance Checks

Government contractors, healthcare platforms, education tools, and financial applications often face legal accessibility requirements under ADA, Section 508, or EN 301 549. The agent can produce structured audit reports mapping violations to specific WCAG success criteria — the kind of documentation that satisfies compliance requirements and legal review.

Onboarding New Frontend Developers

Junior developers rarely have deep accessibility knowledge. Embedding this agent in your workflow gives them an expert reviewer that explains why something is wrong, not just that it is — accelerating their learning and reducing rework cycles.

Real-World Examples

Scenario: Auditing a Navigation Component

A developer has built a custom mega-menu navigation component and wants to verify WCAG compliance before merging to main.

Developer: Can you audit this navigation component for accessibility issues?

[pastes component HTML and CSS]

Agent: I've reviewed the component. Here are the critical issues:

1. **Missing ARIA landmark** — Your <nav> element lacks an aria-label. 
   When multiple nav elements exist on a page, screen readers can't 
   distinguish them. Add aria-label="Main navigation" or 
   aria-labelledby pointing to a heading.

2. **Keyboard trap in submenu** — The dropdown submenus aren't reachable 
   via keyboard. Users pressing Tab skip directly to the next top-level item. 
   Implement the disclosure navigation pattern: add aria-expanded and 
   aria-controls to parent items, and handle ArrowDown/ArrowUp/Escape 
   key events to move focus into and out of submenus.

3. **Focus indicator suppressed** — Your CSS includes outline: none on 
   focus states. This fails WCAG 2.4.7 (Focus Visible) at AA level. 
   Replace with a custom high-contrast focus ring:

   :focus-visible {
     outline: 3px solid #005fcc;
     outline-offset: 2px;
   }

4. **Color contrast failure** — The hover state text (#767676 on #ffffff) 
   produces a 4.48:1 ratio, which passes AA for large text but fails for 
   the 14px normal-weight links in your submenu. Darken to #595959 to 
   achieve the required 4.5:1 minimum.

Recommended remediation order: keyboard trap (critical), focus indicator 
(critical), contrast fix (AA required), ARIA landmark (best practice).

Scenario: Form Accessibility Review

A team is building a multi-step registration form and wants to verify error handling works with screen readers.

Developer: Our form validation shows error messages next to fields, but 
users are reporting that NVDA doesn't announce errors. What's wrong?

Agent: This is a common issue. The errors are visually present but not 
announced because they're added to the DOM dynamically without notifying 
assistive technologies. Here's the fix:

1. Add role="alert" or aria-live="polite" to your error container:

   <div id="email-error" role="alert" aria-live="assertive"></div>

   Use assertive for validation errors (they need immediate announcement), 
   polite for informational messages.

2. Associate the error message with its input using aria-describedby:

   <input 
     type="email" 
     id="email" 
     aria-describedby="email-error"
     aria-invalid="true"
   />
   <div id="email-error" role="alert">
     Please enter a valid email address.
   </div>

3. Set aria-invalid="true" on the input when it has an error, and 
   remove it (or set to "false") when resolved. NVDA and JAWS both 
   surface this to users navigating by form fields.

4. Ensure error messages are descriptive. "Invalid input" is not 
   sufficient — WCAG 3.3.1 requires identifying the item in error and 
   describing the cause.

After these changes, test with NVDA + Firefox and VoiceOver + Safari 
to verify announcement behavior, as they handle live regions differently.

What Makes This Agent Powerful

Full WCAG Coverage Across All Levels

The agent operates across WCAG 2.1 and 2.2 at A, AA, and AAA conformance levels. It doesn’t just flag the easy stuff — it understands the nuance between success criteria, the difference between normative and advisory techniques, and which level applies to your specific compliance target.

Semantic HTML Expertise

A significant portion of accessibility failures come from misused or absent semantic markup. The agent validates heading hierarchy, landmark regions, list structure, table accessibility, and correct ARIA role application — going beyond what automated scanners like Axe can catch.

Actionable Code Output

Every violation comes with remediation code. Not a description of what needs changing — actual corrected markup, CSS fixes, and JavaScript patterns. This is what separates it from PDF audit reports that developers have to interpret and translate into implementation themselves.

Keyboard Navigation Analysis

Focus management is one of the hardest accessibility problems to get right in modern JavaScript applications — especially in SPAs with modals, drawers, and dynamic content. The agent understands focus trapping requirements, logical tab order, skip navigation patterns, and the appropriate use of tabindex values.

Assistive Technology Context

The agent doesn’t just check against the spec in isolation. It considers real-world behavior differences across NVDA, JAWS, VoiceOver, and TalkBack — because the spec and actual AT behavior diverge more than most developers realize. Recommendations account for these inconsistencies.

Color Contrast Precision

Rather than just flagging failures, the agent calculates exact contrast ratios and suggests specific alternative values that meet thresholds — saving the back-and-forth with designers trying to preserve brand colors while meeting compliance requirements.

How to Install the Web Accessibility Checker Agent

Claude Code supports sub-agents defined as Markdown files in your project’s .claude/agents/ directory. Each file contains a system prompt that scopes the agent’s expertise. Here’s how to install this one:

Step 1: In your project root, create the directory if it doesn’t exist:

mkdir -p .claude/agents

Step 2: Create the agent file:

touch .claude/agents/web-accessibility-checker.md

Step 3: Open the file and paste the following system prompt:

You are a web accessibility specialist focused on WCAG compliance, 
inclusive design, and assistive technology compatibility.

## Focus Areas

- WCAG 2.1/2.2 compliance assessment (A, AA, AAA levels)
- Screen reader compatibility and semantic HTML validation
- Keyboard navigation and focus management testing
- Color contrast and visual accessibility analysis
- Alternative text and media accessibility evaluation
- Form accessibility and error handling validation

## Approach

1. Automated accessibility scanning and analysis
2. Manual testing with assistive technologies
3. Semantic HTML structure validation
4. Keyboard navigation flow assessment
5. Color contrast ratio measurements
6. Screen reader compatibility testing

## Output

- Comprehensive accessibility audit reports
- WCAG compliance checklists with violation details
- Semantic HTML improvement recommendations
- Color contrast remediation strategies
- Keyboard navigation enhancement guides
- Assistive technology testing results

Focus on practical remediation steps that improve accessibility for 
users with disabilities. Include code examples and testing procedures 
for validation.

Step 4: Claude Code automatically detects and loads agents from .claude/agents/ — no restart or configuration required. You can invoke the agent directly by referencing it in your Claude Code session, or it will be selected automatically when your query falls within its domain.

Commit this file to your repository so every developer on your team has access to the same accessibility specialist in their local environment.

Next Steps: Building Accessibility Into Your Workflow

Installing the agent is the start, not the finish. To get maximum value from it, treat accessibility audits the same way you treat security reviews — required, not optional, and integrated into your development cycle rather than bolted on at the end.

Practical next steps: run the agent against your most-used UI components first and build a remediation backlog. Add it to your PR review checklist for new frontend work. If you maintain a design system, audit your component library systematically and document the WCAG compliance status of each component. Use the agent’s output to build internal accessibility guidelines specific to your stack.

The goal isn’t a perfect accessibility score on an audit tool. It’s a product that works for everyone who needs to use it — and a codebase where accessibility is a first-class concern your entire team understands how to maintain.

Agent template sourced from the claude-code-templates open source project (MIT License).

Share.
Leave A Reply