stabilizing-compose-types

Fix unstable Jetpack Compose types using a three-tier stability workflow.

472|16|Updated Apr 29, 2026
One-click install
npx skills add https://github.com/skydoves/compose-performance-skills --skill stabilizing-compose-types
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stabilizing-compose-types
Source: https://github.com/skydoves/compose-performance-skills/tree/main/stability/stabilizing-compose-types
Command: npx skills add https://github.com/skydoves/compose-performance-skills --skill stabilizing-compose-types

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill guides you through fixing unstable Jetpack Compose types after a stability diagnosis, using a three-tier strategy to make types truly stable or properly annotated.

Core Features & Use Cases

  • Tiered stability strategy: restructure types to be truly stable with val and immutable fields, and then annotate with @Immutable or @Stable when ownership allows.
  • Guidance for common scenarios: stabilize List/Set/Map parameters via kotlinx.collections.immutable, and apply stabilityConfigurationFiles for Java/third-party types.
  • Validation and discipline: provide a StableHolder escape hatch when needed and require re-running the stability diagnosis to verify results.

Quick Start

Run the stability diagnostic, then apply the three-tier plan: make types truly stable with val and immutable fields, annotate with @Immutable or @Stable when appropriate, and configure stabilityConfigurationFiles for third-party or Java types, then re-run the diagnostic.

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 Jetpack Compose types after running a stability diagnosis?

To fix unstable Jetpack Compose types, apply a three-tier strategy: restructure types with val and immutable fields, annotate with @Immutable or @Stable where appropriate, and configure stabilityConfigurationFiles for third-party types, then re-run the diagnosis.

What is the best way to stabilize List, Set, and Map parameters in Jetpack Compose?

The best way to stabilize List, Set, and Map parameters in Jetpack Compose is to use kotlinx.collections.immutable. This library provides immutable collection types that the Compose compiler recognizes as stable, preventing unnecessary recompositions.

Can I stabilize third-party or Java types in Jetpack Compose without modifying their source code?

Yes, you can stabilize third-party or Java types without modifying source code by using stabilityConfigurationFiles. This tells the Compose compiler to treat specified external classes as stable, ensuring compatibility without requiring code changes.

When should I use @Immutable versus @Stable annotations in Kotlin Compose?

Use @Immutable when all properties of a type are truly immutable and cannot change after construction. Use @Stable when the type is mutable but the Compose runtime can safely treat its instances as stable across recompositions.

Does Jetpack Compose stability configuration work with Kotlin 2.0 and kotlinx.collections.immutable?

Yes, the three-tier stability workflow ensures compatibility with Kotlin 2.0+ and kotlinx.collections.immutable. It validates fixes by re-running the stability analysis to confirm parameters are either stable or runtime.

What should I do if I cannot make a Jetpack Compose type truly stable?

If you cannot make a Jetpack Compose type truly stable, use the StableHolder escape hatch provided by the workflow. This mechanism wraps unstable types, allowing them to bypass strict stability checks while you verify the overall composition behavior.