AGENT SKILL

semantic-html-audit

Audit components for non-semantic interactive HTML. Flags div/span used as buttons, missing type="button", and enforces native <button> for all clickable elements. Checks Chromium 70 CSS compatibility for button resets. Use after a change session as a quality gate.

License 许可
MIT
最近更新
2026-11-12
Stars
★ 0
Forks
0

01 前言 Front Matter

name
semantic-html-audit
tags
[ "react-dev", "quality", "html", "accessibility", "chromium" ]
type
skill
agents
[ "claude", "codex", "cursor", "gemini", "copilot" ]
author
Aliendreamer
version
0.1.0
description
Audit components for non-semantic interactive HTML. Flags div/span used as buttons, missing type="button", and enforces native <button> for all clickable elements. Checks Chromium 70 CSS compatibility for button resets. Use after a change session as a quality gate.
user-invocable
true
disable-model-invocation
false

03 SKILL.md 正文

Semantic HTML Audit

Audit components for semantic HTML violations — specifically non-interactive elements used as buttons — and ensure any button-reset CSS is compatible with Chromium 70 (the app's minimum target).

Input: File path, directory, or glob pattern. If omitted, infer from recent git changes (git diff --name-only HEAD).


The Rule

Every interactive element that can be clicked or activated via Enter/Space MUST be a native <button type="button">.

Using <div>, <span>, or any other non-interactive element with role="button" or onClick is banned.

Why native <button>?

  • Built-in keyboard activation (Enter and Space) — no onKeyDown needed
  • Correct implicit ARIA role (button) — no manual role="button" needed
  • Natively focusable — no extra tabIndex={0} needed (keep tabIndex={-1} only when Norigin manages focus)
  • Screen readers on Tizen/LG webOS announce it correctly without extra ARIA wiring

Chromium 70 HTML/CSS Compatibility

These constraints apply to all semantic HTML and button-reset CSS written for this project.

Safe to use (Chromium 70+)

Feature Notes
<button type="button"> Fully supported
<button type="submit"> For real form submissions only
role="switch" on <button> ARIA 1.1 — supported in Chrome 66+
aria-checked, aria-disabled, aria-label, aria-live Standard ARIA — all supported
-webkit-appearance: none Required prefix for Chromium 70
border: none / border: 0 Supported
background: transparent Supported
font: inherit Supported
:focus pseudo-class Supported — use instead of :focus-visible

NOT supported in Chromium 70 — flag as violation

Feature First supported Action
appearance: none (unprefixed) Chrome 84 Replace with -webkit-appearance: none or add -webkit-appearance: none before it
:focus-visible Chrome 86 Replace with :focus
<dialog> .requestClose() Chrome 122 Do not use — no polyfill; use state-driven show/hide
CSS gap on flexbox Chrome 84 Use margin between items instead
clamp(), min(), max() in CSS Chrome 79 Use fixed values or calc() instead
aspect-ratio property Chrome 88 Use padding-top % trick or fixed dimensions

The global button reset in src/app/globals.css already applies -webkit-appearance: none and appearance: none (both) to all <button> elements. Component CSS classes override as needed. Do NOT add per-element Tailwind reset classes unless a specific CSS class overrides the global reset.


Steps

  1. Resolve the target

    If no path provided, run:

    git diff --name-only HEAD
    

    Filter to .tsx, .ts, and .css files in src/components/, src/app/, and src/lib/.

  2. Scan for violations

    For each .tsx / .ts file, check for:

    A. Non-button elements with role="button"

    grep -n 'role="button"' <file>
    

    Flag any <div role="button">, <span role="button">, <li role="button">, etc.

    B. Non-button elements with onClick

    grep -n 'onClick' <file>
    

    For each hit, check if the element is a <button>, <a>, or other natively interactive element. Flag <div onClick>, <span onClick>, <li onClick>, etc.

    C. <button> without type="button"

    grep -n '<button' <file>
    

    Flag any <button> missing type="button" (or type="submit" where submit is intentional). Default type is submit — always be explicit.

    D. tabIndex={0} on converted elements

    After conversion from <div> to <button>, tabIndex={0} is redundant (button is natively focusable). Flag tabIndex={0} on <button> elements — remove it, or use tabIndex={-1} only if Norigin manages focus.

    For each .css file, also check for:

    E. appearance: none without -webkit-appearance: none (Chromium 70 violation)

    grep -n 'appearance: none' <file>
    

    Flag any occurrence of appearance: none that is NOT preceded by -webkit-appearance: none on the line immediately above. The unprefixed appearance property is not supported in Chromium 70 (added in Chrome 84).

    F. :focus-visible usage (Chromium 70 violation)

    grep -n ':focus-visible' <file>
    

    Flag any usage — replace with :focus.

  3. Report findings

    ## Semantic HTML Audit: <path>
    
    ### Summary
    Files checked: N
    Violations: N (X critical, Y warnings)
    
    ### Critical Violations (must fix)
    - [file:line] `<div role="button">` — replace with `<button type="button">`
    - [file:line] `<span onClick={...}>` — replace with `<button type="button">`
    - [file:line] `appearance: none` without `-webkit-appearance: none` — add prefixed version above it
    
    ### Warnings
    - [file:line] `<button>` missing `type="button"` — add explicit type
    
    ### Clean
    - No violations found in: <files>
    
  4. Offer to fix

    After the report, if there are violations:

    "Want me to fix the violations?"

    If yes: apply the fixes per the patterns below.


Fix Patterns

JSX: <div role="button"> → <button type="button">

// BEFORE (violation)
<div
  ref={ref}
  role="button"
  tabIndex={-1}
  onClick={handleClick}
  className="my-class"
>
  Content
</div>

// AFTER (correct)
// No extra reset classes needed — global button reset in globals.css covers all defaults.
<button
  type="button"
  ref={ref}
  tabIndex={-1}
  onClick={handleClick}
  className="my-class"
>
  Content
</button>

JSX: <div role="switch"> → <button type="button" role="switch">

// BEFORE (violation)
<div
  ref={ref}
  role="switch"
  aria-checked={isOn}
  tabIndex={-1}
  onClick={handleToggle}
  className="my-toggle"
>
  ...
</div>

// AFTER (correct)
// role="switch" is kept — it is NOT implicit on <button>. aria-checked is required.
<button
  type="button"
  ref={ref}
  role="switch"
  aria-checked={isOn}
  tabIndex={-1}
  onClick={handleToggle}
  className="my-toggle"
>
  ...
</button>

CSS: appearance: none without prefix

/* BEFORE (violation — Chromium 70 ignores unprefixed appearance) */
.my-button {
  appearance: none;
}

/* AFTER (correct — both lines required for Chromium 70 + modern browsers) */
.my-button {
  -webkit-appearance: none;
  appearance: none;
}

Key rules for fixes:

  • Always add type="button" on <button> (default is type="submit" — always be explicit)
  • Remove role="button" (it is implicit on <button>)
  • Keep role="switch" — it is NOT implicit; pair with aria-checked
  • Keep tabIndex={-1} if Norigin spatial nav manages focus for this element
  • Remove tabIndex={0} — redundant on native <button> (natively focusable)
  • Do NOT add Tailwind reset classes to <button> — the global reset in globals.css already handles border, background, padding, font, -webkit-appearance

Guardrails

  • Do NOT change focus management logic, Norigin wiring, or onPointerEnter/focusSelf calls
  • Do NOT change styling beyond what is listed in the fix patterns
  • Do NOT add type="submit" — all action buttons use type="button" unless they are inside an actual <form> and intentionally submit it
  • Flag <a href="#"> used as button — these should also become <button type="button">
  • Do NOT auto-fix <a> elements with real href — those are legitimate links
  • Do NOT use :focus-visible — use :focus instead (Chromium 70 constraint)

04 同仓库更多 Skills

Aliendreamer
Aliendreamer/ai.skills

setup-git-credentials

Use when the user wants Git to stop using a PAT in the remote URL or a plain-text credential store, wants Git Credential Manager (GCM) with OAuth for GitHub, GitLab or Azure DevOps on Ubuntu/Debian or WSL2, or sees 'cannot persist Microsoft authentication token cache securely' / 'using plain-text fallback token cache'. Asks whether this is WSL, which Git hosts and which parts to set up, checks what is already done, sets git config itself after confirmation and hands every sudo or interactive step (apt, gpg, pass init, secret-tool, first sign-in) to the user. Bundles gcm-keyring-session.sh to start or reuse a D-Bus + GNOME Keyring session without systemd. Trigger terms - git credentials, PAT in URL, token in remote, git credential manager, gcm, github auth, gitlab auth, azure devops auth, pass, gpg store, secret service, gnome keyring, msal token cache, wsl git auth.

★ 0
Aliendreamer
Aliendreamer/ai.skills

setup-flow

Use when onboarding a repository or agent to the standard development workflow — installs the required skills from the ai.skills store, installs or updates a MANDATORY workflow block in the agent's instruction file (CLAUDE.md, AGENTS.md, GEMINI.md, Copilot or Cursor rules), AND configures .claude/settings.json with Serena MCP, sandbox, permissions, hooks, and plugins. Hooks are wired to the context-hooks kit, which speaks once per session instead of injecting text on every turn; re-running replaces earlier inline hooks rather than adding to them. Also writes .vscode/settings.json to hide the empty shell dotfiles an agent sandbox leaves in the repo root. Use when setting up a new repo, switching agents, or refreshing the workflow rules.

★ 0
Aliendreamer
Aliendreamer/ai.skills

developer-flow

Use when starting, implementing, or completing any feature, change, or fix in any software project — at feature start, before writing code, and before claiming a change is done, fixed, working, or green. A strict ordered flow with a gate per phase; stack-agnostic and repo-agnostic (OpenSpec optional, gates discovered).

★ 0
Aliendreamer
Aliendreamer/ai.skills

daily-log-check

Use to check whether everyone on duty filed their Azure DevOps time-log Tasks for a given day, per platform — reports tickets, hours and activities per person against the headcount you give. Fires on "did everyone log yesterday", "check web 4 mobile 3", "who is missing for 8.09", "daily log check". Read-only. Org and project come from configuration.

★ 0
Aliendreamer
Aliendreamer/ai.skills

daily-activity-log

Use at end of day to file the Azure DevOps time-log Tasks — one closed Task per Activity worked that day, Original Estimate in decimal hours, parented to the current sprint's Feature. Fires on "log my day", "fill my tasks", "close my daily tasks", "I had 2h meetings and 4h development". Org and project come from configuration.

★ 0
Aliendreamer
Aliendreamer/ai.skills

conventional-commits

Write commit messages that follow the Conventional Commits specification so tooling can derive versions and changelogs.

★ 0