Skip to content

Guide · Agent skill

How to use the ANR Audit and Fix agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The anr-audit-and-fix skill is a set of instructions and reference files that teaches an AI agent to look for code that can freeze an Android app's main thread, which leads to an 'Application Not Responding' (ANR) error. It also teaches the agent to read ANR stack dumps (trace logs) and work out the cause. This guide is for Android developers and engineers who have not used agent skills before, and it explains how to install the skill, trigger it and check its output. By the end you will be able to run an ANR review on your code or on a trace file.

ANR Audit and Fixandroid/skills · Apache-2.0

Quick start

  1. 1Download the ZIP. Download the skill ZIP from the page where you found this guide.
  2. 2Unzip the skill. Unzip it into ~/.claude/skills/ for all projects, or into your project's .claude/skills/ folder for one project.
  3. 3Or upload it in the Claude apps. In the Claude apps, go to Settings → Capabilities → Skills and upload the ZIP.
  4. 4Gather your input. Collect the Android source files you want audited, or the ANR stack dump files you want triaged.
  5. 5Make a natural request. Describe the task in plain language, such as scanning code for ANR risks or triaging a stack dump.
  6. 6Review the report. Check the confirmed findings and the list of dismissed candidates, and confirm the evidence for each.
  7. 7Verify before applying fixes. Review any proposed fix yourself before changing your app.

What are agent skills?

An agent skill is a folder containing a SKILL.md file and optional reference files. The SKILL.md file tells an AI agent when to use the skill and how to carry out a task. The agent reads these instructions when your request matches the skill's description, and it reads the referenced files as it works.

This skill has a SKILL.md file and three reference files: references/risk_analysis_guide.md, references/trace_analysis_guide.md and references/anr_trace_report_template.md.

What the skill makes the agent do

The skill has two paths. Path A is a static codebase audit. The agent lists candidate code that blocks, such as blocking primitives and locks, synchronous I/O or heavy compute, and synchronous IPC. It then checks which thread the code runs on, confirms that the call really blocks, and reports only the confirmed risks. Dismissed candidates are listed separately with a one-line reason.

Path A also covers off-main-thread changes to attached Views. These are treated as Sync Barrier Leak ANR risks, not only as crashes such as CalledFromWrongThreadException, and the agent must prove both off-main execution and an attached View.

Path B handles ANR stack dumps. The agent works through the trace systematically, checks that the dumped process matches the ANR subject, and classifies the cause as APP_DEFECT, APP_RESOURCE_OVERLOAD or EXTERNAL_BOTTLENECK. It proposes an application fix only for APP_DEFECT or APP_RESOURCE_OVERLOAD. For EXTERNAL_BOTTLENECK it does not propose an app fix.

Install the skill

Download the skill ZIP from the page where you found this guide. Then choose one of the options below.

For Claude Code, unzip the file into ~/.claude/skills/ to make it available in all your projects. To limit it to one project, unzip it into that project's .claude/skills/ folder.

In the Claude apps, upload the ZIP under Settings → Capabilities → Skills.

  • Personal: unzip into ~/.claude/skills/
  • Single project: unzip into your project's .claude/skills/
  • Claude apps: Settings → Capabilities → Skills, then upload the ZIP

Check what you need before you start

The skill needs two things. You must supply Android source code or ANR stack dump files for the agent to analyze. Your agent runtime must also be able to read the skill's reference files, because the instructions point to them.

  • Android source code or ANR stack dump files
  • An agent runtime that can read the skill's reference files

Trigger the skill with a natural request

You do not need a special command. Describe the task in plain language that matches the skill's purpose. The skill's description says to use it when scanning Android code for ANR risks or triaging ANR stack dumps.

For a code audit, point the agent at the files or folder to review and say what you want, for example: scan this Android module for ANR risks. For a trace, attach or point to the stack dump and say what you want, for example: triage this ANR stack dump and tell me the cause.

  • Scan this ViewModel for ANR risks on the main thread.
  • Check these Activity files for off-main-thread changes to attached Views that could cause Sync Barrier Leak ANRs.
  • Triage this ANR trace and tell me whether the app or the system is at fault.
  • Diagnose the ANR in this stack dump from my Play Console report.

Safety notes: scripts and network

According to the skill's description, it does not run scripts and does not use the network. It works from the code and trace files you give it and from its own reference files.

The skill is licensed under Apache-2.0. Its SKILL.md metadata lists Google LLC as the author and points to LICENSE.txt for the full terms.

  • Runs scripts: no
  • Uses network: no

Tips for better results

The quality of the diagnosis depends on the input. A complete trace with a clear process header and the thread states gives better results than a fragment. Code that includes the callers of a suspicious function helps the agent prove which thread it runs on.

Review every suggested fix before you apply it. The skill is not for non-ANR crashes, dropped frames, general CPU profiling or Perfetto system traces, so use dedicated profiling tools for those.

  • Give the full stack dump, not an excerpt, when you can.
  • Include caller code so the agent can confirm the thread.
  • Review every suggested fix before applying it.
  • Use dedicated profiling tools for frames, CPU profiling or Perfetto traces.

What people use it for

  • Reviewing a ViewModel or Activity for blocking calls on the main thread before a release.
  • Checking code for off-main-thread changes to attached Views that could cause Sync Barrier Leak ANRs.
  • Triaging an ANR stack dump from a Google Play Console report to see whether the app or the system is the cause.
  • Checking whether a dumped process matches the ANR subject before trusting the diagnosis.

Frequently asked questions

Is the ANR Audit and Fix skill free to use?

The skill is licensed under Apache-2.0, and its SKILL.md metadata lists Google LLC as the author. The license file is named LICENSE.txt in the skill's metadata, so check it for the full terms.

What do I need to run the anr-audit-and-fix skill?

You need Android source code or ANR stack dump files to analyze, and an agent runtime that can read the skill's reference files. The skill does not run scripts and does not use the network.

How do I install the ANR Audit and Fix skill in Claude?

Download the ZIP and unzip it into ~/.claude/skills/ for personal use or into a project's .claude/skills/ folder. In the Claude apps, you can instead upload the ZIP under Settings → Capabilities → Skills.

Does this skill find all crashes in my app?

No. The skill is for ANR risks and ANR stack dumps only. It explicitly excludes non-ANR crashes, dropped frames, general CPU profiling and Perfetto system traces, so use dedicated tools for those.

Will the agent fix my code automatically?

The skill proposes application fixes only for APP_DEFECT or APP_RESOURCE_OVERLOAD causes, and it never proposes an app fix for EXTERNAL_BOTTLENECK. The guidance is to review every suggested fix before applying it, because the diagnosis depends on the quality of the trace or code you provide.

What is a Sync Barrier Leak ANR?

The skill treats off-main-thread changes to attached Views as possible Sync Barrier Leak ANR risks. The agent must prove both that the change runs off the main thread and that the View is attached.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use this skill if you are an Android developer preparing a release who wants a responsiveness review of your code, or an engineer triaging ANR reports and stack dumps. Pick a different tool if your problem is a non-ANR crash, dropped frames, general CPU profiling or Perfetto traces, since the skill excludes these and dedicated profilers will serve you better.

Download the skill