Claude Skills Guide

Automated accessibility testing has become essential for teams that want to ship inclusive products without sacrificing development velocity. When you modify a component, it’s easy to accidentally introduce accessibility regressions—broken keyboard navigation, missing alt text, or color contrast violations. Claude Code provides a powerful workflow for catching these issues through regression testing, especially when combined with specialized skills like frontend-design and testing automation tools.

Accessibility regression testing ensures that changes to your codebase do not reintroduce previously fixed accessibility issues. With Claude Code and its ecosystem of skills, you can build robust automated workflows that catch accessibility regressions before they reach production.

Understanding Accessibility Regression Testing

Regression testing in accessibility specifically focuses on preventing the reintroduction of previously fixed accessibility issues. When you add new features or refactor existing code, changes can inadvertently break keyboard navigation, remove ARIA attributes, or introduce color contrast problems. Traditional regression testing catches functional bugs—but accessibility regressions often go unnoticed because they don’t break functionality.

Claude Code helps by embedding accessibility knowledge directly into your development workflow. The AI assistant understands WCAG 2.1/2.2 guidelines, ARIA specifications, and screen reader behaviors. This means you can describe accessibility requirements conversationally and receive accurate, standards-compliant solutions.

Why Accessibility Regression Testing Matters

Every code change carries the risk of accidentally breaking accessibility features. A simple CSS tweak might break keyboard navigation. A new component might lack proper ARIA labels. Without regression testing, these issues slip into production and exclude users who rely on assistive technologies.

The cost of fixing accessibility bugs increases dramatically throughout the development cycle. Catching regressions in CI is far cheaper than addressing complaints from users or facing compliance violations.

Setting Up Your Accessibility Testing Foundation

Before implementing regression tests, establish a baseline of your current accessibility state. Document existing issues and their fixes so Claude Code can recognize when they reappear.

Creating an Accessibility Test Specification

Work with Claude Code to generate a test specification document that maps your application’s components to accessibility requirements:

Help me create an accessibility test specification for our React dashboard application.
We need to cover: navigation components, data tables, form inputs, modals, and charts.
For each component, document the keyboard interaction requirements, screen reader expectations,
and visual accessibility criteria.

Claude Code will generate a detailed specification that becomes your regression test baseline. This document should include component-by-component accessibility requirements, including which WCAG success criteria apply to each element.

Configuring Accessibility Rules

Create an accessibility test configuration in your project:

// accessibility.config.js
module.exports = {
  rules: {
    'aria-valid-attr': { enabled: true },
    'aria-required-attr': { enabled: true },
    'color-contrast': { enabled: true },
    'keyboard-navigable': { enabled: true },
    'focus-visible': { enabled: true },
    'heading-order': { enabled: true },
    'label-enclosed': { enabled: true },
  },
  excludedPaths: ['node_modules', 'dist', 'build'],
  baselineFile: 'accessibility-baseline.json',
};

Initialize your baseline by running a full accessibility audit:

npx @axe-core/cli https://your-app.example.com --save-accessibility-baseline

This baseline becomes the reference point for all future regression tests.

Using the Axe Skill with Claude Code

The axe skill in Claude Code provides direct integration with axe-core for accessibility testing. Activate it in your session:

/axe

Describe the component or page you want to test:

/axe
Run accessibility tests on the navigation component in src/components/Navigation.jsx

Claude will analyze the component, identify violations, and suggest fixes. The skill understands WCAG guidelines and can explain why each violation matters.

Setting Up Axe-Core Tests with jest-axe

The axe-core library provides robust automated accessibility testing. Here’s how to integrate jest-axe into your test suite:

// accessibility.test.js
import { axe, toHaveNoViolations } from 'jest-axe';

expect.extend(toHaveNoViolations);

describe('Accessibility Tests', () => {
  it('should have no accessibility violations on the landing page', async () => {
    const html = renderLandingPage();
    const results = await axe(html);
    expect(results).toHaveNoViolations();
  });

  it('should have proper focus management in modal component', async () => {
    const { container } = renderModal();
    const results = await axe(container, {
      rules: {
        'focus-order-modals': { enabled: true }
      }
    });
    expect(results).toHaveNoViolations();
  });
});

