stabilizing-compose-types

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

Updated May 31, 2026
One-click install
npx skills add https://github.com/decoutkhanqindev/Lich-Viet-Loc-Phat --skill stabilizing-compose-types-decoutkhanqindev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: stabilizing-compose-types
Source: https://github.com/decoutkhanqindev/Lich-Viet-Loc-Phat/tree/main/.claude/skills/stabilizing-compose-types
Command: npx skills add https://github.com/decoutkhanqindev/Lich-Viet-Loc-Phat --skill stabilizing-compose-types-decoutkhanqindev

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. ## Core Features & Use Cases - Three-tier fix strategy: Restructure types to be truly stable with val fields and immutable properties, apply @Immutable or @Stable annotations when source is owned, or use stabilityConfigurationFiles for third-party and Java types. - 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 and a java.time.LocalDateTime field in the Compose compiler report, and uses this Skill to apply @Immutable to the data class and whitelist the JDK time types in stability_config.conf. ## Quick Start Ask the assistant to stabilize the unstable User class and List parameter reported in your Compose compiler output using the three-tier strategy.

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 strategy: first restructure the type with val fields of immutable types, then annotate with @Immutable or @Stable if you own the source, and finally use stabilityConfigurationFiles for third-party or Java types. Re-run the compiler report to verify parameters flip to stable.

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

@Immutable requires all-val properties with immutable nested types and enables static expression promotion, where constant-argument constructions are hoisted to singletons. @Stable suits types whose mutations notify Compose via Snapshot, such as classes holding MutableState.

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

Replace kotlin.collections.List with kotlinx.collections.immutable.ImmutableList, built via persistentListOf() or .toImmutableList(). The Compose compiler ships a known-stable bitmask for these types, and the type system enforces immutability unlike a stability config whitelist.

Can I pass a Flow as a composable parameter?▼

No, Flow parameters are unstable because Flow has no observable identity and the composable cannot skip on it. Collect the flow upstream in a ViewModel or with collectAsStateWithLifecycle, then pass the resolved value to the composable.

How do I mark java.time.LocalDateTime as stable for Compose?▼

Add java.time.LocalDateTime to a stability_config.conf file and wire it via composeCompiler { stabilityConfigurationFiles.add(...) }. This requires Compose Compiler 1.5.5+; the older singular stabilityConfigurationFile property is deprecated.

Why is wrapping a Row in a composable not a valid stability fix?▼

Row, Column, and Box are inline composables that are not restartable or skippable to begin with. Wrapping them creates a new restart scope that changes behavior unpredictably without addressing the root unstable parameter.