agentleFS
michaelsvanbeekmichaelsvanbeek/personal-agent-skills/skills/accessibility-testing/SKILL.md

accessibility-testing

Skill1 starsChanged 7 months agoMITView on GitHub

Automated accessibility testing and WCAG compliance validation. Use when: adding accessibility tests to a project, configuring axe-core or pa11y, integrating a11y checks into CI, auditing an existing application for accessibility violations, validating ARIA usage, testing keyboard navigation, or building an accessibility regression suite. Covers axe-core, Playwright a11y testing, Lighthouse accessibility audits, CI integration, and WCAG 2.2 AA compliance.

  • Installs packages

9 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use compliance-testing, database-testing and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • petrkindlmannSkill

    compliance-testing

    Test for regulatory compliance: GDPR/CMP consent verification, Google Consent Mode v2, Global Privacy Control (GPC), CCPA/US state opt-out, EU AI Act Article 50 transparency, Better Ads Standards, and cookie-inventory auditing. Covers automated consent-flow testing, policy-based script blocking before consent, and cookie drift detection. Use when: "GDPR test," "compliance," "CMP test," "cookie consent," "consent mode," "CCPA," "GPC," "AI Act," "Better Ads," "privacy banner." Not for: WCAG/axe-core test authoring — use accessibility-testing. Not for: OWASP/vuln scanning — use security-testing. Not for: evaluating your LLM feature's quality or safety — use ai-system-testing. Related: accessibility-testing, security-testing, ai-system-testing, ci-cd-integration.

    Also in 4 projects that use this

  • petrkindlmannSkill

    database-testing

    Validate database integrity, test migrations forward and backward, verify schema constraints, manage seed data, detect migration drift, and identify query performance issues. Covers PostgreSQL, MySQL, MongoDB with Prisma, TypeORM, Drizzle, and SQLAlchemy, plus Testcontainers test databases. Use when: "database test," "migration test," "migration rollback," "rollback test," "data integrity," "SQL test," "schema validation," "seed data," "query performance," "Testcontainers." Not for: synthetic data generation/masking at scale — use test-data-management; Docker/IaC test-environment provisioning — use test-environments; SQL injection — use security-testing. Related: test-data-management, test-environments, security-testing, ci-cd-integration.

    Also in 5 projects that use this

  • mmondoraSkill

    security-testing

    Automated security testing in CI. SAST, DAST, dependency scanning, authorization testing, secret detection. Use when adding security scans to pipelines, writing tenant isolation tests, or configuring vulnerability scanning.

    Also in 4 projects that use this

  • nek1987Skill

    api-testing

    Use when writing tests for backend APIs or frontend flows. Triggers for: unit tests, integration tests, E2E tests, pytest fixtures, TestClient setup, mock data factories, or test coverage analysis. NOT for: testing business logic that doesn't involve API endpoints.

    Also in 4 projects that use this

  • testified-ossSkill

    exploratory-testing

    Guide exploratory testing sessions including charter creation, session-based testing, heuristics application, and finding documentation. Use when planning exploratory testing, conducting test sessions, or documenting discoveries.

    Also in 3 projects that use this

  • +4 more from petrkindlmann

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. 0 are common, 12 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 12

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Rule: Start from the top. Catch what you can at lint time before it reaches tests.

    line 40
  2. Very specific:

    Add an axe test for every major component (forms, modals, navigation, tables).

    line 100
  3. Distinctive:

    Run axe tests as part of the standard test suite — they execute in milliseconds.

    line 101
  4. Distinctive:

    When a violation is found, fix the component, not the test.

    line 102
  5. Distinctive:

    Test every route/page for WCAG 2.2 AA compliance.

    line 170
  6. Distinctive:

    Test interactive flows (forms, modals, dropdowns) for keyboard operability.

    line 171
  7. Distinctive:

    Test focus management: opening modals traps focus, closing returns it to trigger.

    line 172
  8. Very specific:

    Use withTags(["wcag2a", "wcag2aa", "wcag22aa"]) to target the correct WCAG level.

    line 173
  9. Distinctive:

    Run Lighthouse 3 times and take the median score to reduce flakiness.

    line 227
  10. Distinctive:

    Verify that dynamic content changes (modals, toasts, live regions) are announced.

    line 283
  11. Distinctive:

    Check that images are described meaningfully and decorative images are skipped.

    line 284
  12. Distinctive:

    When a rule must be disabled (rare), document it:

    line 301
  13. Distinctive:

    Rule: Never disable a rule without a tracking issue and a comment explaining why.

    line 310
  14. Distinctive:

    When auditing an existing project for accessibility testing:

    line 329

“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Accessibility Testing

When to Use

  • Adding automated accessibility tests to a web project
  • Configuring axe-core, pa11y, or Lighthouse for a11y audits
  • Integrating accessibility checks into CI/CD pipelines
  • Auditing an existing application for WCAG 2.2 AA violations
  • Validating ARIA attributes and roles
  • Testing keyboard navigation flows
  • Building an accessibility regression suite
  • Retrofitting a11y testing into a project that has none

Core Principle: Automate the Automatable, Manually Test the Rest

Automated tools catch ~30-40% of WCAG violations (missing alt text, low contrast, invalid ARIA). The rest requires manual testing with screen readers and keyboard navigation. Automate the detectable, then build manual test plans for the rest.


Testing Pyramid for Accessibility

LayerToolCatchesSpeed
Static analysiseslint-plugin-jsx-a11yMissing alt, invalid ARIA in JSXInstant (lint)
Component tests@axe-core/react, vitest-axePer-component violationsFast (unit)
Integration testsPlaywright + axe-coreFull-page violations, focus flowMedium
AuditLighthouse CIWCAG score, best practicesSlow (CI)
ManualScreen reader + keyboardContext, flow, comprehensionSlowest

Rule: Start from the top. Catch what you can at lint time before it reaches tests.


Static Analysis (ESLint)

Setup

npm install -D eslint-plugin-jsx-a11y

Config (eslint.config.ts)

import jsxA11y from "eslint-plugin-jsx-a11y";

export default [
  // ... other config
  jsxA11y.flatConfigs.recommended,
];

What It Catches

  • Missing alt on <img>
  • Invalid ARIA attributes and roles
  • Missing htmlFor on <label>
  • Non-interactive elements with click handlers (missing role and keyboard support)
  • Missing lang on <html>

Component-Level Testing (Vitest + axe-core)

Setup

npm install -D @axe-core/react vitest-axe jsdom

Test Pattern

import { render } from "@testing-library/react";
import { axe, toHaveNoViolations } from "vitest-axe";
import { expect, test } from "vitest";
import { MyComponent } from "./MyComponent";

expect.extend(toHaveNoViolations);

test("MyComponent has no accessibility violations", async () => {
  const { container } = render(<MyComponent />);
  const results = await axe(container);
  expect(results).toHaveNoViolations();
});

Rules

  • Add an axe test for every major component (forms, modals, navigation, tables).
  • Run axe tests as part of the standard test suite — they execute in milliseconds.
  • When a violation is found, fix the component, not the test. Never disable axe rules without documenting why.

Integration Testing (Playwright + axe-core)

Setup

npm install -D @playwright/test @axe-core/playwright

Full-Page Audit

import AxeBuilder from "@axe-core/playwright";
import { expect, test } from "@playwright/test";

test("homepage has no accessibility violations", async ({ page }) => {
  await page.goto("/");
  const results = await new AxeBuilder({ page })
    .withTags(["wcag2a", "wcag2aa", "wcag22aa"])
    .analyze();

  expect(results.violations).toEqual([]);
});

Scoped Audit (Specific Section)

test("checkout form is accessible", async ({ page }) => {
  await page.goto("/checkout");
  const results = await new AxeBuilder({ page })
    .include("#checkout-form")
    .withTags(["wcag2a", "wcag2aa"])
    .analyze();

  expect(results.violations).toEqual([]);
});

Keyboard Navigation Test

test("modal can be operated with keyboard only", async ({ page }) => {
  await page.goto("/");
  await page.click('[data-testid="open-modal"]');

  // Focus should be trapped in modal
  const modal = page.locator('[role="dialog"]');
  await expect(modal).toBeFocused();

  // Tab through focusable elements
  await page.keyboard.press("Tab");
  await expect(page.locator('[data-testid="modal-input"]')).toBeFocused();

  // Escape closes the modal
  await page.keyboard.press("Escape");
  await expect(modal).not.toBeVisible();

  // Focus returns to trigger element
  await expect(page.locator('[data-testid="open-modal"]')).toBeFocused();
});

Rules

  • Test every route/page for WCAG 2.2 AA compliance.
  • Test interactive flows (forms, modals, dropdowns) for keyboard operability.
  • Test focus management: opening modals traps focus, closing returns it to trigger.
  • Use withTags(["wcag2a", "wcag2aa", "wcag22aa"]) to target the correct WCAG level.

Lighthouse CI

Setup

npm install -D @lhci/cli

Config (lighthouserc.js)

