Claude Skills Guide

Claude Code WCAG 2.1 Compliance Checker Workflow Guide

Web accessibility is no longer optional—it’s a legal requirement and a moral imperative. Claude Code can act as a direct code-analysis partner for WCAG 2.1 compliance: you paste code, Claude identifies violations and explains the fix. This guide focuses on that hands-on checker workflow—analyzing HTML structure, color contrast, keyboard navigation, and ARIA implementation directly in your source files.

If you’re looking to build a broader audit workflow using Claude skills (/frontend-design, /tdd, /pdf) with CI/CD integration, see the Claude Code WCAG Accessibility Audit Workflow guide instead.

What WCAG 2.1 Level AA Requires

WCAG 2.1 success criteria are organized under four principles—Perceivable, Operable, Understandable, and Robust (POUR)—and tested at three conformance levels: A, AA, and AAA. Level AA is the standard compliance target for most organizations. Key Level AA requirements include:

Automated tools catch approximately 30-40% of violations. The steps below target what Claude Code can reliably catch through code analysis—the issues that show up directly in markup, styles, and JavaScript logic.

Setting Up Claude Code for Direct Code Analysis

Install Claude Code and run it from your project root so it has access to your full codebase. The workflow is straightforward: open a file, ask Claude to review it for specific WCAG criteria, and iterate on the findings.

# Install Claude Code if not already installed
npm install -g @anthropic-ai/claude-code

# Verify installation
claude --version

# Start Claude Code in your project directory
cd your-project && claude

Practical Workflow for WCAG 2.1 Checking with Claude Code

Step 1: Analyze HTML Structure

Begin by having Claude Code review your HTML markup for semantic correctness and proper ARIA implementation. Poor semantic structure is one of the most common accessibility violations and often breaks assistive technology functionality.

// Ask Claude Code to analyze this HTML
const pageContent = `
  <div class="header">
    <div class="logo">Company</div>
    <div class="nav">
      <a href="/about">About</a>
      <a href="/contact">Contact</a>
    </div>
  </div>
  <button>Click here</button>
`;

When you share this with Claude Code, ask it to identify accessibility issues. You’ll receive feedback about missing landmark regions (header, nav, main, footer), the need for proper heading hierarchy, and the importance of providing accessible names for interactive elements.

Step 2: Check Color Contrast and Visual Design

WCAG 2.1 Success Criterion 1.4.3 (Contrast Minimum) requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text. Claude Code can help you verify these ratios by analyzing your CSS or by interpreting results from color contrast checking tools.

Claude, analyze this color palette for WCAG AA compliance:
- Primary: #6B7280 (gray-500)
- Background: #F3F4F6 (gray-100)
- Text: #374151 (gray-700)
- Link: #3B82F6 (blue-500)

Calculate whether these meet the 4.5:1 contrast requirement for normal text.

Claude Code will calculate the contrast ratios and tell you which combinations pass or fail, suggesting alternative colors when necessary.

Step 3: Evaluate Keyboard Navigation and Focus Management

Keyboard accessibility is crucial for users who cannot use a mouse. Claude Code can review your JavaScript and CSS to ensure:

// Ask Claude to review this modal component for keyboard accessibility
const modalCode = `
<div class="modal" tabindex="-1">
  <div class="modal-content">
    <h2>Confirm Action</h2>
    <p>Are you sure you want to proceed?</p>
    <button>Cancel</button>
    <button>Confirm</button>
  </div>
</div>
`;

Claude will identify issues like the modal having tabindex="-1" which removes it from the keyboard navigation entirely, the lack of a close button, and missing focus management (the focus should return to the triggering element when the modal closes).

Step 4: Verify ARIA Implementation

When HTML semantics aren’t sufficient, ARIA (Accessible Rich Internet Applications) provides additional attributes. However, incorrect ARIA usage can create more problems than it solves. Claude Code excels at reviewing ARIA implementation for correctness.

Review this component's ARIA usage for WCAG compliance:

<button 
  aria-expanded="false" 
  aria-controls="menu"
  class="menu-toggle"
>
  Menu
</button>
<div id="menu" hidden>
  <a href="/page1">Page 1</a>
  <a href="/page2">Page 2</a>
</div>

Claude will likely note that while the button has aria-controls, the implementation is incomplete—the JavaScript should toggle aria-expanded between true and false when the button is clicked, and the hidden attribute should be managed dynamically.

Step 5: Generate Accessibility Test Cases

Beyond analyzing existing code, Claude Code can help you write test cases to prevent accessibility regressions. This is particularly valuable in continuous integration pipelines.

// Claude can generate Playwright tests like this:
const { test, expect } = require('@playwright/test');

test('homepage is keyboard accessible', async ({ page }) => {
  await page.goto('/');
  
  // Check first focusable element
  const firstFocusable = await page.locator('button, a, input, select, textarea, [tabindex]:not([tabindex="-1"])').first();
  await expect(firstFocusable).toBeFocused();
  
  // Tab through all interactive elements
  await page.keyboard.press('Tab');
  await expect(firstFocusable).not.toBeFocused();
});

Integrating Accessibility into Your Development Workflow

For maximum effectiveness, integrate Claude Code accessibility checking into your regular development process:

  1. During code review: Ask Claude Code to perform an accessibility review alongside your standard code review process
  2. Before deployment: Run comprehensive accessibility checks as part of your pre-deployment checklist
  3. In CI/CD pipelines: Automate basic accessibility tests to catch issues before they reach production

Limitations and Best Practices

While Claude Code is powerful, it’s essential to understand its limitations. Automated tools cannot detect all accessibility issues—things like whether alt text meaningfully describes an image, whether error messages are helpful, or whether the overall user experience is usable for people with disabilities require human judgment.

The most effective accessibility strategy combines:

Conclusion

Claude Code transforms WCAG 2.1 compliance checking from a burdensome chore into a direct, interactive code review. By pasting real markup, CSS, and JavaScript into Claude and asking precise questions—about contrast ratios, ARIA state management, focus order, or keyboard traps—you get actionable findings tied to specific success criteria. This is code-level analysis: fast, iterative, and integrated into your normal editing workflow.

For the next layer—skills-based audits, formal report generation with /pdf, and CI/CD automation—see the Claude Code WCAG Accessibility Audit Workflow guide.

Built by theluckystrike — More at zovo.one