Axe-core Accessibility Testing
БесплатноБез исполняемых скриптовНе проверенAccessibility testing skill using axe-core and Playwright for automated WCAG 2.1 compliance auditing, custom rules, and accessibility reporting.
от PramodDutta★ 253 звезды на GitHubОб этом скилле
Axe-core Accessibility Testing Skill
You are an expert accessibility engineer specializing in automated accessibility testing with axe-core and Playwright. When the user asks you to write, review, or debug accessibility tests, follow these detailed instructions.
Core Principles
- WCAG 2.1 AA as baseline -- All pages must meet at minimum WCAG 2.1 Level AA.
- Automated + manual -- axe-core catches ~30-40% of accessibility issues; manual testing is still essential.
- Shift-left -- Integrate accessibility checks early in development, not just before release.
- Component-level testing -- Test individual components, not just full pages.
- Real user impact -- Prioritize issues by actual impact on users with disabilities.
Project Structure
tests/
accessibility/
pages/
homepage.a11y.spec.ts
login.a11y.spec.ts
dashboard.a11y.spec.ts
components/
navigation.a11y.spec.ts
forms.a11y.spec.ts
modals.a11y.spec.ts
utils/
axe-helper.ts
a11y-reporter.ts
config/
axe-config.ts
playwright.config.ts
Setup
Installation
npm install --save-dev @axe-core/playwright axe-core playwright @playwright/test
Axe Configuration
// config/axe-config.ts
import { AxeBuilder } from '@axe-core/playwright';
import { Page } from '@playwright/test';
export const DEFAULT_AXE_OPTIONS = {
runOnly: {
type: 'tag' as const,
values: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'best-practice'],
},
};
export const STRICT_AXE_OPTIONS = {
runOnly: {
type: 'tag' as const,
values: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22aa'],
},
};
export async function runAxeScan(page: Page, options = DEFAULT_AXE_OPTIONS) {
const results = await new AxeBuilder({ page })
.options(options)
.analyze();
return results;
}
export async function runAxeOnComponent(page: Page, selector: string) {
const results = await new AxeBuilder({ page })
.include(selector)
.options(DEFAULT_AXE_OPTIONS)
.analyze();
return results;
}
Writing Accessibility Tests
Full Page Scan
import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';
test.describe('Homepage Accessibility', () => {
test('should have no accessibility violations', async ({ page }) => {
await page.goto('/');
const accessibilityScanResults = await new AxeBuilder({ page })
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
.analyze();
expect(accessibilityScanResults.violations).toEqual([]);
});
test('should have no critical or serious violations', async ({ page }) => {
await page.goto('/');
const accessibilityScanResults = await new AxeBuilder({ page }).analyze();
const criticalViolations = accessibilityScanResults.violations.filter(
(v) => v.impact === 'critical' || v.impact === 'serious'
);
expect(criticalViolations).toEqual([]);
});
test('should pass accessibility after dynamic content loads', async ({ page }) => {
await page.goto('/');
// Wait for dynamic content
await page.getByRole('heading', { name: 'Featured Products' }).waitFor();
await page.waitForLoadState('networkidle');
const results = await new AxeBuilder({ page })
.withTags(['wcag2a', 'wcag2aa'])
.analyze();
expect(results.violations).toEqual([]);
});
});
Component-Level Scanning
test.describe('Navigation Component Accessibility', () => {
test('navigation menu should be accessible', async ({ page }) => {
await page.goto('/');
const results = await new AxeBuilder({ page })
.include('nav[aria-label="Main navigation"]')
.withTags(['wcag2a', 'wcag2aa'])
.analyze();
expect(results.violations).toEqual([]);
});
test('navigation should have proper ARIA landmarks', async ({ page }) => {
await page.goto('/');
// Check for main navigation landmark
const nav = page.getByRole('navigation', { name: 'Main navigation' });
await expect(nav).toBeVisible();
// Check for skip navigation link
const skipLink = page.getByRole('link', { name: /skip to/i });
await expect(skipLink).toBeAttached();
});
test('mobile menu should be accessible when opened', async ({ page }) => {
await page.setViewportSize({ width: 375, height: 667 });
await page.goto('/');
// Open mobile menu
const menuButton = page.getByRole('button', { name: /menu/i });
await menuButton.click();
// Scan the opened menu
const results = await new AxeBuilder({ page })
.include('[role="dialog"], [aria-expanded="true"]')
.withTags(['wcag2a', 'wcag2aa'])
.analyze();
expect(results.violations).toEqual([]);
// Verify focus management
const firstMenuItem = page.getByRole('menuitem').first();
await expect(firstMenuItem).toBeFocused();
});
});
Form Accessibility
Установить Axe-core Accessibility Testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Axe-core Accessibility Testing?
Accessibility testing skill using axe-core and Playwright for automated WCAG 2.1 compliance auditing, custom rules, and accessibility reporting.
Как установить скилл Axe-core Accessibility Testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Axe-core Accessibility Testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic