Skip to content

ANR Audit and Fix

Audits Android code for ANR risks and diagnoses ANR stack dumps with evidence-based fixes

Repository
android/skills
Stars
10,278
Licence
Apache-2.0
Files
4 files

What it does

This skill teaches an AI agent to hunt for code that can freeze an Android app's main thread and cause an 'Application Not Responding' (ANR) error. When scanning source code, the agent lists suspicious blocking calls, checks which thread they run on and whether they really block, and reports only the confirmed risks, including off-main-thread changes to attached Views that can cause Sync Barrier Leak ANRs. When given an ANR stack dump (trace log), it systematically identifies the cause and, only if the cause is in the app itself, proposes a fix.

Great for

  • Android app developers preparing for a release who want a responsiveness review of their code
  • Engineers triaging ANR reports from Google Play Console or crash logs
  • Teams investigating main-thread stalls or Sync Barrier Leak issues

Skip it if

  • Non-ANR crashes or general bugs, since the skill explicitly excludes them and the agent may give off-target advice
  • Dropped frames, general CPU profiling, or Perfetto system traces, which the skill says to avoid; use dedicated profiling tools instead
  • Blindly applying suggested fixes without review, because the agent's diagnosis depends on the quality of the trace or code provided

Try asking

  • “Scan my Android Activity code for operations that could block the main thread and cause ANRs”
  • “Here is an ANR stack dump from our app; diagnose the root cause”
  • “Check whether my background thread updates to attached Views could cause a Sync Barrier Leak ANR”
  • “Give me a triage report on this ANR trace using the standard template”
Step-by-step guide: how to use ANR Audit and FixInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 4 original files, the Apache-2.0 licence and an attribution note.

    anr-audit-and-fix.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip anr-audit-and-fix.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip anr-audit-and-fix.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Provide the full ANR trace or relevant source files, not excerpts, so the agent can trace callers and prove which thread runs the code.
  • Ask for the dismissed candidates list as well, to see why suspicious calls were excluded.
  • Review proposed fixes yourself and test them; the skill restricts fixes to app-caused issues but does not guarantee correctness.

What's inside

  • references/anr_trace_report_template.md
  • references/risk_analysis_guide.md
  • references/trace_analysis_guide.md
  • SKILL.md

Redistributed unmodified from android/skills under the Apache-2.0 licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.