Diagnoses Android ANRs and jank by triaging traces (ANR traces, bugreports, Perfetto) and reviewing code for main-thread blocking. Covers startup, I/O on main thread, DI graph cost, and SDK init.
Ships in android-performance. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Two tasks. Pick one before doing anything else.
| The user gives you | Task |
|---|---|
An ANR trace, anr_* file, bugreport, Vitals or Crashlytics cluster, Perfetto trace, "why did this freeze" | A. Triage |
| Source files, a diff or PR, "review this for performance", "is this safe on the main thread" | B. Review |
| Both (a trace and the code it points at) | A, then B on the files the trace names |
If it is unclear, ask one question: "Do you want me to diagnose a specific ANR, or review code?"
Read a reference file only when a step below sends you there. Each one has a table of contents.
Copy this checklist into your reply and tick it off as you go.
- [ ] 1. Classify the ANR type and timeout
- [ ] 2. Read the main thread state
- [ ] 3. Decide: app defect, app overload, or external
- [ ] 4. Match to a pattern
- [ ] 5. Confirm with a second signal
- [ ] 6. Fix and guard
Input dispatching timed out, Broadcast of Intent,
executing service, No response to onStartJob, Context.startForegroundService() did not then call Service.startForeground()). Note whether the process was cold started for this
event. See references/anr-mechanics.md."main" stack top-down: state (Runnable, Blocked, Native,
Waiting), the first app frame, any waiting to lock ... held by thread N. Follow lock
owners. See references/trace-reading.md.APP_DEFECT, APP_OVERLOAD (many small tasks, no single culprit), or EXTERNAL
(OEM freeze, system_server load, another process). Propose code fixes only for the first two.scripts/perfetto/ (scripts/perfetto/run_queries.sh <trace>) instead of reading them.Write the result with templates/anr-report.md.
| Top of main stack or trace shows | Likely pattern | Read |
|---|---|---|
SharedPreferencesImpl.awaitLoadedLocked, QueuedWork.waitToFinish, FileInputStream, SQLiteConnection, Gson.fromJson / JSONObject | Main-thread I/O or parsing | main-thread-io.md |
Dagger*Component.inject, *_Factory.get, DoubleCheck.get, Koin get/inject, Hilt_*Activity.onCreate | DI graph cost | di-graph-cost.md |
<clinit>, Class.forName, EnumEntries, a huge enum's values(), LocaleData, SimpleDateFormat.<init>, DecimalFormatSymbols, Constructor.newInstance under LayoutInflater.createView, Typeface.createFromAsset | First-touch cost | class-init-first-touch.md |
Broadcast of Intent, onReceive in the stack, push SDK frames, bindApplication during a receiver ANR | Receiver and process | receivers-and-processes.md |
Input ANR with many short tasks and no single culprit; inflate, onCreate/onResume back to back | No gap for input | startup-input-gaps.md |
| Frames from an SDK package; ANRs concentrated on low-RAM devices or one OEM | SDK or device | third-party-sdks-low-end.md |
BinderProxy.transact, waiting to lock, Object.wait, runBlocking, CountDownLatch.await | Threading and locks | threading-and-locks.md |
nSyncAndDrawFrame, Choreographer.doFrame, long RV OnBindView, Recomposer | Rendering | rendering-jank.md |
Copy this checklist and tick it off.
- [ ] 1. List candidates
- [ ] 2. Prove the executing thread
- [ ] 3. Prove it is slow or blocks
- [ ] 4. Grade with the checklist
- [ ] 5. Report findings and dismissed candidates
onReceive, onBindViewHolder and composable bodies are main; lifecycleScope and
viewModelScope default to Dispatchers.Main; after observeOn(mainThread()) is main.
When it depends on the caller, follow callers one or two hops and state the chain. If you
cannot establish the thread, dismiss it as "thread not established".StateFlow.value and seeded in-memory reads
return immediately. A one-off cost under a frame is not a finding. First-touch costs (class
init, ICU, reflection, Typeface) count only on the first call, so check whether this is the
first call on a startup or input path.Detect the stack from imports and build files, then load only the matching sample file.
| Area | Option 1 | Option 2 |
|---|---|---|
| UI | examples/views.md (XML, RecyclerView, custom Views) | examples/compose.md |
| DI | examples/dagger-hilt.md | examples/koin.md |
| Async | examples/coroutines-flow.md | examples/rxjava.md |
For deep Compose recomposition work, Google's jetpack-compose-performance skill goes further.
For recording traces, Google's android-profiler skill covers Perfetto configs. Recommend them
if the user has them; this skill does not depend on them.
runBlocking, Thread.sleep, or a main-thread lock as a fix: each one
makes main wait, which is the problem being fixed.get(), await inside
runBlocking, a latch). Check for the wait.checklists/review-checklist.md (opens in a new tab)evals/review-home-activity/case.yaml (opens in a new tab)evals/review-home-activity/files/HomeActivity.kt (opens in a new tab)evals/review-home-activity/graders/01-treats-this-as-a.md (opens in a new tab)evals/review-home-activity/graders/02-flags-runblocking-on-the.md (opens in a new tab)evals/review-home-activity/graders/03-flags-the-gson-parsing.md (opens in a new tab)evals/review-home-activity/graders/04-flags-runtime-parsing-of.md (opens in a new tab)evals/review-home-activity/graders/05-flags-decoding-the-stored.md (opens in a new tab)evals/review-home-activity/graders/06-flags-creating-simpledateformat-on.md (opens in a new tab)evals/review-home-activity/graders/07-flags-the-eagerly-injected.md (opens in a new tab)evals/review-home-activity/graders/08-does-not-report-the.md (opens in a new tab)evals/review-home-activity/place-files.sh (opens in a new tab)evals/review-home-activity/prompt.md (opens in a new tab)evals/routing-ambiguous-request/case.yaml (opens in a new tab)evals/routing-ambiguous-request/graders/01-asks-the-user-whether.md (opens in a new tab)evals/routing-ambiguous-request/graders/02-does-not-read-reference.md (opens in a new tab)evals/routing-ambiguous-request/prompt.md (opens in a new tab)evals/triage-idle-main-external/case.yaml (opens in a new tab)evals/triage-idle-main-external/files/anr_resume_trace.txt (opens in a new tab)evals/triage-idle-main-external/files/logcat_around_anr.txt (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/android-performance:android-performance-anr-and-jank-preventionfrom android-performance
npx claudepluginhub amolpardeshi99/android-performance-skills --plugin android-performance2 skills in this plugin
Other plugins' skills for the same job