$npx -y skills add skydoves/compose-performance-skills --skill diagnosing-compose-stabilityUse this skill to diagnose Jetpack Compose stability problems by enabling and reading the Compose Compiler Reports (classes.txt, composables.txt, composables.csv, module.json). Covers the Gradle DSL, the release-only build requirement, and how to interpret per-class and per-compo
| 1 | # Diagnosing Compose Stability — Read the Compiler Reports First |
| 2 | |
| 3 | Compose skips recomposition by comparing parameters. When a parameter is unstable, skipping is disabled — this skill tells Claude how to find out which parameters are unstable and why. The output is a prioritized list of unstable types and non-skippable composables; the fix lives in `../stabilizing-compose-types/SKILL.md`. |
| 4 | |
| 5 | ## When to use this skill |
| 6 | |
| 7 | - The developer asks "why does this recompose?", reports jank, dropped frames, or scroll stutter. |
| 8 | - A `@TraceRecomposition` log shows recomposition counts that exceed the number of meaningful state changes. |
| 9 | - The developer mentions Compose Compiler Reports, `classes.txt`, `composables.txt`, `composables.csv`, `module.json`, or "non-skippable". |
| 10 | - The developer asks how to find unstable parameters, or whether `List<Foo>`, `LocalDateTime`, or a domain type is stable. |
| 11 | - A reviewer asks for evidence that a perf-sensitive composable is skippable. |
| 12 | |
| 13 | ## When NOT to use this skill |
| 14 | |
| 15 | - The unstable types are already known — jump straight to `../stabilizing-compose-types/SKILL.md`. |
| 16 | - The symptom is a wrong-phase state read (`Modifier.alpha(state.value)`); use `../../recomposition/deferring-state-reads/SKILL.md`. |
| 17 | - The symptom is a `derivedStateOf` misuse; use `../../recomposition/choosing-derivedstateof/SKILL.md`. |
| 18 | - The developer wants CI gating instead of one-shot diagnosis; use `../enforcing-stability-in-ci/SKILL.md`. |
| 19 | |
| 20 | ## Prerequisites |
| 21 | |
| 22 | - Kotlin **2.0.0+** with the Compose Compiler Gradle plugin applied: `id("org.jetbrains.kotlin.plugin.compose")`. The pre-2.0 `kotlinCompilerExtensionVersion` flow is obsolete. |
| 23 | - A buildable **release** variant of the target module. Reports MUST be produced in release; debug adds Live Literals which makes constants look dynamic and skews every report. |
| 24 | - Apply the `org.jetbrains.kotlin.plugin.compose` Gradle plugin (Kotlin 2.0+). The `composeCompiler { … }` extension is owned by that plugin; AGP version is incidental. |
| 25 | - Optional but **PREFERRED:** the developer has a stability baseline goal, not a 100-percent-skippable goal (skydoves hot take #1 — skippability is a diagnostic, not a KPI). |
| 26 | |
| 27 | ## Workflow |
| 28 | |
| 29 | - [ ] **1. Enable the reports in the module's `build.gradle.kts`.** Scope to release only — debug builds emit misleading data. |
| 30 | |
| 31 | ```kotlin |
| 32 | // app/build.gradle.kts (or any compose module) |
| 33 | plugins { |
| 34 | id("com.android.application") |
| 35 | id("org.jetbrains.kotlin.android") |
| 36 | id("org.jetbrains.kotlin.plugin.compose") |
| 37 | } |
| 38 | |
| 39 | composeCompiler { |
| 40 | // Only emit reports for release to avoid Live Literals noise. |
| 41 | val isReleaseBuild = providers.gradleProperty("composeCompilerReports").orNull == "true" |
| 42 | if (isReleaseBuild) { |
| 43 | reportsDestination = layout.buildDirectory.dir("compose_compiler") |
| 44 | metricsDestination = layout.buildDirectory.dir("compose_compiler") |
| 45 | } |
| 46 | } |
| 47 | ``` |
| 48 | |
| 49 | Or the always-on form: |
| 50 | |
| 51 | ```kotlin |
| 52 | composeCompiler { |
| 53 | reportsDestination = layout.buildDirectory.dir("compose_compiler") |
| 54 | metricsDestination = layout.buildDirectory.dir("compose_compiler") |
| 55 | // Optional — opt mutable third-party types into stability: |
| 56 | stabilityConfigurationFiles.add( |
| 57 | rootProject.layout.projectDirectory.file("stability_config.conf") |
| 58 | ) |
| 59 | } |
| 60 | ``` |
| 61 | |
| 62 | - [ ] **2. Build the release variant** so Live Literals and interpreted-mode noise are absent: |
| 63 | |
| 64 | ```bash |
| 65 | ./gradlew :app:assembleRelease -PcomposeCompilerReports=true |
| 66 | ``` |
| 67 | |
| 68 | For a library module: `./gradlew :feature-feed:assembleRelease`. The release flavor is required — see RIGHT/WRONG below. |
| 69 | |
| 70 | - [ ] **3. Locate the four output files.** They are written to `<module>/build/compose_compiler/`: |
| 71 | |
| 72 | ``` |
| 73 | app/build/compose_compiler/ |
| 74 | ├── app_release-classes.txt # per-class stability |
| 75 | ├── app_release-composables.txt # per-composable signatures |
| 76 | ├── app_release-composables.csv # CSV mirror of the above (CI-friendly) |
| 77 | └── app_release-module.json # aggregate count |