stabilizing-compose-types

Fixes unstable Jetpack Compose types using structural rewrites, stability annotations, and compiler configuration files.

1|Updated Jul 6, 2026
One-click install
npx skills add https://github.com/citytexi/team-yg-pesonal-agent --skill stabilizing-compose-types-citytexi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: stabilizing-compose-types
Source: https://github.com/citytexi/team-yg-pesonal-agent/tree/main/.claude/skills/stabilizing-compose-types
Command: npx skills add https://github.com/citytexi/team-yg-pesonal-agent --skill stabilizing-compose-types-citytexi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Jetpack Compose compiler reports flag parameters as unstable, causing unnecessary recompositions and degraded UI performance. This Skill provides a strict three-tier strategy to fix those unstable types once a diagnosis has identified them, so composables become skippable again. ## Core Features & Use Cases - Three-tier fix waterfall: Restructure types to be truly stable (val plus immutable fields), annotate owned source with @Immutable or @Stable, or whitelist third-party and Java types via stabilityConfigurationFiles. - Collection and Flow handling: Replace List/Set/Map parameters with kotlinx.collections.immutable types, and hoist Flow parameters upstream with collectAsStateWithLifecycle instead of annotating them. - Compiler-level guidance: Explains the difference between @Immutable and @Stable (static expression promotion), the stability_config.conf grammar, and verification via composables.txt and classes.txt reports. - Use Case: A developer sees unstable parameters for a User class, a List<Item> parameter, and java.time.LocalDateTime in the compiler report, and needs the correct fix for each without breaking the stability contract. ## Quick Start Ask the assistant to stabilize the unstable types reported in your Compose compiler output, such as a data class with var fields, a List parameter, or a java.time.LocalDateTime property.

Frequently Asked Questions about stabilizing-compose-types

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix unstable parameters in Jetpack Compose?▼

Follow a three-tier order: first restructure the type so every property is a val of an already-stable type, then annotate owned source with @Immutable or @Stable, and finally whitelist third-party or Java types in stabilityConfigurationFiles. Never invert this order, since annotations are a contract, not a magic fix.

What is the difference between @Immutable and @Stable in Compose?▼

@Immutable requires every property to be a val of an immutable type with structural equals, and enables static expression promotion where constant-argument constructions are hoisted to singletons. @Stable suits types whose values can change but notify Compose through Snapshot, such as holders of MutableState.

How do I make a List parameter stable in a composable?▼

Replace kotlin.collections.List with kotlinx.collections.immutable.ImmutableList, which the Compose compiler recognizes with a known-stable bitmask. Build values with persistentListOf() or .toImmutableList(). This is preferred over whitelisting kotlin.collections.List in stability_config.conf because the type system enforces immutability.

Can I mark java.time.LocalDateTime as stable in Compose?▼

Yes, use stabilityConfigurationFiles with a stability_config.conf entry listing java.time.LocalDateTime, since the JDK source is not owned and cannot be annotated. Do not wrap it in a @Stable class with a var field, which breaks the stability contract and silently misses recompositions.

Why should I not pass a Flow as a composable parameter?▼

Flow has no observable identity, so the composable can never skip on it, and collecting inside the composable detaches from the lifecycle. Instead, collect upstream in a ViewModel or with collectAsStateWithLifecycle and pass the resolved value as a stable parameter.

When should I not use stability annotations to fix recomposition issues?▼

Do not annotate when the unstable types are not yet diagnosed, when the symptom is a wrong-phase state read or a derivedStateOf problem, or when the type contains a var or unstable nested type. Annotating a type that violates the contract causes silently missed recompositions with no warning.