/harness-claude:a11y-testing-automationfrom harness-claude
Automates accessibility testing with axe-core, jest-axe, and Playwright, including CI pipeline integration. Useful for catching a11y regressions in component tests and full-page scans.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /harness-claude:a11y-testing-automation still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Automate accessibility testing with axe-core, jest-axe, Playwright, and CI pipeline integration
npm install -D jest-axe @types/jest-axe
import { render } from '@testing-library/react';
import { axe, toHaveNoViolations } from 'jest-axe';
expect.extend(toHaveNoViolations);
describe('LoginForm', () => {
it('should have no accessibility violations', async () => {
const { container } = render(<LoginForm />);
const results = await axe(container);
expect(results).toHaveNoViolations();
});
it('should have no violations in error state', async () => {
const { container } = render(<LoginForm errors={{ email: 'Required' }} />);
const results = await axe(container);
expect(results).toHaveNoViolations();
});
});
const states = [
{ name: 'default', props: {} },
{ name: 'loading', props: { isLoading: true } },
{ name: 'error', props: { error: 'Something went wrong' } },
{ name: 'empty', props: { items: [] } },
];
states.forEach(({ name, props }) => {
it(`should have no a11y violations in ${name} state`, async () => {
const { container } = render(<DataTable {...props} />);
expect(await axe(container)).toHaveNoViolations();
});
});
npm install -D @axe-core/playwright
import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';
test('homepage should have no a11y violations', async ({ page }) => {
await page.goto('/');
const results = await new AxeBuilder({ page })
.withTags(['wcag2a', 'wcag2aa', 'wcag21aa'])
.analyze();
expect(results.violations).toEqual([]);
});
test('checkout flow should have no a11y violations', async ({ page }) => {
await page.goto('/checkout');
// Fill form to trigger validation states
await page.click('button[type="submit"]');
await page.waitForSelector('[role="alert"]');
const results = await new AxeBuilder({ page })
.exclude('.third-party-widget') // Exclude content you do not control
.analyze();
expect(results.violations).toEqual([]);
});
npm install -D eslint-plugin-jsx-a11y
{
"extends": ["plugin:jsx-a11y/recommended"],
"plugins": ["jsx-a11y"]
}
Key rules this enables:
alt-text — images must have altanchor-is-valid — <a> must have hrefclick-events-have-key-events — onClick must have onKeyDown/onKeyUplabel-has-associated-control — labels must be linked to inputsno-noninteractive-element-interactions — no click handlers on divsgetByRole, getByLabelText, and getByAltText verify accessibility as a side effect of writing tests.import { render, screen } from '@testing-library/react';
// These queries fail if accessibility is broken
const submitButton = screen.getByRole('button', { name: 'Submit' });
const emailInput = screen.getByLabelText('Email address');
const logo = screen.getByAltText('Company Logo');
const nav = screen.getByRole('navigation', { name: 'Main' });
const alert = screen.getByRole('alert');
# GitHub Actions
- name: Run a11y tests
run: npx playwright test --grep @a11y
- name: Run component a11y tests
run: npx vitest run --grep "accessibility"
const results = await new AxeBuilder({ page })
.withTags(['wcag2a', 'wcag2aa', 'wcag21aa'])
.disableRules(['color-contrast']) // Disable if you have a separate contrast testing workflow
.analyze();
import { createHtmlReport } from 'axe-html-reporter';
const results = await new AxeBuilder({ page }).analyze();
createHtmlReport({
results,
options: { outputDir: 'a11y-reports', reportFileName: 'homepage.html' },
});
What automated testing catches (~30-40% of issues):
What automated testing misses (~60-70% of issues):
Testing pyramid for accessibility:
Handling existing violations: When adding axe to an existing project, you may find hundreds of violations. Use disableRules or exclude selectively to establish a baseline, then fix violations incrementally and remove exclusions over time.
https://github.com/dequelabs/axe-core
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeRead when SKILL.md points to them.
793 skills in this plugin
/a11y-aria-patternsARIA Patterns> Apply ARIA roles, states, and properties correctly to enhance assistive technology support for custom widgets/a11y-color-contrastColor Contrast and Color Independence> Ensure sufficient color contrast ratios and never use color as the sole means of conveying information/a11y-form-patternsAccessible Form Patterns> Build accessible forms with proper labeling, grouped controls, inline validation, and clear error communicationOther plugins' skills for the same job