compose-composition-core

Enforce Compose composition-time rules for state reads and derived state.

1|1|Updated May 23, 2026
One-click install
npx skills add https://github.com/santimattius/performance-compose-skills --skill compose-composition-core
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-composition-core
Source: https://github.com/santimattius/performance-compose-skills/tree/main/skills/compose-composition-core
Command: npx skills add https://github.com/santimattius/performance-compose-skills --skill compose-composition-core

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you identify and prevent unnecessary recompositions and state mistakes in Jetpack Compose by applying composition-time performance rules for state reads, derived state, identity, and stability.

Core Features & Use Cases

  • Defer state reads to Layout/Drawing using provider-lambda modifier overloads to reduce restart scope and avoid re-rendering whole composable scopes.
  • Use derivedStateOf correctly so recomposition happens only when the computed result changes, including the keys trap for parameters vs snapshot state.
  • Protect component identity with stable call-site patterns and correct LazyList keys to prevent index-based identity bugs and cascading invalidations.
  • Choose the right state lifetime (remember/retain/rememberSaveable/rememberSerializable) to match recomposition, configuration change, and process-death requirements.
  • Apply stability and Strong Skipping Mode concepts to minimize unnecessary updates by passing stable inputs and understanding equality/reference comparisons.

Quick Start

Use the compose-composition-core skill to refactor a composable that recomposes too often by deferring rapidly changing state reads into the appropriate modifier lambda and verifying LazyList keys are stable.

Frequently Asked Questions about compose-composition-core

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

FAQPage Schema
How do I fix unnecessary recomposition in Jetpack Compose?

Fix unnecessary recomposition by deferring state reads into provider-lambda modifier overloads, shrinking the restart scope so Compose only re-renders layout or drawing phases instead of whole composable scopes.

Why does derivedStateOf cause excess invalidation when parameters change?

derivedStateOf triggers excess invalidation because recomposition relies on snapshot state reads, not parameter changes; passing changing parameters as keys avoids the stale closure trap so recomputation happens only when the computed result changes.

How do I prevent LazyList item identity bugs in Compose?

Prevent LazyList item identity bugs by supplying stable keys at the call site rather than relying on index-based identity, which stops cascading invalidations and protects component identity during list updates.

Does this Compose stability approach work with Compose Multiplatform?

Yes, this approach applies to both Jetpack Compose and Compose Multiplatform development, enforcing composition-time stability rules and Strong Skipping Mode concepts to minimize unnecessary updates across platforms.

What is the best way to choose state lifetime for Compose configuration changes?

Choose state lifetime by matching remember, rememberSaveable, or rememberSerializable to your specific requirements for recomposition, configuration changes, and process death to avoid stale closures and state identity bugs.

When should I not use CompositionLocal in Compose?

You should restrict CompositionLocal usage when it causes excess invalidation or unpredictable recomposition scopes, applying composition-time rules to ensure state reads and stability do not trigger cascading UI updates.