Skip to content

MaarkssDN/Birthub-360 / .agents/skills/axe-a11y

axe-a11y

Verified

Use whenever pages or components need automated accessibility scanning: axe-core via axe.run(), @axe-core/playwright or the CLI on every PR, rule configuration and CI-gateable results, plus pa11y, Lighthouse CI accessibility, WAVE and IBM Equal Access (Section 508) in its references.

evals/three-scanners-one-number-for-the-board/task.md

View on GitHub
# The board deck says accessibility issues are up 44 percent

## Problem Description

Board pack goes out Tuesday. The accessibility slide currently reads "39 issues
on checkout, up from 27 last quarter" and "80% WCAG 2.2 AA conformant". Both
numbers come out of `lib/rollup.js`, which our summer intern wrote in an
afternoon and nobody reviewed. He has left.

What the script does is add up last night's output from the three scanners we
run against staging - `reports/axe-checkout.json`, `reports/pa11y-checkout.json`
and `reports/wave-checkout.json`. The commands that produced them are in
`reports/run.sh`.

Three independent engines is the part of this I actually like. It means we are
not resting a board number on one vendor's opinion of what counts. What I
cannot defend on Tuesday is the 39 itself, because I do not know what is inside
it and I am the one who has to answer for it.

The percentage I do understand - checks passed over checks run - so leave that
line alone unless you have a specific objection to it. He also left a comment in
the code about skipping something he thought was subjective, and I do not know
whether that was a reasonable call.

I still need a number. The board will not accept "it's complicated" and neither
will I. Give me one I can defend, and tell me exactly what it counts.

## Output Specification

1. Rewrite `lib/rollup.js` so the figure it produces is one you would put your
   name to. Keep it a function of the three report files - no hard-coded
   answers - and export whatever shape the board note needs.
2. Add `test/rollup.test.js` covering the behaviour you changed.
3. Write `docs/board-note.md`: the number, what it counts, what it excludes and
   why, what the second slide line should say if it should not stay as it is,
   and anything about how the scans were run that has to change before next
   quarter.
4. `npm test` must pass and `test/format.test.js` must not be edited. No new
   dependencies.

## Input Files

Extract the following files before beginning.

=============== FILE: package.json ===============
{
  "name": "compliance-rollup",
  "private": true,
  "type": "module",
  "scripts": {
    "test": "node --test"
  }
}

=============== FILE: lib/rollup.js ===============
import { readFileSync } from 'node:fs';

const read = (p) => JSON.parse(readFileSync(p, 'utf8'));

export function total(axePath, pa11yPath, wavePath) {
  const axe = read(axePath);
  const pa11y = read(pa11yPath);
  const wave = read(wavePath);

  const a = axe.violations.reduce((n, v) => n + v.nodes.length, 0);
  const p = pa11y.issues.length;
  // contrast is subjective, skip the contrast bucket
  const w = wave.statistics.errorcount + wave.statistics.alertcount;

  return a + p + w;
}

export function conformancePercent(axePath) {
  const axe = read(axePath);
  const failed = axe.violations.length;
  const checked = axe.violations.length + axe.passes.length;
  return Math.round(((checked - failed) / checked) * 100);
}

=============== FILE: lib/format.js ===============
export function pct(n) {
  return `${Math.round(n)}%`;
}

export function plural(n, word) {
  return `${n} ${word}${n === 1 ? '' : 's'}`;
}

=============== FILE: test/format.test.js ===============
import test from 'node:test';
import assert from 'node:assert/strict';
import { pct, plural } from '../lib/format.js';

test('formats a percentage', () => {
  assert.equal(pct(79.6), '80%');
});

test('pluralises a count', () => {
  assert.equal(plural(1, 'defect'), '1 defect');
  assert.equal(plural(5, 'defect'), '5 defects');
});

=============== FILE: reports/run.sh ===============
#!/usr/bin/env bash
set -euo pipefail

URL=https://staging.northwind.example/checkout

npx @axe-core/cli "$URL" \
  --tags wcag2a,wcag2aa \
  --save reports/axe-checkout.json

