Agent Skills › mocasus/unprompted › unprompted-a11y

unprompted-a11y

GitHub

提供 WCAG 2.2 无障碍标准执行指南,涵盖对比度验证、键盘导航、焦点管理及表单语义化。内置工具辅助颜色检测,确保 UI 组件符合可访问性规范。

skills/unprompted-a11y/SKILL.md mocasus/unprompted

Trigger Scenarios

选择颜色或设计主题 构建表单、对话框或菜单 进行 UI 无障碍审计 审查前端代码的可访问性

Install

npx skills add mocasus/unprompted --skill unprompted-a11y -g -y
More Options

Use without installing

npx skills use mocasus/unprompted@unprompted-a11y

指定 Agent (Claude Code)

npx skills add mocasus/unprompted --skill unprompted-a11y -a claude-code -g -y

安装 repo 全部 skill

npx skills add mocasus/unprompted --all -g -y

预览 repo 内 skill

npx skills add mocasus/unprompted --list

SKILL.md

Frontmatter
{
    "name": "unprompted-a11y",
    "license": "MIT",
    "version": "4.0.0",
    "metadata": {
        "author": "mocasus",
        "category": "accessibility",
        "openclaw": {
            "emoji": "👁️",
            "requiredBins": [
                "node"
            ]
        },
        "repository": "https:\/\/github.com\/mocasus\/unprompted"
    },
    "description": "WCAG 2.2 contrast verification, keyboard navigation, focus-visible rings, semantic landmarks, form label\/error wiring, and human interaction affordances. Load whenever choosing colors, building forms, dialogs, menus, or auditing UI.",
    "compatibility": [
        "windows",
        "macos",
        "linux"
    ]
}

unprompted-a11y — Contrast, Keyboard & Human Affordances

Extends v4 A-01…A-12 and E-03…E-05. Accessibility is baseline engineering, never an optional post-launch pass.


1. Measured contrast floors (A-01, E-03)

Never eyeball contrast—especially on tinted paper neutrals, muted captions, or dark-mode secondary text. Verify pairs with the bundled zero-dependency calculator:

# Check a single foreground/background hex pair:
node <skills-dir>/unprompted-a11y/scripts/contrast-check.mjs --fg "#524e48" --bg "#f7f5f0"

# Scan a CSS token file for --fg-* against --bg-* custom properties:
node <skills-dir>/unprompted-a11y/scripts/contrast-check.mjs --css ./styles/tokens.css

Required thresholds (WCAG 2.2)

  • Normal text (< 24px, or < 18.66px bold): >= 4.5:1 (aim for >= 7:1 AAA on primary reading prose).
  • Large display text (>= 24px, or >= 18.66px bold): >= 3.0:1.
  • UI controls, input borders & functional icons: >= 3.0:1 against adjacent surface (unless an explicit high-contrast text label already defines the boundary).
  • Disabled controls: Exempt from 4.5:1, but must still remain legible enough that users can tell what is disabled.
  • Record the pairs: E-03 needs results for every changed foreground/background pair, including hover, focus, and disabled states. A passing palette is not proof for an untested state.

2. Keyboard, focus & landmarks (A-02, A-03, A-04)

  1. Native elements first: Use <button>, <a href>, <input>, <select>, <details>/<summary>, and <dialog> before reaching for div + role + tabIndex.
  2. Visible focus ring: Every interactive element must show a clear :focus-visible ring (2px solid var(--accent) with 2px–3px outline-offset, or a dual-ring box-shadow when sitting over varied backgrounds). Never write outline: none without an immediate high-contrast :focus-visible replacement.
  3. Focus trapping & restoration: Modal <dialog>s and drawers must keep Tab/Shift+Tab inside while open, close on Escape, and return focus to the triggering element on close.
  4. Logical tab order: DOM order must match visual reading order; never use positive tabindex="1+".
  5. Landmarks: One <main>, sensible <header>/<nav>/<footer> regions, exactly one <h1>, and no skipped heading levels. Prefer native landmarks over role patches.

3. Accessible names, forms & non-color states (A-05, A-06, A-07)

  • Names and roles (A-05): Every control and link has an accessible name. Use a link to navigate and a button to act; do not put a click handler on a div. Informative images need useful alt; decorative images use alt="" or aria-hidden="true". Icon-only buttons need aria-label.
  • Persistent visible labels (A-06): Every <input>, <textarea>, and <select> requires an associated <label for="...">. Placeholders vanish the instant typing starts and fail contrast rules.
  • Correct control selection:
    • Single choice among 2–5 visible options -> <fieldset> + <legend> + <input type="radio">.
    • Independent boolean opt-in ("Remember this device") -> <input type="checkbox"> (never a lone ungrouped radio button).
  • Programmatic error descriptions: Link inline validation text via aria-describedby and set aria-invalid="true" on invalid fields; never rely on turning a border red alone (A-07).
  • Distinguishable body links (A-07): Links inside prose paragraphs must retain an underline (text-decoration: underline; text-underline-offset: 3px) or another non-color affordance so color-vision-deficient readers can identify them immediately.
  • Conditional N/A: If a surface has no forms or no data tables, record A-06 or A-11 as N/A with proof of absence, not a silent skip.

4. Touch, preference, media & reflow (A-08, A-09, A-10, A-11, A-12)

  • Touch targets (A-08): Interactive controls need at least 44×44 CSS px of hit area and >= 16px input font size on mobile.
  • Reduced motion & contrast (A-09): Wrap non-essential motion and transparency in @media (prefers-reduced-motion: reduce); respect prefers-contrast where the surface depends on translucent layers. A reduced-motion path must not hide content.
  • Media alternatives (A-10): Video/audio needs captions or a transcript where the content carries information; prerecorded media needs an alternative. Record N/A when the surface has no time-based media.
  • Table semantics (A-11): Data tables use <caption>, <th scope="col|row">, and real headers. Do not fake a table with divs.
  • Zoom/reflow (A-12): At 200% zoom, content reflows without loss, clipping, or horizontal scroll. Test at 320px width and a 200% zoom equivalent.

5. Evidence to attach (E-03, E-04, E-05)

  • E-03: contrast results for every changed pair, including hover/focus/disabled states.
  • E-04: a tab-order list plus focus screenshots for each control group.
  • E-05: proof of no horizontal overflow at the narrowest supported width.

Version History

  • 5f9ec34 Current 2026-12-05 03:22

    版本升级至 v4.0.0,更新规则标识为 A-01…A-12 和 E-03…E-05,强化无障碍作为基础工程的要求。

  • 10cd954 2026-12-03 02:10

Same Skill Collection

skills/unprompted-code/SKILL.md
skills/unprompted-copywriting/SKILL.md
skills/unprompted-direction/SKILL.md
skills/unprompted-mobile/SKILL.md
skills/unprompted-ui/SKILL.md
skills/unprompted/SKILL.md

Metadata

Files
0
Version
5f9ec34
Hash
7cdb2818
Indexed
2026-12-03 02:10

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-12-05 05:43
浙ICP备14020137号-1