Ask Claude Code to generate additional test cases for specific components in your application. The AI understands which accessibility issues are most common for different component types and can suggest targeted tests.

Running Bulk Regression Tests

For comprehensive regression testing across your application, create a test script that uses both axe and your baseline:

// tests/accessibility-regression.test.js
const { getAxeResults } = require('@axe-core/axe-reporter');
const fs = require('fs');

describe('Accessibility Regression Tests', () => {
  const baseline = JSON.parse(
    fs.readFileSync('./accessibility-baseline.json', 'utf8')
  );

  it('should not introduce new accessibility violations', async () => {
    const results = await getAxeResults('http://localhost:3000');

    const newViolations = results.violations.filter(violation => {
      const baselineViolation = baseline.violations.find(
        b => b.id === violation.id && b.node === violation.node
      );
      return !baselineViolation;
    });

    expect(newViolations).toHaveLength(0);
  });

  it('should not increase severity of existing violations', async () => {
    const results = await getAxeResults('http://localhost:3000');

    results.violations.forEach(violation => {
      const baselineViolation = baseline.violations.find(
        b => b.id === violation.id && b.node === violation.node
      );

      if (baselineViolation) {
        expect(violation.impact).not.toBeGreaterThan(baselineViolation.impact);
      }
    });
  });
});

Building Custom Accessibility Rules

Sometimes your application has unique accessibility requirements that standard tools don’t cover. Claude Code can help you create custom accessibility rules:

Create a custom ESLint rule that checks for proper heading hierarchy.
The rule should:
1. Ensure h1 appears only once per page
2. Verify heading levels don't skip (no h3 after h1)
3. Report violations with clear messages

Claude Code will generate a complete ESLint rule with proper documentation and test cases.

Integrating with Claude Code Workflows

Claude Code excels at incorporating accessibility checks into your daily development workflow. Use the skill-creator skill to build custom automation that fits your team’s process.

Requesting an Accessibility Code Review

When submitting pull requests, include Claude Code in your review process:

Review this React component for accessibility issues.
Check for:
- Proper semantic HTML elements
- ARIA attributes used correctly
- Keyboard navigation support
- Focus management in interactive elements
- Color contrast in CSS
- Screen reader announcements for dynamic content

Claude Code will analyze the component and provide specific, actionable recommendations. This review catches issues before they merge into your main branch.

Fixing Accessibility Issues with Claude Code

When Claude Code identifies accessibility problems, ask for specific fixes:

This button component has an accessibility issue. The onclick handler
doesn't work with keyboard navigation. Fix it to be fully keyboard accessible,
including proper focus styles and Enter/Space key handlers.

The AI will provide corrected code with explanations of why the changes improve accessibility.

Creating a Custom Regression Skill

Use the skill-creator skill to build a dedicated regression testing skill:

# Skill: /accessibility-regression

## Description
Runs accessibility regression tests and compares results against the baseline.

## Usage
Type /accessibility-regression to run the full test suite.

## Workflow
1. Run axe-core tests against the current codebase
2. Load the accessibility baseline from baseline/accessibility.json
3. Compare current results against baseline
4. Report any new violations or increased severity
5. If regressions found, explain the impact and suggest fixes
6. Offer to apply fixes automatically

Automating in CI/CD Pipelines

Pre-Commit Hooks for Accessibility

Set up pre-commit hooks that run quick accessibility checks before code is committed:

#!/bin/bash
# pre-accessibility-check.sh

# Check for missing alt text in images
echo "Checking for missing alt attributes..."
grep -r '<img' --include='*.jsx' --include='*.tsx' . | \
  grep -v 'alt=' | \
  grep -v 'alt={"' | \
  grep -v "alt={'"

# Verify ARIA attributes are valid
npx eslint src/ --rule 'aria: error' --max-warnings 0

echo "Pre-commit accessibility check complete"

Ask Claude Code to expand this script with additional checks relevant to your technology stack.

CI/CD Pipeline Integration

Incorporate accessibility regression testing into your continuous integration pipeline to catch issues before deployment:

# .github/workflows/accessibility.yml
name: Accessibility Regression Tests

on: [push, pull_request]

