r8-proguard-optimization
Skill2 starsChanged 5 months agoMITView on GitHub
Use for Android release shrinking, R8 and ProGuard keep rules, minify release failures, resource shrinking and Crashlytics mapping uploads.
In this repository38 other files it gives its agents.
- AGENTS.mdAGENTS.md
- super-android-kotlin-firebaseSkill
- accessibilitySkill
- agp9-kotlin-migrationSkill
- android-architectureSkill
- android-coreSkill
- android-navigation-3Skill
- code-review-refactorSkill
- compose-contextual-design-systemSkill
- compose-performanceSkill
- context-aware-ui-designSkill
- debuggingSkill
- dependency-injectionSkill
- dependency-upgrade-safetySkill
- design-test-gateSkill
- edge-to-edge-adaptive-uiSkill
- firebase-ai-logicSkill
- firebase-authSkill
- firebase-cloud-functionsSkill
- firebase-coreSkill
- firebase-crashlytics-analyticsSkill
- firebase-emulator-ciSkill
- firebase-messagingSkill
- firestore-costs-quotasSkill
- firestoreSkill
- gradle-buildSkill
- jetpack-composeSkill
- kotlin-coreSkill
- macrobenchmark-baseline-profilesSkill
- networking-retrofit-ktorSkill
- play-store-releaseSkill
- room-datastoreSkill
- screen-ux-auditSkill
- security-privacySkill
- testingSkill
- ui-state-designSkill
- workmanager-background-syncSkill
- xml-to-compose-migrationSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 9 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 28
Read R8 error output and mapping context.
- Distinctive: line 29
Add the narrowest keep rule possible.
- Distinctive: line 30
Verify release tests or smoke tests.
- Distinctive: line 31
Document mapping file handling for Crashlytics.
- Distinctive: line 35
Do not disable R8 as a permanent fix.
- Very specific: line 36
Do not add -keep class { *.
- Distinctive: line 37
Prefer library-documented rules and narrow app rules.
- Distinctive: line 52
Do not assume these companion skills are installed.
- Distinctive: line 90
Use $super-android-kotlin-firebase to fix this release-only R8 crash.
- Distinctive: line 91
Use $super-android-kotlin-firebase to review my ProGuard rules before release.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Purpose
Fix release-only failures and optimize shrinking without disabling R8 or adding broad unsafe keep rules.
When to use
- App fails only in release builds.
minifyEnabledorshrinkResourcescauses crashes.- Retrofit, serialization, Hilt, Room or Firebase needs targeted keep rules.
- Crashlytics mapping upload must be configured.
Inputs to inspect
app/build.gradle.ktsrelease build typeproguard-rules.proandconsumer-rules.pro- Reflection, serialization and Retrofit converters
- Room entities and Hilt modules
- Firebase and Crashlytics Gradle setup
Required workflow
- Reproduce using release or minified build.
- Read R8 error output and mapping context.
- Add the narrowest keep rule possible.
- Verify release tests or smoke tests.
- Document mapping file handling for Crashlytics.
Rules
- Do not disable R8 as a permanent fix.
- Do not add
-keep class ** { *; }except as a temporary diagnostic. - Prefer library-documented rules and narrow app rules.
- Validate release behavior, not only debug.
- Preserve obfuscation unless debugging requires a temporary change.
Related existing skills
Local skills to invoke
- gradle-build
- play-store-release
- debugging
- firebase-crashlytics-analytics
External companion skills to use when installed
Do not assume these companion skills are installed. Prefer the local skills above first, then consult Companion Skills for install and verification commands.
- android/skills — use for official Android workflow alignment around edge-to-edge, adaptive UI, Navigation 3, R8, AGP or testing setup.
Files commonly touched
app/build.gradle.ktsproguard-rules.proconsumer-rules.procrashlyticsGradle config- Serialization models
- Network and DI setup
Commands to validate
./gradlew assembleRelease
./gradlew app:minifyReleaseWithR8
./gradlew testReleaseUnitTestCommon mistakes to avoid
- Testing only debug after changing R8 rules.
- Adding global keep rules that erase shrinking benefits.
- Forgetting mapping upload for crash reports.
- Ignoring consumer rules in library modules.
Checklist
- Release failure reproduced.
- Specific rule added.
- Release build validated.
- Mapping behavior documented.
- Residual obfuscation risk mentioned.
Example prompts
- Use $super-android-kotlin-firebase to fix this release-only R8 crash.
- Use $super-android-kotlin-firebase to review my ProGuard rules before release.
Expected response style
Respond with: brief diagnosis, change plan, affected files, code or diff summary, validation commands, tests added or recommended, risks, and next step. For review tasks, lead with findings ordered by severity.
References
- ../../docs/audits/FUENTES_LOCALES.md
- references/r8-release-checklist.md
- references/common-keep-rules.md
- references/firebase-r8-notes.md
- references/reflection-serialization-rules.md
- templates/proguard-rules-template.pro
- templates/release-buildtype-template.md
- templates/crashlytics-mapping-upload-template.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