module.exports = {
  ci: {
    collect: {
      url: ["http://localhost:3000/", "http://localhost:3000/dashboard"],
      startServerCommand: "npm run preview",
      numberOfRuns: 3,
    },
    assert: {
      assertions: {
        "categories:accessibility": ["error", { minScore: 0.9 }],
        "color-contrast": "error",
        "image-alt": "error",
        "label": "error",
        "link-name": "error",
        "button-name": "error",
      },
    },
    upload: {
      target: "temporary-public-storage",
    },
  },
};

CI Integration (Drone)

- name: lighthouse-a11y
  image: node:22-alpine
  commands:
    - npm ci
    - npm run build
    - npx @lhci/cli autorun

Rules

  • Accessibility score must be ≥90 (0.9). Regression below this blocks the build.
  • Specific checks (color-contrast, image-alt, label, link-name, button-name) are always errors.
  • Run Lighthouse 3 times and take the median score to reduce flakiness.

WCAG 2.2 AA Compliance Checklist

The most commonly violated WCAG criteria:

Perceivable

  • All images have descriptive alt text (or alt="" for decorative images)
  • Color contrast ratio ≥4.5:1 for normal text, ≥3:1 for large text
  • Information is not conveyed by color alone
  • Video has captions; audio has transcripts
  • Content is readable at 200% zoom without horizontal scrolling

Operable

  • All interactive elements are reachable and operable via keyboard
  • Focus order follows logical reading order
  • Focus indicator is visible (never outline: none without replacement)
  • No keyboard traps (user can always Tab/Escape out)
  • Touch targets are ≥24x24 CSS pixels (WCAG 2.2 Level AA)
  • Motion respects prefers-reduced-motion media query

Understandable

  • <html lang="..."> is set on every page
  • Form inputs have visible <label> elements
  • Error messages identify the field and describe the fix
  • Navigation is consistent across pages

Robust

  • Valid HTML (no duplicate IDs, proper nesting)
  • ARIA roles and attributes are valid and correctly applied
  • Custom components have appropriate ARIA roles, states, and properties
  • Status messages use role="status" or aria-live regions

Screen Reader Testing (Manual)

Tools

OSScreen ReaderBrowser
macOSVoiceOver (built-in)Safari
WindowsNVDA (free)Firefox or Chrome
WindowsJAWS (paid)Chrome

Test Script

  1. Navigate to the page using only keyboard (Tab, Enter, Arrow keys, Escape).
  2. Listen to how the screen reader announces page landmarks, headings, and interactive elements.
  3. Complete the primary user flow (e.g., submit a form, navigate to a detail page) without using the mouse.
  4. Verify that dynamic content changes (modals, toasts, live regions) are announced.
  5. Check that images are described meaningfully and decorative images are skipped.

Handling Violations

Severity Triage

axe-core ImpactAction
criticalFix before merge. Blocks users entirely.
seriousFix before merge. Significant barrier.
moderateFix within current sprint. Degraded experience.
minorAdd to backlog. Low-impact inconvenience.

Disabling Rules

When a rule must be disabled (rare), document it:

const results = await new AxeBuilder({ page })
  .withTags(["wcag2a", "wcag2aa"])
  .disableRules(["color-contrast"]) // Known issue: #1234, tracking upstream fix
  .analyze();

Rule: Never disable a rule without a tracking issue and a comment explaining why.


Anti-Patterns

Anti-PatternProblemFix
aria-label on everythingOverrides visible text, confuses screen readersUse visible labels; ARIA is a last resort
outline: none without replacementKeyboard users can't see focusUse :focus-visible with custom styles
role="button" on <div>Missing keyboard support, missing semanticsUse <button> element instead
Testing only with automationMisses flow, context, and comprehension issuesPair automation with manual screen reader testing
Fixing tests instead of componentsViolations persist for usersFix the component, then verify the test passes
tabindex="1" or higherBreaks natural focus orderOnly use tabindex="0" or tabindex="-1"

Audit Checklist

When auditing an existing project for accessibility testing:

  • ESLint jsx-a11y plugin is configured and enforced in CI
  • Major components have axe-core unit tests
  • Every route has a Playwright + axe-core integration test
  • Lighthouse CI runs with accessibility score ≥0.9 threshold
  • Critical and serious axe violations block the build
  • Keyboard navigation is tested for all interactive flows (modals, forms, menus)
  • Focus management is tested (modal trap, return to trigger)
  • Manual screen reader testing is scheduled for major releases
  • prefers-reduced-motion is respected for animations
  • Disabled axe rules have tracking issues and comments

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.