Claude Skills Guide

Claude Code Accessibility Workflow for Frontend Engineers

Building accessible websites isn’t just a legal requirement or ethical choice—it’s good engineering. Sites with proper accessibility rank better in search engines, work across more devices, and reach a broader audience. Claude Code provides a powerful workflow for frontend engineers to integrate accessibility testing and remediation into every stage of development.

Setting Up Your Accessibility Toolkit

Before diving into workflows, ensure your Claude Code environment has the right tools for accessibility work. The core tools you’ll need are already built into Claude Code: the ability to read files, run commands, and analyze code structure. For specialized accessibility testing, you can create custom skills or use existing npm packages.

Start by installing essential accessibility testing tools in your project:

npm install --save-dev axe-core playwright @axe-core/playwright

Axe-core provides comprehensive automated accessibility testing, while Playwright allows you to run these tests in a real browser environment. Claude Code can then analyze the results and guide you through fixing issues.

Creating an Accessibility Testing Skill

A well-designed Claude Code skill can automate much of your accessibility workflow. Here’s a skill that runs accessibility audits on your components:

---
name: accessibility-audit
description: "Run automated accessibility audits on React/Vue components"
---

When you invoke this skill, Claude Code can scan your component files, identify potential accessibility issues, and provide specific recommendations. The skill examines your JSX/TSX for common problems like missing alt text, improper heading hierarchy, and incorrect ARIA attributes.

Semantic HTML First Approach

The foundation of accessibility is writing semantic HTML. Claude Code excels at analyzing your templates and suggesting improvements. When building components, ask Claude to review your HTML structure:

“Review this component for semantic HTML correctness. Check for proper heading levels, landmark regions, and appropriate use of button vs link elements.”

Claude Code will analyze your component and provide specific feedback. For example, it might transform this:

// Before: Non-semantic
<div className="clickable" onClick={handleSubmit}>
  Submit Form
</div>

// After: Semantic and accessible
<button type="submit" onClick={handleSubmit}>
  Submit Form
</button>

The key principle: always use native HTML elements when possible. Buttons trigger actions, links navigate to new pages. Mixing them confuses screen reader users and breaks expected browser behavior.

Implementing ARIA Correctly

When semantic HTML isn’t enough, ARIA (Accessible Rich Internet Applications) provides additional context. However, ARIA is powerful but dangerous—incorrect usage creates more problems than it solves. The first rule of ARIA: don’t use ARIA if native HTML will work.

Claude Code can help you implement ARIA patterns correctly. Here’s a properly structured modal dialog:

// Accessible modal example
function Modal({ isOpen, onClose, title, children }) {
  if (!isOpen) return null;

  return (
    <div
      role="dialog"
      aria-modal="true"
      aria-labelledby="modal-title"
      aria-describedby="modal-description"
      onKeyDown={(e) => {
        if (e.key === 'Escape') onClose();
      }}
    >
      <h2 id="modal-title">{title}</h2>
      <p id="modal-description" className="sr-only">
        {children}
      </p>
      <button 
        aria-label="Close modal"
        onClick={onClose}
      >
        ×
      </button>
    </div>
  );
}

The aria-labelledby and aria-describedby attributes connect the modal to its title and description. The .sr-only class (screen-reader only) provides content to assistive technology without visual clutter.

Keyboard Navigation Testing

Accessibility isn’t just about screen readers—keyboard users must be able to navigate your entire interface. Claude Code can help you test and implement proper keyboard navigation:

  1. Focus management: Ensure logical tab order and visible focus indicators
  2. Keyboard traps: Verify users can enter and exit all interactive elements
  3. Shortcut keys: Implement keyboard shortcuts without blocking standard navigation

Ask Claude Code to audit your component’s keyboard handling:

// Proper keyboard navigation for a dropdown
function AccessibleDropdown({ options, onSelect }) {
  const [isOpen, setIsOpen] = useState(false);
  const [focusedIndex, setFocusedIndex] = useState(0);

  const handleKeyDown = (e) => {
    switch (e.key) {
      case 'ArrowDown':
        e.preventDefault();
        setFocusedIndex((prev) => Math.min(prev + 1, options.length - 1));
        break;
      case 'ArrowUp':
        e.preventDefault();
        setFocusedIndex((prev) => Math.max(prev - 1, 0));
        break;
      case 'Enter':
      case ' ':
        e.preventDefault();
        onSelect(options[focusedIndex]);
        break;
      case 'Escape':
        setIsOpen(false);
        break;
    }
  };

  return (
    <div
      role="combobox"
      aria-expanded={isOpen}
      aria-controls="dropdown-list"
      onKeyDown={handleKeyDown}
    >
      {/* Dropdown implementation */}
    </div>
  );
}

Integrating Accessibility into CI/CD

The best accessibility workflow catches issues before they reach production. Integrate accessibility testing into your continuous integration pipeline using Claude Code skills or direct test integration:

// tests/accessibility.spec.js
const { test, expect } = require('@playwright/test');
const AxeBuilder = require('@axe-core/playwright').default;

test('homepage has no critical accessibility issues', async ({ page }) => {
  const accessibilityScanResults = await new AxeBuilder({ page })
    .withTags(['wcag2a', 'wcag2aa', 'wcag21aa'])
    .analyze();

  expect(accessibilityScanResults.violations).toHaveLength(0);
});

Run this test in your CI pipeline. When it fails, Claude Code can analyze the violation details and suggest specific fixes.

Color Contrast and Visual Accessibility

Many accessibility issues aren’t code-related but visual. Ensure your design meets WCAG contrast ratios (4.5:1 for normal text, 3:1 for large text). Claude Code can’t directly analyze your design files, but you can describe your color palette:

“Check if #6B7280 on #FFFFFF background meets WCAG AA standards for normal text.”

Claude Code can calculate the contrast ratio and tell you whether your colors pass or fail, recommending adjusted hex values if needed.

Continuous Accessibility with Claude Code

The key to sustainable accessibility is making it part of your daily workflow:

  1. Code review: Ask Claude to review every PR for accessibility issues
  2. Component design: Design components with accessibility from the start, not as an afterthought
  3. Testing: Run automated tests on every build
  4. Documentation: Document accessibility considerations for complex components

Claude Code becomes your accessibility partner, catching issues early and teaching your team better practices over time. The investment in accessibility upfront saves massive remediation costs later—and more importantly, ensures your software works for everyone.

Built by theluckystrike — More at zovo.one