stabilizing-compose-types
Installation
SKILL.md
Stabilizing Compose Types — Three Tiers, In Order
Once a diagnosis (see ../diagnosing-compose-stability/SKILL.md) has named the unstable types, this skill walks Claude through fixing them. The strategy is a strict three-tier waterfall: (1) make the type truly stable by structural rewrite (val + immutable fields) — no annotation needed; (2) annotate with @Immutable or @Stable when the source is owned and the contract is honored; (3) use stabilityConfigurationFile for third-party or Java types. DO NOT invert this order — annotations are a contract, not a magic spell.
When to use this skill
- The compiler report (composables.txt / classes.txt) shows one or more
unstableparameters. - The developer asks how to stabilize a domain class, a
List<Foo>parameter,java.time.LocalDateTime, or a third-party type. - The developer mentions
@Immutable,@Stable,compose-stable-marker,compose-runtime-annotation,kotlinx.collections.immutable,stabilityConfigurationFiles, orstability_config.conf. - A
@TraceRecompositionlog shows recomposition happening because an argument is allocated fresh every recomposition.
When NOT to use this skill
- The unstable types are not yet identified — run
../diagnosing-compose-stability/SKILL.mdfirst. - The symptom is a wrong-phase state read (
Modifier.alpha(state.value)); use../../recomposition/deferring-state-reads/SKILL.md. - The symptom is a
derivedStateOfproblem; use../../recomposition/choosing-derivedstateof/SKILL.md. - A
Flow<T>parameter is the cause; the fix is to collect upstream — see../../side-effects/collecting-flows-safely/SKILL.mdrather than annotatingFlowas stable.