Agent Skills › mocasus/unprompted › unprompted-a11y

unprompted-a11y

GitHub

提供WCAG 2.2无障碍标准验证技能,涵盖对比度计算、键盘导航、焦点管理及表单语义化。用于UI开发中确保颜色、交互和内容的可访问性合规。

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

触发场景

选择颜色或构建表单 审核UI组件 检查对比度合规性

安装

npx skills add mocasus/unprompted --skill unprompted-a11y -g -y
更多选项

不安装直接使用

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": "3.2.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 core rules U-09, U-10, U-21–U-24, and U-32. Accessibility is baseline engineering, never an optional post-launch pass.


1. Measured Contrast Floors (U-09)

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 (~2.2:1+) that users can tell what is disabled and why.

2. Keyboard & Focus Architecture (U-10)

  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+".

3. Forms, Labels & Error Wiring (U-22, U-23)

  • Persistent Visible Labels (U-22): 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 (color-only failure).
  • Distinguishable Body Links (U-23): Links inside prose paragraphs must retain an underline (text-decoration: underline; text-underline-offset: 3px) so color-vision-deficient readers can identify them immediately.

版本历史

  • 10cd954 当前 2026-12-03 02:10

同 Skill 集合

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

元信息

文件数
0
版本
10cd954
Hash
060cffb4
收录时间
2026-12-03 02:10

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-12-03 05:45
浙ICP备14020137号-1