a11y-audit
This skill should be used when the user asks to "check accessibility", "audit WCAG compliance", "scan HTML for a11y issues", "check color contrast", or "find accessibility violations in web pages".
What this skill does
# Accessibility Audit > **Category:** Engineering > **Domain:** Web Accessibility ## Overview The **Accessibility Audit** skill provides automated scanning of HTML files for WCAG 2.1 compliance violations and color contrast checking against AA/AAA standards. It catches missing alt text, broken heading hierarchies, unlabeled form inputs, and insufficient color contrast early in development. ## Quick Start ```bash # Scan HTML for WCAG violations python scripts/a11y_scanner.py --file index.html # Scan a directory of HTML files python scripts/a11y_scanner.py --dir ./src/templates # Check color contrast python scripts/contrast_checker.py --foreground "#333333" --background "#ffffff" # Parse CSS file for contrast issues python scripts/contrast_checker.py --css styles.css # JSON output for CI python scripts/a11y_scanner.py --file index.html --format json ``` ## Tools Overview ### a11y_scanner.py Scans HTML files for WCAG 2.1 violations including structural, semantic, and interactive element issues. | Feature | Description | |---------|-------------| | Image alt text | Detects missing or empty alt on non-decorative images | | Heading hierarchy | Validates h1-h6 levels are sequential | | Form labels | Ensures inputs have associated label elements | | ARIA attributes | Checks ARIA usage correctness | | Link text | Flags generic text like "click here" or "read more" | | Language attribute | Checks for lang on html element | | Tab order | Detects positive tabindex values | | Landmarks | Validates semantic landmark usage | ### contrast_checker.py Checks color contrast ratios against WCAG AA and AAA thresholds. | Feature | Description | |---------|-------------| | Ratio calculation | Computes relative luminance contrast ratio | | AA compliance | 4.5:1 normal text, 3:1 large text | | AAA compliance | 7:1 normal text, 4.5:1 large text | | CSS parsing | Extracts color/background pairs from CSS | | Color suggestions | Recommends nearest compliant color | ## Workflows ### Full Accessibility Audit 1. **Scan HTML** - Run a11y_scanner.py on all templates 2. **Check contrast** - Run contrast_checker.py on stylesheets 3. **Triage** - Prioritize Level A violations first 4. **Remediate** - Fix critical issues (alt text, form labels, headings) 5. **Re-scan** - Verify fixes pass all checks ### CI Integration ```bash # Gate on Level A violations python scripts/a11y_scanner.py --dir ./templates --format json --level A --strict # Check CSS contrast python scripts/contrast_checker.py --css ./static/css/main.css --format json ``` ### Development Workflow 1. **Pre-commit** - Quick scan of changed HTML files 2. **PR review** - Full scan as part of review checklist 3. **Staging audit** - Comprehensive scan before release 4. **Monitoring** - Regular scheduled audits ## Reference Documentation - [WCAG Guidelines](references/wcag-guidelines.md) - Conformance levels, success criteria, common fixes ## Common Patterns Quick Reference ### WCAG Levels | Level | Description | Typical Requirement | |-------|-------------|-------------------| | A | Minimum baseline | Legal compliance | | AA | Industry standard | Most regulations, ADA | | AAA | Enhanced | Best practice goal | ### Contrast Ratios | Context | AA | AAA | |---------|-----|-----| | Normal text (<18pt) | 4.5:1 | 7:1 | | Large text (>=18pt bold or >=14pt) | 3:1 | 4.5:1 | | UI components | 3:1 | 3:1 | ### Quick Fixes | Issue | Fix | |-------|-----| | Missing alt text | `<img alt="Description of image">` | | Skipped heading | Use sequential h1 through h6 | | No form label | `<label for="inputId">Label</label>` | | Generic link text | Replace "click here" with descriptive text | | Missing lang | `<html lang="en">` | | Positive tabindex | Use tabindex="0" or tabindex="-1" only | ### Severity Mapping - **CRITICAL** - WCAG Level A violations - **WARNING** - WCAG Level AA violations - **INFO** - WCAG Level AAA recommendations
Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.