
R8 Keep Rule Analyzer
Finds redundant and overly broad R8 keep rules in an Android app and scores their size impact
- Repository
- android/skills
- Stars
- 10,278
- Licence
- Apache-2.0
- Files
- 9 files
What it does
When installed, the agent inspects an Android project's Gradle build files and R8 keep rules, which tell the R8 code shrinker what not to remove or rename. It runs Google's R8 tooling to measure how many classes, fields and methods each rule protects, then writes a Markdown report flagging redundant rules, overly broad package-wide rules, and rules already covered by library consumer rules. The goal is a smaller, easier-to-maintain app build.
Great for
- Android developers trying to reduce APK or app bundle size by trimming shrinking configuration
- Teams with long, inherited ProGuard or R8 rule files that nobody fully understands
- Developers troubleshooting why R8 keeps too much code
Skip it if
- General Gradle build errors, since the skill explicitly excludes them and would not help diagnose them
- Jetpack Compose UI or runtime CPU performance problems, which are out of scope
- Projects where a bad rule change could break release builds without a careful test pass, because the skill only recommends changes and a human must verify them
Try asking
- “Analyze my app's R8 keep rules and tell me which ones are redundant or too broad”
- “Check whether my release build still has keep rules that library consumer rules already cover”
- “Why is my release APK so large? Review my ProGuard configuration”
- “Upgrade my build to the R8 config analyzer and report the rule impact scores”
Install in 3 steps
- 1
Download the skill
The ZIP contains the 9 original files, the Apache-2.0 licence and an attribution note.
r8-analyzer.zip - 2
Add it to your agent
Claude Code (all projects)
mkdir -p ~/.claude/skills && unzip r8-analyzer.zip -d ~/.claude/skills/Claude Code / Agent SDK (this project only)
mkdir -p .claude/skills && unzip r8-analyzer.zip -d .claude/skills/Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.
- 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
- Run it from the Android project root so the generated tmp/ output and Gradle commands resolve correctly.
- Expect the agent to run Gradle and Python scripts; review the commands before approving them, and keep version control clean so any temporary settings.gradle change is easy to spot.
- Treat the scores as guidance and verify any suggested rule removal with a release build and a runtime test before shipping.
What's inside
- references/android/topic/performance/app-optimization/enable-app-optimization.md
- references/CONFIGURATION.md
- references/FULL_BUILD_CONFIG_ANALYZER.md
- references/INSPECT-RULES.md
- references/REPORT_FORMAT.md
- scripts/analyze.py
- scripts/convert_pb_to_json.py
- scripts/keep_radius_pb2.py
- 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.