---
name: android-review
description: Review an Android change in five stages (impact/RCA, simplify, repo patterns, ANR/perf, and optional on-device measurement), then apply only the fixes the user approves. Runs only when invoked.
disable-model-invocation: true
argument-hint: "[\"problem statement\"] [diff range]"
---

# android-review — five-stage review of a change

> From Shubham Singh Bisht's Android helpers — https://shubhamsinghbisht.com/android-roadmap/#helpers

Stages are independent skills. Run each by **reading its SKILL.md and following
it**; pass the same range and problem statement to each. A stage file read
this way still says `$ARGUMENTS`: read that as the range (and, for stage 1,
the problem statement) resolved in step 1, never as empty. For stage 5 it
means the concerns chosen in step 4.

The stage skills are sibling folders of this one: with `<skills>` = the parent
of this skill's base directory (the "Base directory for this skill" shown when
it loads), the files are:

| # | Skill | File |
|---|---|---|
| 1 | android-impact | `<skills>/android-impact/SKILL.md` |
| 2 | android-simplify | `<skills>/android-simplify/SKILL.md` |
| 3 | android-patterns | `<skills>/android-patterns/SKILL.md` |
| 4 | android-anr-perf | `<skills>/android-anr-perf/SKILL.md` |
| 5 | android-perf-cli | `<skills>/android-perf-cli/SKILL.md` |

Paths inside a stage file (`scripts/…`, `references/…`) are relative to that
stage's own folder.

## Steps

1. **Range.** From `$ARGUMENTS`, else the nearest base to the working tree,
   including untracked files:
   `<skills>/android-anr-perf/scripts/scan_diff.sh --base` prints it
   (main/master/develop or the `release-*` branch this branch is fewest commits
   ahead of). Print the
   base, the branch it came from, and the files in the range; if that is more
   than 60 files, ask whether the base is right before reviewing. If it has no `.kt`/`.java` changes, say so and
   report every stage as `nothing found`.
2. **Stage 1.** If its verdict line contains `unverified` or `symptom-patch`,
   print the stage 1 report and **stop**:
   "Stopping after stage 1: <reason>. Say *continue* to run stages 2–4 anyway."
3. **Stages 2, 3, 4** in order. Collect each report unchanged.
4. **Stage 5 gate.** If stage 4 ends `perf-sensitive: yes`, list the stage 5
   recipes it would run and ask. Run stage 5 only on a yes.
5. **Merged report**, grouped by stage, with every finding's rule ID.
6. **Apply.** Ask which rule IDs to apply ("all", "all except ANR-2", "IMP-5,
   SIMP-3"). Edit only those. If a fix adds or changes a user-facing string,
   update it in every locale's `strings.xml`, not only the default one.
7. **Verify.** Find the application module (the one applying
   `com.android.application`; modules are listed in `settings.gradle(.kts)`)
   and run its `compileDebugKotlin` task, e.g. `./gradlew :app:compileDebugKotlin`.
   Compile only, never assemble/install/connected (Android Studio may be
   building this tree). Report the result; on failure show the first error.
8. **Stop.** Do not commit; the user commits.