npx pa11y "$URL" \
  --standard WCAG2AA \
  --runner htmlcs \
  --include-warnings \
  --include-notices \
  --reporter json > reports/pa11y-checkout.json

curl -sS "https://wave.webaim.org/api/request?key=$WAVE_API_KEY&url=$URL&reporttype=4" \
  > reports/wave-checkout.json

=============== FILE: reports/axe-checkout.json ===============
{
  "url": "https://staging.northwind.example/checkout",
  "timestamp": "2026-09-12T01:30:11.004Z",
  "testEngine": { "name": "axe-core", "version": "4.10.2" },
  "toolOptions": { "reporter": "v1", "runOnly": { "type": "tag", "values": ["wcag2a", "wcag2aa"] } },
  "violations": [
    {
      "id": "color-contrast",
      "impact": "serious",
      "tags": ["cat.color", "wcag2aa", "wcag143"],
      "description": "Ensures the contrast between foreground and background colours meets WCAG 2 AA thresholds",
      "nodes": [
        { "target": ["main > form#order > button.primary"], "html": "<button class=\"primary\">Place order</button>", "failureSummary": "Contrast 3.1:1, expected 4.5:1" },
        { "target": ["footer li:nth-child(1) > a.footer-link"], "html": "<a class=\"footer-link\" href=\"/help\">Help</a>", "failureSummary": "Contrast 2.8:1, expected 4.5:1" }
      ]
    },
    {
      "id": "label",
      "impact": "critical",
      "tags": ["cat.forms", "wcag2a", "wcag412", "wcag131"],
      "description": "Ensures every form element has a label",
      "nodes": [
        { "target": ["#email"], "html": "<input id=\"email\" type=\"email\">", "failureSummary": "Form element has no label" }
      ]
    },
    {
      "id": "image-alt",
      "impact": "critical",
      "tags": ["cat.text-alternatives", "wcag2a", "wcag111"],
      "description": "Ensures img elements have alternate text",
      "nodes": [
        { "target": ["main > img.hero"], "html": "<img class=\"hero\" src=\"/hero.png\">", "failureSummary": "Element has no alt attribute" }
      ]
    },
    {
      "id": "link-name",
      "impact": "serious",
      "tags": ["cat.name-role-value", "wcag2a", "wcag412", "wcag244"],
      "description": "Ensures links have discernible text",
      "nodes": [
        { "target": ["header nav > a.icon-cart"], "html": "<a class=\"icon-cart\" href=\"/cart\"></a>", "failureSummary": "Element has no inner text" }
      ]
    }
  ],
  "incomplete": [
    {
      "id": "color-contrast",
      "impact": "serious",
      "tags": ["cat.color", "wcag2aa", "wcag143"],
      "nodes": [
        { "target": ["footer li:nth-child(3) > a.footer-link"], "html": "<a class=\"footer-link\" href=\"/privacy\">Privacy</a>", "failureSummary": "Element background could not be determined due to a background image" },
        { "target": ["span.badge"], "html": "<span class=\"badge\">New</span>", "failureSummary": "Element background could not be determined due to a background image" }
      ]
    }
  ],
  "passes": [
    { "id": "html-has-lang", "nodes": [{ "target": ["html"] }] },
    { "id": "document-title", "nodes": [{ "target": ["html"] }] },
    { "id": "button-name", "nodes": [{ "target": ["button.primary"] }, { "target": ["button.apply-coupon"] }] },
    { "id": "list", "nodes": [{ "target": ["ul.summary"] }] },
    { "id": "aria-roles", "nodes": [{ "target": ["div.tablist"] }] },
    { "id": "td-headers-attr", "nodes": [{ "target": ["table.lines"] }] },
    { "id": "valid-lang", "nodes": [{ "target": ["html"] }] },
    { "id": "meta-viewport", "nodes": [{ "target": ["meta"] }] },
    { "id": "duplicate-id-aria", "nodes": [{ "target": ["body"] }] },
    { "id": "aria-allowed-attr", "nodes": [{ "target": ["div.tablist"] }] },
    { "id": "aria-required-attr", "nodes": [{ "target": ["div.tablist"] }] },
    { "id": "aria-hidden-body", "nodes": [{ "target": ["body"] }] },
    { "id": "form-field-multiple-labels", "nodes": [{ "target": ["#postcode"] }] },
    { "id": "input-button-name", "nodes": [{ "target": ["input.go"] }] },
    { "id": "scrollable-region-focusable", "nodes": [{ "target": ["div.lines-scroll"] }] },
    { "id": "bypass", "nodes": [{ "target": ["a.skip"] }] }
  ],
  "inapplicable": [
    { "id": "video-caption" },
    { "id": "frame-title" },
    { "id": "area-alt" }
  ]
}

