Skip to content

JetBrains/intellij-community / .agents/skills/compose-ui

compose-ui

Verified

Write or audit Compose Desktop UI state, effects, and boundaries.

FileKindSize
OWNERSHIPother20 B
SKILL.mdskill md532 B
architecture/GUIDE.mdmarkdown5.7 KB
architecture/evals/evals.jsonconfig6.5 KB
architecture/references/animation.mdmarkdown11.3 KB
architecture/references/component-api-lists-performance.mdmarkdown4.1 KB
architecture/references/desktop-seams-review-output.mdmarkdown1.5 KB
architecture/references/effects.mdmarkdown1.7 KB
architecture/references/state-boundaries.mdmarkdown5.4 KB
architecture/skill-source.jsonconfig2.0 KB
audit/GUIDE.mdmarkdown14.1 KB
audit/evals/evals.jsonconfig18.1 KB
audit/references/api-hygiene.mdmarkdown8.8 KB
audit/references/audit-search-patterns.mdmarkdown3.9 KB
audit/references/boundary-violations.mdmarkdown3.3 KB
audit/references/effects/derived-state-of-guide.mdmarkdown2.2 KB
audit/references/effects/effect-selection-guide.mdmarkdown2.7 KB
audit/references/effects/infinite-loop-patterns.mdmarkdown2.6 KB
audit/references/effects/overview.mdmarkdown7.7 KB
audit/references/lazy-layouts/animate-item.mdmarkdown2.0 KB
audit/references/lazy-layouts/cache-window-and-prefetch.mdmarkdown3.2 KB
audit/references/lazy-layouts/desktop-scroll-measurement.mdmarkdown2.0 KB
audit/references/lazy-layouts/keys-and-content-type.mdmarkdown2.2 KB
audit/references/lazy-layouts/nested-lazy-layouts.mdmarkdown1.6 KB
audit/references/lazy-layouts/overview.mdmarkdown7.5 KB
audit/references/measurement/benchmarking-methodology.mdmarkdown1.9 KB
audit/references/measurement/overview.mdmarkdown5.5 KB
audit/references/measurement/profiler-setup.mdmarkdown2.5 KB
audit/references/modifiers/custom-modifier-node.mdmarkdown3.4 KB
audit/references/modifiers/modifier-order.mdmarkdown2.1 KB
audit/references/modifiers/overview.mdmarkdown7.4 KB
audit/references/modifiers/phase-deferral.mdmarkdown2.6 KB
audit/references/reporting-guidance.mdmarkdown2.3 KB
audit/references/stability/ci-stability-gate.mdmarkdown2.0 KB
audit/references/stability/desktop-measurement.mdmarkdown2.2 KB
audit/references/stability/overview.mdmarkdown7.6 KB
audit/references/stability/reading-classes-txt.mdmarkdown2.1 KB
audit/references/stability/reading-composables-txt.mdmarkdown1.9 KB
audit/references/stability/stabilising-types.mdmarkdown3.1 KB
audit/references/stability/stability-config-syntax.mdmarkdown1.6 KB
audit/references/stability/stability-inference-algorithm.mdmarkdown3.4 KB
audit/references/stability/strong-skipping-escape-hatches.mdmarkdown2.6 KB
audit/references/subcomposition/desktop-subcomposition-measurement.mdmarkdown1.7 KB
audit/references/subcomposition/overview.mdmarkdown7.2 KB
audit/references/subcomposition/subcomposition-decision-tree.mdmarkdown1.8 KB
audit/references/subcomposition/swing-panel-subcomposition.mdmarkdown1.8 KB
audit/references/tracing-setup.mdmarkdown5.3 KB
audit/references/tracing-usage.mdmarkdown6.3 KB
audit/skill-source.jsonconfig2.5 KB

audit/references/stability/stability-inference-algorithm.md

View on GitHub
# Stability Inference Algorithm (Desktop)

The Compose compiler decides stability through a 12-phase algorithm. Understanding the phases helps
you interpret surprising verdicts in `classes.txt` and `composables.txt`.

## The 12 phases

1. **Well-known types** — primitives (`Int`, `Boolean`, etc.), `String`, `enum`, `Function`,
   inline classes, and standard-library stable types (`Unit`, `Nothing`, `Pair`, `Triple`) are
   hard-coded as stable.
2. **Marked types** — types annotated `@Stable` or `@Immutable` are stable.
3. **Configured types** — types listed in `stability_config.conf`.
4. **Mapped types** use explicit Kotlin-to-Compose stability mappings (such as `State` and `MutableState`).
5. **External types with metadata** — third-party Kotlin libraries compiled with the Compose
   compiler plugin emit a `$stable` field; the compiler trusts it.
6. **Collection types** — `kotlin.collections.*` interfaces (`List`, `Map`, `Set`, `Collection`,
   `MutableList`, etc.) are unstable unless explicitly mapped (they are interfaces, so the
   compiler cannot prove every implementation is immutable).
7. **Composable lambdas** — `@Composable` lambdas (`@dynamic`/`@static`) get special handling.
8. **Internal classes** — classes in the same module. The compiler inspects every field:
   - All `val` fields of stable types → `Stable`.
   - Any `var` field → `Unstable`.
   - Any field of a type the compiler cannot prove stable → `Unstable`.
9. **Java classes** — classes without Compose metadata. Default to `Unstable` unless a config
   file or `@Stable`/`@Immutable` annotation is present.
10. **Generic parameters** — unbounded generics default to `Unstable`.
11. **External types without metadata** — Kotlin or Java libraries compiled without the Compose
    compiler plugin. Default to `Unstable` unless configured otherwise.
12. **Runtime decision** — some types get a `$stable` field injected so the verdict is deferred
    to runtime. This is how `data class` with all-stable `val` properties becomes `runtime stable`.

## The `$stable` field

When a class is `runtime stable`, the compiler adds an `Int` companion constant named `$stable`.
Its value is a bitmask:

| Bit position | Meaning |
|-------------|---------|
| 0 | Class is stable overall (all fields stable). |
| 1…n | Per-field stability, only used for external types with metadata. |

You rarely need to read this field directly. The important takeaway is that `runtime stable` is
usually fine — it behaves like stable at runtime.

## When to worry about `runtime`

- If a `data class` has only `val` properties and the compiler reports `runtime stable`, no action
  is needed. This is normal.
- If a class is `runtime stable` and still causes excessive recompositions, check whether a parent
  class or generic parameter changed identity (`===` failed because a `List` was re-allocated).

## Strong Skipping interaction

Strong Skipping (default ON on Kotlin 2.0.20+) changes the skipability rules but **not** the
stability classification:

- Pre-Strong Skipping: a composable with any `unstable` parameter is non-skippable.
- Strong Skipping: every restartable composable is skippable, but `unstable` params are compared
  with `===` instead of `equals()`.

Under Strong Skipping, the stability label still matters because it decides *how* parameters are
compared, while non-skippable composables are rare (only `NonSkippableComposable` disables
skipping).
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall