Accessibility cleanup

From chromium/chromium · View interactive version

Accessibility cleanup is an AI agent skill from the GitHub repository chromium/chromium. Finds common violations of the Android accessibility API in the Clank App Java code and attempts to address them (e.g. hardcoded state change announcements, missing events, focus moving, assertive live regions, etc).

How to use this skill

Skill file

Code Health: Accessibility Cleanup

Identify and fix accessibility bugs in Android Java files where developers are

inadvertently violating the expected contract of the Android accessibility API.

Overview

The Android Accessibility API has many subtle rules that have changed over time.

Developers often write custom accessibility code based on the end user result

when testing with TalkBack, but don't actually honor the API contract which

would make the feature work with TalkBack and any other running assistive

technology. The goal of this work is to identify these common issues and anti-

patterns and proactively fix them in the code.

Goal: Identify common violations of the Android accessibility API and fix

them in Clank Java files.

Workflow

[!IMPORTANT] Execution Protocol: Execute all steps continuously in one

autonomous run, without skipping steps or pausing between files or steps. Stop

only at explicit ask_question gates or documented interactive stops. Use

rg (ripgrep) for searches.

Step 1: Workspace Preparation

Run the workspace preparation script:

python3 agents/projects/code-health/hub/scripts/prepare_workspace.py --stash

on a dirty or diverged tree.

Step 2: Discovery & Batch Selection

Follow the

Discovery & Batch Selection

workflow.

Step 3: Refactoring & Implementation

Process the candidates by handling them one file at a time, and applying

modifications inside each file one instance at a time (rather than

refactoring all files or instances at once). This ensures stability and allows

for precise verification. Process all files and instances sequentially within

the same run, without pausing for user confirmation between edits, then proceed

directly to Step 4.

  1. Apply Changes: Make the changes directly.

patterns.md, or using known best practices.

R.string.accessibility_expanded_group) are now unused. If they are,

remove them from the corresponding .grd / .grsp resource files.

Step 4: Formatting & Automated Review

  1. Format & Lint: Run

python3 agents/projects/code-health/hub/scripts/format_and_lint.py (must

exit 0).

  1. Automated Review: Follow

Automated Review, passing

review_rules.md as

<SKILL_SPECIFIC_CLEANUP_RULES>.

Step 5: Verification

Follow the Verification workflow.

Step 6: Bug Tracking

  1. Bug Discovery & Creation: Execute the bug tracking workflow in

bug_discovery.md using the <SourceFileName>

and <SourceFilePath> from the candidate.

or set <Bug ID> to "none" to skip. Do NOT proceed to Step 7 until

<Bug ID> is resolved.

Step 7: Submission

1. Prepare Commit Message

Ensure the full [Accessibility Cleanup] <Title> subject is at most 72

characters (omit .java or shorten the title, e.g.

Fix accessibility in <Component>, if needed), and generate ../commit. Do not

add [LSC] (this skill is not part of the LSC).

python3 agents/projects/code-health/hub/scripts/prepare_commit_message.py \
  --skill accessibility-cleanup \
  --title "Improve accessibility semantics in <Component>" \
  --bug "<Bug ID>" \
  --description - \
  --out-commit ../commit <<'EOF'
<Concise description explaining what changed, why, and how.>
EOF
2. Validate Commit File
python3 agents/projects/code-health/hub/scripts/prepare_commit_message.py \
  --skill accessibility-cleanup \
  --validate ../commit \
  --bug "<Bug ID>"

If validation fails, fix the commit title or description and re-run Steps 1–2

until validation exits 0.

3. Submit CL

Invoke the Submission workflow, passing:

class name of the candidate file)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.