=============== FILE: reports/pa11y-checkout.json ===============
{
  "documentTitle": "Checkout - Northwind",
  "pageUrl": "https://staging.northwind.example/checkout",
  "issues": [
    { "code": "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail", "type": "error", "typeCode": 1, "selector": "html > body > main > form#order > button", "context": "<button class=\"primary\">Place order</button>", "message": "This element has insufficient contrast at this conformance level.", "runner": "htmlcs" },
    { "code": "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail", "type": "error", "typeCode": 1, "selector": "html > body > footer > ul > li:nth-child(1) > a", "context": "<a class=\"footer-link\" href=\"/help\">Help</a>", "message": "This element has insufficient contrast at this conformance level.", "runner": "htmlcs" },
    { "code": "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail", "type": "error", "typeCode": 1, "selector": "html > body > footer > ul > li:nth-child(3) > a", "context": "<a class=\"footer-link\" href=\"/privacy\">Privacy</a>", "message": "This element has insufficient contrast at this conformance level.", "runner": "htmlcs" },
    { "code": "WCAG2AA.Principle1.Guideline1_3.1_3_1.F68", "type": "error", "typeCode": 1, "selector": "html > body > main > form#order > div:nth-child(2) > input", "context": "<input id=\"email\" type=\"email\">", "message": "This form field should be labelled in some way.", "runner": "htmlcs" },
    { "code": "WCAG2AA.Principle1.Guideline1_1.1_1_1.H37", "type": "error", "typeCode": 1, "selector": "html > body > main > img", "context": "<img class=\"hero\" src=\"/hero.png\">", "message": "Img element missing an alt attribute.", "runner": "htmlcs" },
    { "code": "WCAG2AA.Principle4.Guideline4_1.4_1_2.H91.A.NoContent", "type": "error", "typeCode": 1, "selector": "html > body > header > nav > a:nth-child(2)", "context": "<a class=\"icon-cart\" href=\"/cart\"></a>", "message": "Anchor element found with a valid href attribute but no link content.", "runner": "htmlcs" },
    { "code": "WCAG2AA.Principle1.Guideline1_3.1_3_1.H42.2", "type": "warning", "typeCode": 2, "selector": "html > body > main > p:nth-child(1)", "context": "<p class=\"lead\">Order summary</p>", "message": "Heading markup should be used if this content is intended as a heading.", "runner": "htmlcs" },
    { "code": "WCAG2AA.Principle1.Guideline1_3.1_3_1.H42.2", "type": "warning", "typeCode": 2, "selector": "html > body > main > p:nth-child(6)", "context": "<p class=\"note\">Delivery</p>", "message": "Heading markup should be used if this content is intended as a heading.", "runner": "htmlcs" },
    { "code": "WCAG2AA.Principle1.Guideline1_3.1_3_1.H42.2", "type": "warning", "typeCode": 2, "selector": "html > body > main > p:nth-child(9)", "context": "<p class=\"sub\">Billing</p>", "message": "Heading markup should be used if this content is intended as a heading.", "runner": "htmlcs" },
    { "code": "WCAG2AA.Principle2.Guideline2_4.2_4_1.H64.1", "type": "warning", "typeCode": 2, "selector": "html > body > main > iframe", "context": "<iframe class=\"pay\" src=\"https://pay.example\">", "message": "Iframe element requires a non-empty title attribute.", "runner": "htmlcs" },
    { "code": "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Abs", "type": "warning", "typeCode": 2, "selector": "html > body > main > span:nth-child(4)", "context": "<span class=\"badge\">New</span>", "message": "Unable to determine the background colour behind this element.", "runner": "htmlcs" },
    { "code": "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Abs", "type": "warning", "typeCode": 2, "selector": "html > body > main > table > tbody > tr > td:nth-child(3)", "context": "<td class=\"small\">2</td>", "message": "Unable to determine the background colour behind this element.", "runner": "htmlcs" },
    { "code": "WCAG2AA.Principle2.Guideline2_4.2_4_2.H25.2", "type": "notice", "typeCode": 3, "selector": "html > head > title", "context": "<title>Checkout - Northwind</title>", "message": "Check that the title describes the document.", "runner": "htmlcs" },
    { "code": "WCAG2AA.Principle3.Guideline3_2.3_2_2.H32.2", "type": "notice", "typeCode": 3, "selector": "html > body > main > form#order", "context": "<form id=\"order\">", "message": "Check that the form has a submit button.", "runner": "htmlcs" },
    { "code": "WCAG2AA.Principle1.Guideline1_3.1_3_1.H48", "type": "notice", "typeCode": 3, "selector": "html > body > footer > div", "context": "<div class=\"links\">", "message": "Check whether this content is a list.", "runner": "htmlcs" }
  ]
}

