跳到主要内容
SkillVault logo SkillVault
免费 ChatGPT GPTs Claude Code Cursor

a11y-audit

Accessibility audit skill for scanning, fixing, and verifying WCAG 2.2 Level A and AA compliance across React, Next.js, Vue, Angular, Svelte, and plain HTML codebases. Use when auditing accessibility, fixing a11y violations, checking color contrast, generating compliance reports, or integrating accessibility checks into CI/CD pipelines.

0 次下载 0 次浏览 更新于 Oct 31, 2026 v1.0.0
a11y-audit skill cover

下方技能配置(提示词、变量、安装步骤)保留英文原文。.aiskill 文件直接面向 AI 智能体,统一使用英文以确保跨平台行为一致。

概述

Accessibility audit skill for scanning, fixing, and verifying WCAG 2.2 Level A and AA compliance across React, Next.js, Vue, Angular, Svelte, and plain HTML codebases. Use when auditing accessibility, fixing a11y violations, checking color contrast, generating compliance reports, or integrating accessibility checks into CI/CD pipelines.

Source: https://github.com/alirezarezvani/claude-skills · MIT · © 2025 Alireza Rezvani

系统提示词

定义智能体角色、规则与输出格式的指令块。

system-prompt.txt
# Accessibility Audit

WCAG 2.2 Accessibility Audit and Remediation Skill

## Description

The a11y-audit skill provides a complete accessibility audit pipeline for modern web applications. It implements a three-phase workflow -- Scan, Fix, Verify -- that identifies WCAG 2.2 Level A and AA violations, generates exact fix code per framework, and produces stakeholder-ready compliance reports.

For every violation it finds, it provides the precise before/after code fix tailored to your framework (React, Next.js, Vue, Angular, Svelte, or plain HTML).

**What this skill does:**

1. **Scans** your codebase for every WCAG 2.2 Level A and AA violation, categorized by severity (Critical, Major, Minor)
2. **Fixes** each violation with framework-specific before/after code patterns
3. **Verifies** that fixes resolve the original violations and introduces no regressions
4. **Reports** findings in a structured format suitable for developers, PMs, and compliance stakeholders
5. **Integrates** into CI/CD pipelines to prevent accessibility regressions

## Features

| Feature | Description |
|---------|-------------|
| **Full WCAG 2.2 Scan** | Checks all Level A and AA success criteria across your codebase |
| **Framework Detection** | Auto-detects React, Next.js, Vue, Angular, Svelte, or plain HTML |
| **Severity Classification** | Categorizes each violation as Critical, Major, or Minor |
| **Fix Code Generation** | Produces before/after code diffs for every issue |
| **Color Contrast Checker** | Validates foreground/background pairs against AA and AAA ratios |
| **Compliance Reporting** | Generates stakeholder reports with pass/fail summaries |
| **CI/CD Integration** | GitHub Actions, GitLab CI, Azure DevOps pipeline configs |
| **Keyboard Navigation Audit** | Detects missing focus management and tab order issues |
| **ARIA Validation** | Checks for incorrect, redundant, or missing ARIA attributes |

### Severity Definitions

| Severity | Definition | Example | SLA |
|----------|-----------|---------|-----|
| **Critical** | Blocks access for entire user groups | Missing alt text, no keyboard access to navigation | Fix before release |
| **Major** | Significant barrier that degrades experience | Insufficient color contrast, missing form labels | Fix within current sprint |
| **Minor** | Usability issue that causes friction | Redundant ARIA roles, suboptimal heading hierarchy | Fix within next 2 sprints |

## Usage

### Quick Start

```bash
# Scan entire project
python scripts/a11y_scanner.py /path/to/project

# Scan with JSON output for tooling
python scripts/a11y_scanner.py /path/to/project --json

# Check color contrast for specific values
python scripts/contrast_checker.py --fg "#777777" --bg "#ffffff"

# Check contrast across a CSS/Tailwind file
python scripts/contrast_checker.py --file /path/to/styles.css
```

### Slash Command

```
/a11y-audit                    # Audit current project
/a11y-audit --scope src/       # Audit specific directory
/a11y-audit --fix              # Audit and auto-apply fixes
/a11y-audit --report           # Generate stakeholder report
/a11y-audit --ci               # Output CI-compatible results
```

### Three-Phase Workflow

**Phase 1: Scan** -- Walk the source tree, detect framework, apply rule set.

```bash
python scripts/a11y_scanner.py /path/to/project --format table
```

**Phase 2: Fix** -- Apply framework-specific fixes for each violation.

> See [references/framework-a11y-patterns.md](references/framework-a11y-patterns.md) for the complete fix patterns catalog.

**Phase 3: Verify** -- Re-run the scanner to confirm fixes and check for regressions.

```bash
python scripts/a11y_scanner.py /path/to/project --baseline audit-baseline.json
```

## Example: React Component Audit

```tsx
// BEFORE: src/components/ProductCard.tsx
function ProductCard({ product }) {
  return (
    <div onClick={() => navigate(`/product/${product.id}`)}>
      <img src={product.image} />
      <div style={{ color: '#aaa', fontSize: '12px' }}>{product.name}</div>
      <span style={{ color: '#999' }}>${product.price}</span>
    </div>
  );
}
```

| # | WCAG | Severity | Issue |
|---|------|----------|-------|
| 1 | 1.1.1 | Critical | `<img>` missing `alt` attribute |
| 2 | 2.1.1 | Critical | `<div onClick>` not keyboard accessible |
| 3 | 1.4.3 | Major | Color `#aaa` on white fails contrast (2.32:1, needs 4.5:1) |
| 4 | 1.4.3 | Major | Color `#999` on white fails contrast (2.85:1, needs 4.5:1) |
| 5 | 4.1.2 | Major | Interactive element missing role and accessible name |

```tsx
// AFTER: src/components/ProductCard.tsx
function ProductCard({ product }) {
  return (
    <a href={`/product/${product.id}`} className="product-card"
       aria-label={`View ${product.name} - $${product.price}`}>
      <img src={product.image} alt={product.imageAlt || product.name} />
      <div style={{ color: '#595959', fontSize: '12px' }}>{product.name}</div>
      <span style={{ color: '#767676' }}>${product.price}</span>
    </a>
  );
}
```

> See [references/examples-by-framework.md](references/examples-by-framework.md) for Vue, Angular, Next.js, and Svelte examples.

## Tools Reference

### a11y_scanner.py

```
Usage: python scripts/a11y_scanner.py <path> [options]

Options:
  --json                  Output results as JSON
  --format {table,csv}    Output format (default: table)
  --severity {critical,major,minor}  Filter by minimum severity
  --framework {react,vue,angular,svelte,html,auto}  Force framework (default: auto)
  --baseline FILE         Compare against previous scan results
  --report                Generate stakeholder report
  --output FILE           Write results to file
  --quiet                 Suppress output, exit code only
  --ci                    CI mode: non-zero exit on critical issues
```

### contrast_checker.py

```
Usage: python scripts/contrast_checker.py [options]

Options:
  --fg COLOR              Foreground color (hex)
  --bg COLOR              Background color (hex)
  --file FILE             Scan CSS file for color pairs
  --tailwind DIR          Scan directory for Tailwind color classes
  --json                  Output results as JSON
  --suggest               Suggest accessible alternatives for failures
  --level {aa,aaa}        Target conformance level (default: aa)
```

## Common Pitfalls

| Pitfall | Correct Approach |
|---------|------------------|
| `role="button"` on a `<div>` | Use native `<button>` -- includes keyboard handling for free |
| `tabindex="0"` on everything | Only interactive elements need focus; use native elements |
| `aria-label` on non-interactive elements | Use `aria-labelledby` pointing to visible text |
| `display: none` for screen reader hiding | Use `.sr-only` class instead |
| Color alone to convey meaning | Add icons, text labels, or patterns alongside color |
| Placeholder as only label | Always provide a visible `<label>` |
| `outline: none` without replacement | Always provide a visible focus indicator via `focus-visible` |
| Empty `alt=""` on informational images | Informational images need descriptive alt text |
| Skipping heading levels (h1 -> h3) | Heading levels must be sequential |
| `onClick` without `onKeyDown` | Add keyboard support or prefer native elements |
| Ignoring `prefers-reduced-motion` | Wrap animations in `@media (prefers-reduced-motion: no-preference)` |

## Related Skills

| Skill | Relationship |
|-------|-------------|
| **senior-frontend** | Frontend patterns used in a11y fixes |
| **code-reviewer** | Include a11y checks in code review workflows |
| **senior-qa** | Integration of a11y testing into QA processes |
| **playwright-pro** | Automated browser testing with accessibility assertions |
| **epic-design** | WCAG 2.1 AA compliant animations and scroll storytelling |
| **tdd-guide** | Test-driven development patterns for a11y test cases |

## Reference Documentation

| Reference | Description |
|-----------|-------------|
| [wcag-quick-ref.md](references/wcag-quick-ref.md) | WCAG 2.2 Level A & AA criteria quick reference |
| [wcag-22-new-criteria.md](references/wcag-22-new-criteria.md) | New WCAG 2.2 success criteria (Focus Appearance, Target Size, etc.) |
| [aria-patterns.md](references/aria-patterns.md) | ARIA patterns, keyboard interaction, and live regions |
| [framework-a11y-patterns.md](references/framework-a11y-patterns.md) | Framework-specific fix patterns (React, Vue, Angular, Svelte, HTML) |
| [color-contrast-guide.md](references/color-contrast-guide.md) | Color contrast checker details, Tailwind palette mapping, sr-only class |
| [ci-cd-integration.md](references/ci-cd-integration.md) | GitHub Actions, GitLab CI, Azure DevOps, pre-commit hook configs |
| [audit-report-template.md](references/audit-report-template.md) | Stakeholder-ready audit report template |
| [testing-checklist.md](references/testing-checklist.md) | Manual testing checklist (keyboard, screen reader, visual, forms) |
| [examples-by-framework.md](references/examples-by-framework.md) | Full audit examples for Vue, Angular, Next.js, and Svelte |

## Resources

- [WCAG 2.2 Specification](https://www.w3.org/TR/WCAG22/)
- [WAI-ARIA Authoring Practices 1.2](https://www.w3.org/WAI/ARIA/apg/)
- [Deque axe-core Rules](https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md)
- [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)

用户提示词模板

填充变量后发送,即可运行该技能: {{variables}}

user-template.txt

变量

名称 必填 说明 示例

完整技能配置

标准 .aiskill 文件,提供 JSON 与 YAML 两种格式。

a11y-audit.aiskill (JSON)
{
  "format": "aiskill/v1",
  "skill": {
    "name": "a11y-audit",
    "slug": "a11y-audit",
    "version": "1.0.0",
    "description": "Accessibility audit skill for scanning, fixing, and verifying WCAG 2.2 Level A and AA compliance across React, Next.js, Vue, Angular, Svelte, and plain HTML codebases. Use when auditing accessibility, fixing a11y violations, checking color contrast, generating compliance reports, or integrating accessibility checks into CI/CD pipelines.",
    "category": "Development",
    "tags": [
      "testing",
      "frontend"
    ],
    "platforms": [
      "chatgpt",
      "claude-code",
      "cursor"
    ],
    "tested_environment": "Agent Skills convention (SKILL.md) — works with Claude Code, Cursor, ChatGPT/Codex and compatible agents",
    "license": "MIT"
  },
  "prompts": {
    "system": "# Accessibility Audit\r\n\r\nWCAG 2.2 Accessibility Audit and Remediation Skill\r\n\r\n## Description\r\n\r\nThe a11y-audit skill provides a complete accessibility audit pipeline for modern web applications. It implements a three-phase workflow -- Scan, Fix, Verify -- that identifies WCAG 2.2 Level A and AA violations, generates exact fix code per framework, and produces stakeholder-ready compliance reports.\r\n\r\nFor every violation it finds, it provides the precise before/after code fix tailored to your framework (React, Next.js, Vue, Angular, Svelte, or plain HTML).\r\n\r\n**What this skill does:**\r\n\r\n1. **Scans** your codebase for every WCAG 2.2 Level A and AA violation, categorized by severity (Critical, Major, Minor)\r\n2. **Fixes** each violation with framework-specific before/after code patterns\r\n3. **Verifies** that fixes resolve the original violations and introduces no regressions\r\n4. **Reports** findings in a structured format suitable for developers, PMs, and compliance stakeholders\r\n5. **Integrates** into CI/CD pipelines to prevent accessibility regressions\r\n\r\n## Features\r\n\r\n| Feature | Description |\r\n|---------|-------------|\r\n| **Full WCAG 2.2 Scan** | Checks all Level A and AA success criteria across your codebase |\r\n| **Framework Detection** | Auto-detects React, Next.js, Vue, Angular, Svelte, or plain HTML |\r\n| **Severity Classification** | Categorizes each violation as Critical, Major, or Minor |\r\n| **Fix Code Generation** | Produces before/after code diffs for every issue |\r\n| **Color Contrast Checker** | Validates foreground/background pairs against AA and AAA ratios |\r\n| **Compliance Reporting** | Generates stakeholder reports with pass/fail summaries |\r\n| **CI/CD Integration** | GitHub Actions, GitLab CI, Azure DevOps pipeline configs |\r\n| **Keyboard Navigation Audit** | Detects missing focus management and tab order issues |\r\n| **ARIA Validation** | Checks for incorrect, redundant, or missing ARIA attributes |\r\n\r\n### Severity Definitions\r\n\r\n| Severity | Definition | Example | SLA |\r\n|----------|-----------|---------|-----|\r\n| **Critical** | Blocks access for entire user groups | Missing alt text, no keyboard access to navigation | Fix before release |\r\n| **Major** | Significant barrier that degrades experience | Insufficient color contrast, missing form labels | Fix within current sprint |\r\n| **Minor** | Usability issue that causes friction | Redundant ARIA roles, suboptimal heading hierarchy | Fix within next 2 sprints |\r\n\r\n## Usage\r\n\r\n### Quick Start\r\n\r\n```bash\r\n# Scan entire project\r\npython scripts/a11y_scanner.py /path/to/project\r\n\r\n# Scan with JSON output for tooling\r\npython scripts/a11y_scanner.py /path/to/project --json\r\n\r\n# Check color contrast for specific values\r\npython scripts/contrast_checker.py --fg \"#777777\" --bg \"#ffffff\"\r\n\r\n# Check contrast across a CSS/Tailwind file\r\npython scripts/contrast_checker.py --file /path/to/styles.css\r\n```\r\n\r\n### Slash Command\r\n\r\n```\r\n/a11y-audit                    # Audit current project\r\n/a11y-audit --scope src/       # Audit specific directory\r\n/a11y-audit --fix              # Audit and auto-apply fixes\r\n/a11y-audit --report           # Generate stakeholder report\r\n/a11y-audit --ci               # Output CI-compatible results\r\n```\r\n\r\n### Three-Phase Workflow\r\n\r\n**Phase 1: Scan** -- Walk the source tree, detect framework, apply rule set.\r\n\r\n```bash\r\npython scripts/a11y_scanner.py /path/to/project --format table\r\n```\r\n\r\n**Phase 2: Fix** -- Apply framework-specific fixes for each violation.\r\n\r\n> See [references/framework-a11y-patterns.md](references/framework-a11y-patterns.md) for the complete fix patterns catalog.\r\n\r\n**Phase 3: Verify** -- Re-run the scanner to confirm fixes and check for regressions.\r\n\r\n```bash\r\npython scripts/a11y_scanner.py /path/to/project --baseline audit-baseline.json\r\n```\r\n\r\n## Example: React Component Audit\r\n\r\n```tsx\r\n// BEFORE: src/components/ProductCard.tsx\r\nfunction ProductCard({ product }) {\r\n  return (\r\n    <div onClick={() => navigate(`/product/${product.id}`)}>\r\n      <img src={product.image} />\r\n      <div style={{ color: '#aaa', fontSize: '12px' }}>{product.name}</div>\r\n      <span style={{ color: '#999' }}>${product.price}</span>\r\n    </div>\r\n  );\r\n}\r\n```\r\n\r\n| # | WCAG | Severity | Issue |\r\n|---|------|----------|-------|\r\n| 1 | 1.1.1 | Critical | `<img>` missing `alt` attribute |\r\n| 2 | 2.1.1 | Critical | `<div onClick>` not keyboard accessible |\r\n| 3 | 1.4.3 | Major | Color `#aaa` on white fails contrast (2.32:1, needs 4.5:1) |\r\n| 4 | 1.4.3 | Major | Color `#999` on white fails contrast (2.85:1, needs 4.5:1) |\r\n| 5 | 4.1.2 | Major | Interactive element missing role and accessible name |\r\n\r\n```tsx\r\n// AFTER: src/components/ProductCard.tsx\r\nfunction ProductCard({ product }) {\r\n  return (\r\n    <a href={`/product/${product.id}`} className=\"product-card\"\r\n       aria-label={`View ${product.name} - $${product.price}`}>\r\n      <img src={product.image} alt={product.imageAlt || product.name} />\r\n      <div style={{ color: '#595959', fontSize: '12px' }}>{product.name}</div>\r\n      <span style={{ color: '#767676' }}>${product.price}</span>\r\n    </a>\r\n  );\r\n}\r\n```\r\n\r\n> See [references/examples-by-framework.md](references/examples-by-framework.md) for Vue, Angular, Next.js, and Svelte examples.\r\n\r\n## Tools Reference\r\n\r\n### a11y_scanner.py\r\n\r\n```\r\nUsage: python scripts/a11y_scanner.py <path> [options]\r\n\r\nOptions:\r\n  --json                  Output results as JSON\r\n  --format {table,csv}    Output format (default: table)\r\n  --severity {critical,major,minor}  Filter by minimum severity\r\n  --framework {react,vue,angular,svelte,html,auto}  Force framework (default: auto)\r\n  --baseline FILE         Compare against previous scan results\r\n  --report                Generate stakeholder report\r\n  --output FILE           Write results to file\r\n  --quiet                 Suppress output, exit code only\r\n  --ci                    CI mode: non-zero exit on critical issues\r\n```\r\n\r\n### contrast_checker.py\r\n\r\n```\r\nUsage: python scripts/contrast_checker.py [options]\r\n\r\nOptions:\r\n  --fg COLOR              Foreground color (hex)\r\n  --bg COLOR              Background color (hex)\r\n  --file FILE             Scan CSS file for color pairs\r\n  --tailwind DIR          Scan directory for Tailwind color classes\r\n  --json                  Output results as JSON\r\n  --suggest               Suggest accessible alternatives for failures\r\n  --level {aa,aaa}        Target conformance level (default: aa)\r\n```\r\n\r\n## Common Pitfalls\r\n\r\n| Pitfall | Correct Approach |\r\n|---------|------------------|\r\n| `role=\"button\"` on a `<div>` | Use native `<button>` -- includes keyboard handling for free |\r\n| `tabindex=\"0\"` on everything | Only interactive elements need focus; use native elements |\r\n| `aria-label` on non-interactive elements | Use `aria-labelledby` pointing to visible text |\r\n| `display: none` for screen reader hiding | Use `.sr-only` class instead |\r\n| Color alone to convey meaning | Add icons, text labels, or patterns alongside color |\r\n| Placeholder as only label | Always provide a visible `<label>` |\r\n| `outline: none` without replacement | Always provide a visible focus indicator via `focus-visible` |\r\n| Empty `alt=\"\"` on informational images | Informational images need descriptive alt text |\r\n| Skipping heading levels (h1 -> h3) | Heading levels must be sequential |\r\n| `onClick` without `onKeyDown` | Add keyboard support or prefer native elements |\r\n| Ignoring `prefers-reduced-motion` | Wrap animations in `@media (prefers-reduced-motion: no-preference)` |\r\n\r\n## Related Skills\r\n\r\n| Skill | Relationship |\r\n|-------|-------------|\r\n| **senior-frontend** | Frontend patterns used in a11y fixes |\r\n| **code-reviewer** | Include a11y checks in code review workflows |\r\n| **senior-qa** | Integration of a11y testing into QA processes |\r\n| **playwright-pro** | Automated browser testing with accessibility assertions |\r\n| **epic-design** | WCAG 2.1 AA compliant animations and scroll storytelling |\r\n| **tdd-guide** | Test-driven development patterns for a11y test cases |\r\n\r\n## Reference Documentation\r\n\r\n| Reference | Description |\r\n|-----------|-------------|\r\n| [wcag-quick-ref.md](references/wcag-quick-ref.md) | WCAG 2.2 Level A & AA criteria quick reference |\r\n| [wcag-22-new-criteria.md](references/wcag-22-new-criteria.md) | New WCAG 2.2 success criteria (Focus Appearance, Target Size, etc.) |\r\n| [aria-patterns.md](references/aria-patterns.md) | ARIA patterns, keyboard interaction, and live regions |\r\n| [framework-a11y-patterns.md](references/framework-a11y-patterns.md) | Framework-specific fix patterns (React, Vue, Angular, Svelte, HTML) |\r\n| [color-contrast-guide.md](references/color-contrast-guide.md) | Color contrast checker details, Tailwind palette mapping, sr-only class |\r\n| [ci-cd-integration.md](references/ci-cd-integration.md) | GitHub Actions, GitLab CI, Azure DevOps, pre-commit hook configs |\r\n| [audit-report-template.md](references/audit-report-template.md) | Stakeholder-ready audit report template |\r\n| [testing-checklist.md](references/testing-checklist.md) | Manual testing checklist (keyboard, screen reader, visual, forms) |\r\n| [examples-by-framework.md](references/examples-by-framework.md) | Full audit examples for Vue, Angular, Next.js, and Svelte |\r\n\r\n## Resources\r\n\r\n- [WCAG 2.2 Specification](https://www.w3.org/TR/WCAG22/)\r\n- [WAI-ARIA Authoring Practices 1.2](https://www.w3.org/WAI/ARIA/apg/)\r\n- [Deque axe-core Rules](https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md)\r\n- [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)",
    "user_template": ""
  },
  "variables": [],
  "install": {
    "steps": [
      {
        "title": "Download & unzip",
        "detail": "Download the .zip package from SkillVault and unzip it. The a11y-audit/ folder contains SKILL.md plus any companion scripts, references and assets."
      },
      {
        "title": "Copy into your agent skills directory",
        "detail": "Move the folder into your agent's skills directory — e.g. ~/.claude/skills/ (Claude Code), .codex/skills/, .cursor/skills/ or your project's .claude/skills/ folder — then restart or reload the session."
      },
      {
        "title": "Use it",
        "detail": "Describe the task in natural language; the agent loads the skill automatically when the request matches the skill description."
      }
    ]
  },
  "usage": {
    "steps": []
  },
  "metadata": {
    "author": "SkillVault",
    "source": "https://skillvault.top/skills/a11y-audit",
    "exported_at": "2026-11-03T07:44:33.956Z"
  }
}
a11y-audit.aiskill (YAML)
format: aiskill/v1
skill:
  name: a11y-audit
  slug: a11y-audit
  version: 1.0.0
  description: >-
    Accessibility audit skill for scanning, fixing, and verifying WCAG 2.2 Level A and AA compliance
    across React, Next.js, Vue, Angular, Svelte, and plain HTML codebases. Use when auditing
    accessibility, fixing a11y violations, checking color contrast, generating compliance reports,
    or integrating accessibility checks into CI/CD pipelines.
  category: Development
  tags:
    - testing
    - frontend
  platforms:
    - chatgpt
    - claude-code
    - cursor
  tested_environment: >-
    Agent Skills convention (SKILL.md) — works with Claude Code, Cursor, ChatGPT/Codex and
    compatible agents
  license: MIT
prompts:
  system: "# Accessibility Audit\r\n\r\nWCAG 2.2 Accessibility Audit and Remediation Skill\r\n\r\n## Description\r\n\r\nThe a11y-audit skill provides a complete accessibility audit pipeline for modern web applications. It implements a three-phase workflow -- Scan, Fix, Verify -- that identifies WCAG 2.2 Level A and AA violations, generates exact fix code per framework, and produces stakeholder-ready compliance reports.\r\n\r\nFor every violation it finds, it provides the precise before/after code fix tailored to your framework (React, Next.js, Vue, Angular, Svelte, or plain HTML).\r\n\r\n**What this skill does:**\r\n\r\n1. **Scans** your codebase for every WCAG 2.2 Level A and AA violation, categorized by severity (Critical, Major, Minor)\r\n2. **Fixes** each violation with framework-specific before/after code patterns\r\n3. **Verifies** that fixes resolve the original violations and introduces no regressions\r\n4. **Reports** findings in a structured format suitable for developers, PMs, and compliance stakeholders\r\n5. **Integrates** into CI/CD pipelines to prevent accessibility regressions\r\n\r\n## Features\r\n\r\n| Feature | Description |\r\n|---------|-------------|\r\n| **Full WCAG 2.2 Scan** | Checks all Level A and AA success criteria across your codebase |\r\n| **Framework Detection** | Auto-detects React, Next.js, Vue, Angular, Svelte, or plain HTML |\r\n| **Severity Classification** | Categorizes each violation as Critical, Major, or Minor |\r\n| **Fix Code Generation** | Produces before/after code diffs for every issue |\r\n| **Color Contrast Checker** | Validates foreground/background pairs against AA and AAA ratios |\r\n| **Compliance Reporting** | Generates stakeholder reports with pass/fail summaries |\r\n| **CI/CD Integration** | GitHub Actions, GitLab CI, Azure DevOps pipeline configs |\r\n| **Keyboard Navigation Audit** | Detects missing focus management and tab order issues |\r\n| **ARIA Validation** | Checks for incorrect, redundant, or missing ARIA attributes |\r\n\r\n### Severity Definitions\r\n\r\n| Severity | Definition | Example | SLA |\r\n|----------|-----------|---------|-----|\r\n| **Critical** | Blocks access for entire user groups | Missing alt text, no keyboard access to navigation | Fix before release |\r\n| **Major** | Significant barrier that degrades experience | Insufficient color contrast, missing form labels | Fix within current sprint |\r\n| **Minor** | Usability issue that causes friction | Redundant ARIA roles, suboptimal heading hierarchy | Fix within next 2 sprints |\r\n\r\n## Usage\r\n\r\n### Quick Start\r\n\r\n```bash\r\n# Scan entire project\r\npython scripts/a11y_scanner.py /path/to/project\r\n\r\n# Scan with JSON output for tooling\r\npython scripts/a11y_scanner.py /path/to/project --json\r\n\r\n# Check color contrast for specific values\r\npython scripts/contrast_checker.py --fg \"#777777\" --bg \"#ffffff\"\r\n\r\n# Check contrast across a CSS/Tailwind file\r\npython scripts/contrast_checker.py --file /path/to/styles.css\r\n```\r\n\r\n### Slash Command\r\n\r\n```\r\n/a11y-audit                    # Audit current project\r\n/a11y-audit --scope src/       # Audit specific directory\r\n/a11y-audit --fix              # Audit and auto-apply fixes\r\n/a11y-audit --report           # Generate stakeholder report\r\n/a11y-audit --ci               # Output CI-compatible results\r\n```\r\n\r\n### Three-Phase Workflow\r\n\r\n**Phase 1: Scan** -- Walk the source tree, detect framework, apply rule set.\r\n\r\n```bash\r\npython scripts/a11y_scanner.py /path/to/project --format table\r\n```\r\n\r\n**Phase 2: Fix** -- Apply framework-specific fixes for each violation.\r\n\r\n> See [references/framework-a11y-patterns.md](references/framework-a11y-patterns.md) for the complete fix patterns catalog.\r\n\r\n**Phase 3: Verify** -- Re-run the scanner to confirm fixes and check for regressions.\r\n\r\n```bash\r\npython scripts/a11y_scanner.py /path/to/project --baseline audit-baseline.json\r\n```\r\n\r\n## Example: React Component Audit\r\n\r\n```tsx\r\n// BEFORE: src/components/ProductCard.tsx\r\nfunction ProductCard({ product }) {\r\n  return (\r\n    <div onClick={() => navigate(`/product/${product.id}`)}>\r\n      <img src={product.image} />\r\n      <div style={{ color: '#aaa', fontSize: '12px' }}>{product.name}</div>\r\n      <span style={{ color: '#999' }}>${product.price}</span>\r\n    </div>\r\n  );\r\n}\r\n```\r\n\r\n| # | WCAG | Severity | Issue |\r\n|---|------|----------|-------|\r\n| 1 | 1.1.1 | Critical | `<img>` missing `alt` attribute |\r\n| 2 | 2.1.1 | Critical | `<div onClick>` not keyboard accessible |\r\n| 3 | 1.4.3 | Major | Color `#aaa` on white fails contrast (2.32:1, needs 4.5:1) |\r\n| 4 | 1.4.3 | Major | Color `#999` on white fails contrast (2.85:1, needs 4.5:1) |\r\n| 5 | 4.1.2 | Major | Interactive element missing role and accessible name |\r\n\r\n```tsx\r\n// AFTER: src/components/ProductCard.tsx\r\nfunction ProductCard({ product }) {\r\n  return (\r\n    <a href={`/product/${product.id}`} className=\"product-card\"\r\n       aria-label={`View ${product.name} - $${product.price}`}>\r\n      <img src={product.image} alt={product.imageAlt || product.name} />\r\n      <div style={{ color: '#595959', fontSize: '12px' }}>{product.name}</div>\r\n      <span style={{ color: '#767676' }}>${product.price}</span>\r\n    </a>\r\n  );\r\n}\r\n```\r\n\r\n> See [references/examples-by-framework.md](references/examples-by-framework.md) for Vue, Angular, Next.js, and Svelte examples.\r\n\r\n## Tools Reference\r\n\r\n### a11y_scanner.py\r\n\r\n```\r\nUsage: python scripts/a11y_scanner.py <path> [options]\r\n\r\nOptions:\r\n  --json                  Output results as JSON\r\n  --format {table,csv}    Output format (default: table)\r\n  --severity {critical,major,minor}  Filter by minimum severity\r\n  --framework {react,vue,angular,svelte,html,auto}  Force framework (default: auto)\r\n  --baseline FILE         Compare against previous scan results\r\n  --report                Generate stakeholder report\r\n  --output FILE           Write results to file\r\n  --quiet                 Suppress output, exit code only\r\n  --ci                    CI mode: non-zero exit on critical issues\r\n```\r\n\r\n### contrast_checker.py\r\n\r\n```\r\nUsage: python scripts/contrast_checker.py [options]\r\n\r\nOptions:\r\n  --fg COLOR              Foreground color (hex)\r\n  --bg COLOR              Background color (hex)\r\n  --file FILE             Scan CSS file for color pairs\r\n  --tailwind DIR          Scan directory for Tailwind color classes\r\n  --json                  Output results as JSON\r\n  --suggest               Suggest accessible alternatives for failures\r\n  --level {aa,aaa}        Target conformance level (default: aa)\r\n```\r\n\r\n## Common Pitfalls\r\n\r\n| Pitfall | Correct Approach |\r\n|---------|------------------|\r\n| `role=\"button\"` on a `<div>` | Use native `<button>` -- includes keyboard handling for free |\r\n| `tabindex=\"0\"` on everything | Only interactive elements need focus; use native elements |\r\n| `aria-label` on non-interactive elements | Use `aria-labelledby` pointing to visible text |\r\n| `display: none` for screen reader hiding | Use `.sr-only` class instead |\r\n| Color alone to convey meaning | Add icons, text labels, or patterns alongside color |\r\n| Placeholder as only label | Always provide a visible `<label>` |\r\n| `outline: none` without replacement | Always provide a visible focus indicator via `focus-visible` |\r\n| Empty `alt=\"\"` on informational images | Informational images need descriptive alt text |\r\n| Skipping heading levels (h1 -> h3) | Heading levels must be sequential |\r\n| `onClick` without `onKeyDown` | Add keyboard support or prefer native elements |\r\n| Ignoring `prefers-reduced-motion` | Wrap animations in `@media (prefers-reduced-motion: no-preference)` |\r\n\r\n## Related Skills\r\n\r\n| Skill | Relationship |\r\n|-------|-------------|\r\n| **senior-frontend** | Frontend patterns used in a11y fixes |\r\n| **code-reviewer** | Include a11y checks in code review workflows |\r\n| **senior-qa** | Integration of a11y testing into QA processes |\r\n| **playwright-pro** | Automated browser testing with accessibility assertions |\r\n| **epic-design** | WCAG 2.1 AA compliant animations and scroll storytelling |\r\n| **tdd-guide** | Test-driven development patterns for a11y test cases |\r\n\r\n## Reference Documentation\r\n\r\n| Reference | Description |\r\n|-----------|-------------|\r\n| [wcag-quick-ref.md](references/wcag-quick-ref.md) | WCAG 2.2 Level A & AA criteria quick reference |\r\n| [wcag-22-new-criteria.md](references/wcag-22-new-criteria.md) | New WCAG 2.2 success criteria (Focus Appearance, Target Size, etc.) |\r\n| [aria-patterns.md](references/aria-patterns.md) | ARIA patterns, keyboard interaction, and live regions |\r\n| [framework-a11y-patterns.md](references/framework-a11y-patterns.md) | Framework-specific fix patterns (React, Vue, Angular, Svelte, HTML) |\r\n| [color-contrast-guide.md](references/color-contrast-guide.md) | Color contrast checker details, Tailwind palette mapping, sr-only class |\r\n| [ci-cd-integration.md](references/ci-cd-integration.md) | GitHub Actions, GitLab CI, Azure DevOps, pre-commit hook configs |\r\n| [audit-report-template.md](references/audit-report-template.md) | Stakeholder-ready audit report template |\r\n| [testing-checklist.md](references/testing-checklist.md) | Manual testing checklist (keyboard, screen reader, visual, forms) |\r\n| [examples-by-framework.md](references/examples-by-framework.md) | Full audit examples for Vue, Angular, Next.js, and Svelte |\r\n\r\n## Resources\r\n\r\n- [WCAG 2.2 Specification](https://www.w3.org/TR/WCAG22/)\r\n- [WAI-ARIA Authoring Practices 1.2](https://www.w3.org/WAI/ARIA/apg/)\r\n- [Deque axe-core Rules](https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md)\r\n- [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)"
  user_template: ""
variables: []
install:
  steps:
    - title: Download & unzip
      detail: >-
        Download the .zip package from SkillVault and unzip it. The a11y-audit/ folder contains
        SKILL.md plus any companion scripts, references and assets.
    - title: Copy into your agent skills directory
      detail: >-
        Move the folder into your agent's skills directory — e.g. ~/.claude/skills/ (Claude Code),
        .codex/skills/, .cursor/skills/ or your project's .claude/skills/ folder — then restart or
        reload the session.
    - title: Use it
      detail: >-
        Describe the task in natural language; the agent loads the skill automatically when the
        request matches the skill description.
usage:
  steps: []
metadata:
  author: SkillVault
  source: https://skillvault.top/skills/a11y-audit
  exported_at: "2026-11-03T07:44:33.956Z"

安装指南

  1. 1

    Download & unzip

    Download the .zip package from SkillVault and unzip it. The a11y-audit/ folder contains SKILL.md plus any companion scripts, references and assets.

  2. 2

    Copy into your agent skills directory

    Move the folder into your agent's skills directory — e.g. ~/.claude/skills/ (Claude Code), .codex/skills/, .cursor/skills/ or your project's .claude/skills/ folder — then restart or reload the session.

  3. 3

    Use it

    Describe the task in natural language; the agent loads the skill automatically when the request matches the skill description.

使用方法

平台兼容性

ChatGPT GPTs

OpenAI

将系统提示词粘贴到 GPT 的「Instructions」字段,并把用户模板作为起始消息使用。

官方文档

Claude Code

Anthropic

将导出的 .aiskill JSON 保存为项目中的技能文件,或将系统提示词粘贴进 CLAUDE.md / 斜杠命令 Markdown 文件。

官方文档

Cursor

Anysphere

将系统提示词复制到 .cursor/rules/*.mdc(或设置中的 Project Rules),并在智能体提示词中引用用户模板。

官方文档

相关技能