configuring-r8-for-compose
Installation
SKILL.md
Configuring R8 for Compose — Trust Consumer Rules, Avoid Blanket Keeps
R8 is the only supported shrinker — ProGuard is deprecated. Compose ships consumer ProGuard rules,
so most apps need no Compose-specific keep rules. The big modern wins come from R8 full mode (
default since AGP 8.0): lambda grouping, sourceInformation() stripping, constant-folding of
composable args, and ComposerImpl devirtualization. This skill teaches Claude to set R8 up
minimally and refuse over-broad keeps that defeat those wins.
When to use this skill
- Setting up a new Compose app's release variant for the first time.
- A PR adds
-keep class androidx.compose.** { *; }or any other Compose-wide keep — push back and apply this skill. - A release build crashes after enabling minification — the cause is almost always a missing keep on a reflective consumer, not on Compose itself.
- APK size review surfaces a large
classes.dexand the developer wants to know why. - The first time
isMinifyEnabled = trueis being flipped on, before any release benchmark is run. - Cross-link from
../../measurement/testing-compose-in-release-mode/SKILL.mdwhenever release measurement is being set up.