=============== FILE: reports/wave-checkout.json ===============
{
  "status": { "success": true, "httpstatuscode": 200 },
  "statistics": {
    "pageurl": "https://staging.northwind.example/checkout",
    "time": 3.41,
    "totalelements": 612,
    "errorcount": 3,
    "contrasterrorcount": 2,
    "alertcount": 16,
    "featurecount": 7,
    "structuralelementcount": 11,
    "ariacount": 9
  },
  "categories": {
    "error": {
      "description": "Errors",
      "count": 3,
      "items": {
        "label_missing": { "id": "label_missing", "description": "Missing form label", "count": 1, "selectors": ["#email"] },
        "alt_missing": { "id": "alt_missing", "description": "Missing alternative text", "count": 1, "selectors": ["main > img.hero"] },
        "link_empty": { "id": "link_empty", "description": "Empty link", "count": 1, "selectors": ["header nav > a.icon-cart"] }
      }
    },
    "contrast": {
      "description": "Contrast Errors",
      "count": 2,
      "items": {
        "contrast": { "id": "contrast", "description": "Very low contrast", "count": 2, "selectors": ["main > form#order > button.primary", "footer li:nth-child(1) > a.footer-link"] }
      }
    },
    "alert": {
      "description": "Alerts",
      "count": 16,
      "items": {
        "redundant_link": { "id": "redundant_link", "description": "Redundant link", "count": 9, "selectors": ["ul.summary a"] },
        "heading_skipped": { "id": "heading_skipped", "description": "Skipped heading level", "count": 4, "selectors": ["h4.line-title"] },
        "underline": { "id": "underline", "description": "Underlined text", "count": 3, "selectors": ["span.u"] }
      }
    },
    "feature": {
      "description": "Features",
      "count": 7,
      "items": {
        "alt_link": { "id": "alt_link", "description": "Linked image with alternative text", "count": 4, "selectors": ["a.brand img"] },
        "label": { "id": "label", "description": "Form label", "count": 3, "selectors": ["label[for=postcode]"] }
      }
    }
  }
}

=============== FILE: docs/board-slide-draft.md ===============
# Slide 14 - Accessibility

- **39 issues** found site-wide, up from 27 last quarter (+44%)
- **80% WCAG 2.2 AA conformant**
- Remediation sprint proposed for Q4

Speaker note: numbers produced by the nightly scan rollup, three independent
industry-standard scanners, same methodology as last quarter.
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 323kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 323kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 323kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall