accessibility-checker

Ensure WCAG2AA accessibility compliance. Use when creating forms, adding images, building navigation, creating interactive elements, or any user-facing HTML content.

allowed_tools: Read, Write, Edit

$ Installieren

git clone https://github.com/majiayu000/claude-skill-registry /tmp/claude-skill-registry && cp -r /tmp/claude-skill-registry/skills/development/accessibility-checker ~/.claude/skills/claude-skill-registry

// tip: Run this command in your terminal to install the skill


name: accessibility-checker description: Ensure WCAG2AA accessibility compliance. Use when creating forms, adding images, building navigation, creating interactive elements, or any user-facing HTML content. allowed-tools: Read, Write, Edit

Accessibility Checker Skill

This skill ensures all HTML content meets WCAG2AA accessibility standards.

Quick Reference

ElementRequirement
ImagesMust have alt attribute
Form inputsMust have associated <label>
LinksMust have descriptive text (not "click here")
NavigationUse <nav> with aria-label
Main contentUse <main> with id for skip link
HeadingsFollow hierarchy (h1 → h2 → h3)
TablesUse <th scope="col/row">

Forms (MUST follow)

Every input MUST have a label:

<!-- Method 1: for/id association -->
<label for="email">Email Address</label>
<input type="email" id="email" name="email"/>

<!-- Method 2: wrapping -->
<label>
  Email Address
  <input type="email" name="email"/>
</label>

Use fieldset for related inputs:

<fieldset>
  <legend>Shipping Address</legend>
  <label for="street">Street</label>
  <input type="text" id="street" name="street"/>
  <label for="city">City</label>
  <input type="text" id="city" name="city"/>
</fieldset>

Images (MUST follow)

All images MUST have alt text:

<!-- Informative image -->
<img src="chart.png" alt="Sales increased 20% in Q4"/>

<!-- Decorative image (empty alt) -->
<img src="decoration.png" alt=""/>

<!-- Complex image (use figure) -->
<figure>
  <img src="diagram.png" alt="System architecture diagram"/>
  <figcaption>Figure 1: Three-tier architecture with load balancer</figcaption>
</figure>

Navigation (MUST follow)

Provide skip links and landmarks:

<body>
  <a href="#main" class="skip-link">Skip to main content</a>

  <nav aria-label="Main navigation">
    <ul>
      <li><a href="/">Home</a></li>
      <li><a href="/about">About</a></li>
    </ul>
  </nav>

  <main id="main">
    <!-- Content -->
  </main>
</body>

Links (MUST follow)

Links need descriptive, unique text:

<!-- Bad -->
<a href="/products">Click here</a>
<a href="/docs">Read more</a>

<!-- Good -->
<a href="/products">View all products</a>
<a href="/docs">Read the documentation</a>

Headings

Follow logical hierarchy:

<h1>Page Title</h1>
  <h2>Section One</h2>
    <h3>Subsection</h3>
  <h2>Section Two</h2>

Never skip levels (h1 → h3 is wrong).

WCAG AAA Enhanced Accessibility (Optional)

WCAG AAA provides enhanced accessibility beyond the AA baseline. Use when targeting users with more significant accessibility needs.

Contrast Requirements

LevelNormal TextLarge Text
AA (default)4.5:13:1
AAA (enhanced)7:14.5:1

Large text is 18pt+ (24px) or 14pt+ bold (18.5px).

Enabling AAA in pa11y

Edit .pa11yci to use AAA standard:

{
  "defaults": {
    "standard": "WCAG2AAA",
    "timeout": 30000,
    "wait": 1000
  }
}

AAA-Specific Requirements

RequirementAAA Criterion
7:1 contrast ratio1.4.6 Contrast (Enhanced)
No images of text1.4.9 Images of Text (No Exception)
Sign language for video1.2.6 Sign Language
Extended audio description1.2.7 Extended Audio Description
Live captions1.2.9 Audio-only (Live)
Reading level (lower secondary)3.1.5 Reading Level
Pronunciation help3.1.6 Pronunciation
Context-sensitive help3.3.5 Help
Error prevention (all)3.3.6 Error Prevention (All)

CSS for AAA Contrast

:root {
  /* AAA-compliant color pairs */
  --text-color: #1a1a1a;        /* On white: 16.1:1 */
  --text-muted: #525252;        /* On white: 7.1:1 */
  --background: #ffffff;

  /* Links need 3:1 contrast against surrounding text */
  --link-color: #0047ab;        /* On white: 8.5:1 */
}

/* High contrast mode support */
@media (prefers-contrast: more) {
  :root {
    --text-color: #000000;
    --background: #ffffff;
    --border-color: #000000;
  }
}

When to Use AAA

ScenarioRecommendation
Government/public servicesConsider AAA
Healthcare applicationsConsider AAA
Educational contentConsider AAA
Elderly user baseConsider AAA
Legal requirementsCheck jurisdiction
General websitesAA is sufficient

Partial AAA Adoption

You can adopt specific AAA criteria without full compliance:

{
  "defaults": {
    "standard": "WCAG2AA",
    "rules": [
      "WCAG2AAA.Principle1.Guideline1_4.1_4_6"
    ]
  }
}

Testing AAA Compliance

# Run with AAA standard
npx pa11y --standard WCAG2AAA src/index.html

# Check specific criterion
npx pa11y --standard WCAG2AAA --include-notices src/index.html

See FORMS.md, IMAGES.md, NAVIGATION.md for details.

Related Skills

  • xhtml-author - Write valid XHTML-strict HTML5 markup
  • forms - HTML-first form patterns with CSS-only validation
  • custom-elements - Define and use custom HTML elements
  • i18n - Write internationalization-friendly HTML pages