jobs:
  accessibility-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install dependencies
        run: npm ci

      - name: Start application
        run: npm start &

      - name: Wait for app
        run: sleep 10

      - name: Run axe tests
        run: npx axe --save-results results.json

      - name: Compare with baseline
        run: |
          npx axe-regression compare \
            --current results.json \
            --baseline baseline/accessibility.json \
            --output regression-report.json

      - name: Upload regression report
        uses: actions/upload-artifact@v4
        with:
          name: accessibility-report
          path: regression-report.json

      - name: Fail on regressions
        run: |
          if [ -s regression-report.json ]; then
            echo "Accessibility regressions detected!"
            cat regression-report.json
            exit 1
          fi

Testing Specific Accessibility Patterns

Focus your regression tests on the most critical accessibility patterns that frequently break:

Keyboard Navigation

Ensure all interactive elements remain keyboard-accessible:

it('should maintain keyboard navigation', async () => {
  const page = await browser.newPage();
  await page.goto('http://localhost:3000');

  // Test tab order
  const focusedElements = await page.evaluate(() => {
    const elements = [];
    document.addEventListener('focus', (e) => {
      elements.push({
        tag: e.target.tagName,
        id: e.target.id,
        class: e.target.className,
      });
    }, true);

    // Simulate tab navigation
    document.body.focus();
    for (let i = 0; i < 20; i++) {
      document.activeElement?.dispatchEvent(
        new KeyboardEvent('keydown', { key: 'Tab', bubbles: true })
      );
    }

    return elements;
  });

  expect(focusedElements.length).toBeGreaterThan(0);
});

Screen Reader Compatibility

Verify that dynamic content updates are announced:

it('should announce dynamic content changes', async () => {
  const page = await browser.newPage();
  await page.goto('http://localhost:3000');

  // Trigger dynamic content update
  await page.click('#update-notification');

  // Check for live region announcement
  const announcement = await page.evaluate(() => {
    const liveRegion = document.querySelector('[aria-live]');
    return liveRegion?.textContent;
  });

  expect(announcement).toBeTruthy();
});

Maintaining Accessibility Over Time

Accessibility isn’t a one-time achievement—it requires ongoing vigilance. Claude Code helps maintain accessibility standards as your application evolves.

Creating Accessibility Documentation

Ask Claude Code to generate accessibility documentation that teams can reference:

Create an accessibility component library document for our design system.
For each component, document:
- How to use it accessibly
- Keyboard interactions
- Screen reader announcements
- Common mistakes to avoid
- Related WCAG success criteria

This documentation becomes a living resource that helps developers make accessible decisions.

Establishing Accessibility Code Patterns

Work with Claude Code to establish and document accessible code patterns:

Generate TypeScript/React code patterns for:
1. Accessible button variants
2. Form input with validation messages
3. Modal with proper focus trap
4. Data table with proper headers
5. Skip navigation link implementation

These patterns become templates that developers can use, ensuring new code meets accessibility standards from the start.

Best Practices for Sustainable Testing

Maintain your regression tests effectively by following these practices:

  1. Keep baseline updated - After fixing accessibility issues, regenerate your baseline to reflect the improved state.

  2. Prioritize critical paths - Focus regression tests on user journeys that are most vulnerable to accessibility breaks.

  3. Document exemptions - When you intentionally accept a violation, document it in an exemptions file so future tests don’t flag it as a regression.

  4. Run frequently - Execute accessibility regression tests on every pull request to catch issues early.

  5. Involve Claude proactively - Ask Claude Code to review code changes for potential accessibility impact before you even run tests.

  6. Test with real users - Automated tools and code reviews complement—but don’t replace—testing with actual assistive technology users. Schedule regular accessibility user testing.

Conclusion

Accessibility regression testing with Claude Code transforms what was once a manual, tedious process into an automated workflow that catches issues automatically. By establishing baselines, using the axe skill, and integrating tests into your CI pipeline, you protect your application from reintroducing accessibility barriers.

The key is starting small: add accessibility checks to your next pull request, generate tests for your most critical components, and gradually expand coverage. With Claude Code as your accessibility partner, building and maintaining accessible applications becomes achievable for teams of any size. The initial setup investment pays dividends in compliance confidence, user trust, and development velocity.

Built by theluckystrike — More at https://zovo.one