Skip to main content
skill CX Codex

compose-performance — Claude Code skill: Jetpack Compose recomposition

A skill for investigating Jetpack Compose recomposition cost: find the phase causing the work and fix it at the boundary where it starts.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add chrisbanes/skills --skill compose-performance -a claude-code
Open on GitHub

What compose-performance does

The skill kicks in when you are chasing why a Compose screen recomposes more than it should. It walks a fixed procedure: reproduce one user-visible transition, capture evidence such as recomposition counts, compiler reports or profiler data, then classify the primary axis. There are three: parameter stability and skipping, the phase where State is read, and snapshot state written back into an earlier phase.

Before proposing anything, it checks for a false lead — a real data change, a correctness defect, or a lazy item that is expected to recompose. Then it reads the focused reference and pairs every finding with the smallest evidence-supported repair. Change one axis at a time and re-measure the same transition.

Builds go through Gradle run. If no build can run, the skill reasons from declared types instead of unpacking toolchain jars or working around the sandbox. For an Int held in mutableStateOf with the default structural equality policy, an unchanged value already avoids invalidation, so there is nothing to fix there.

What it helps with

  • find which phase makes Compose redo the work
  • read compiler stability reports for skippability issues
  • stop State reads at frame rate during scroll or animation
  • check whether snapshot state is written back into an earlier phase
  • tell a real problem from expected recomposition

Example prompts for the agent

  • Why does this screen recompose on every frame while scrolling? Run compose-performance on it.
  • Read classes.txt and composables.txt and tell me which parameters are unstable.
  • I suspect a cross-phase snapshot write — verify it and suggest the smallest fix.

How to install compose-performance

1Skills CLI (Vercel)

npx skills add chrisbanes/skills --skill compose-performance -a claude-code

2Manually: put the files in place

~/.claude/skills/compose-performance/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/compose-performance/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about compose-performance

How do I install compose-performance in Claude?

Run npx skills add chrisbanes/skills --skill compose-performance -a claude-code. The skill lands at ~/.claude/skills/compose-performance/SKILL.md.

What does compose-performance do?

It runs a step-by-step investigation of recomposition cost: reproduce a transition, classify the axis, rule out false leads, then apply a targeted repair and re-measure.

What does the skill need to work?

Builds run through Gradle run. When no build can run, it reasons from declared types and does not unpack toolchain jars.

Source text

SKILL.md · Apache-2.0
---
name: compose-performance
description: Use when investigating Jetpack Compose recomposition cost, compiler stability reports, skippability, unstable parameters, frame-rate State reads, cross-phase snapshot back-writing, or @ReadOnlyComposable contracts.
---

# Compose performance

## Core principle

Measure one user-visible transition, identify the runtime axis that causes the
work, then apply the smallest correction at the phase or boundary where that
axis begins.

## Procedure

1. Reproduce one concrete transition and capture the observable evidence:
   recomposition counts, compiler reports, profiler data, or a clear trace.
   Build only through [Gradle run](../gradle-run/SKILL.md). If no build can
   run, reason from the declared types; do not unpack toolchain jars or work
   around the sandbox.
2. Classify the primary axis: parameter stability and skipping, State read
   phase, or snapshot state written back into an earlier phase.
3. Check for a false lead: a real data change, a correctness defect, or an
   unchanged lazy item that is expected to recompose.
4. Read the corresponding focused reference before proposing a change.
5. For review work, pair every finding with the smallest evidence-supported
   repair. For a false stability promise, explicitly say to replace mutable
   non-snapshot properties with immutable data or snapshot-observable state,
   verify that contract, and only then decide whether an annotation remains
   needed. For a phase problem, name the layout or draw consumer where the
   changing read or calculation should move. A cross-phase write proves
   invalidation or an extra pass; do not claim oscillation or an infinite loop
   unless evidence shows values repeatedly changing. Do not stop at diagnosis.
   When only source code is available, separate the proven feedback path from
   its unmeasured runtime cost. Give a conditional repair direction based on
   the intended measurement boundary; do not prescribe a callback swap,
   equality guard, or content-layout rewrite as a performance fix without
   evidence that it changes the observed problem. For an `Int` held in
   `mutableStateOf` with the default structural equality policy, an unchanged
   value already avoids invalidation.
6. Change one axis at a time and re-measure the same transition.
7. Finish when the evidence improves at the observed boundary without hiding
   state changes, caching stale values, or moving work to a less correct owner.

## Topic router

| Signal | Read |
|---|---|
| Cause is unknown, or several axes may interact | [Diagnosis](references/diagnosis.md) |
| `classes.txt`, `composables.txt`, strong skipping, unstable parameters, or collection stability | [Stability](references/stability.md) |
| Scroll, animation, gesture, layout, or draw State read at frame rate; measured state fed back into composition | [Deferred reads](references/deferred-reads.md) |
| A composable only reads composition locals or accessor-style values | [Composition contracts](references/composition-contracts.md) |
| State ownership or effect lifecycle is the root cause | [Compose state and effects](../compose-state-and-effects/SKILL.md) |

© chrisbanes · Apache-2.0 · chrisbanes/skills

Similar skills

Everything for Mobile →

From the same set18

compose-focus-navigation This skill guides focus navigation in Jetpack Compose for TV, keyboards, desktop, accessibility, and D-pad input. It helps with initial and restored focus. CX Codex +1 1,900installs compose-animations Helps write and review Jetpack Compose motion across common UI states. Useful when picking between AnimatedVisibility, AnimatedContent, animate*AsState, and rememberTransition. CX Codex +1 1,800installs shepherd Monitors open pull requests and merge requests, triages review feedback, addresses CI failures, and batches local fixes. CX Codex +1 1,200installs kotlin-concurrency-and-flow A skill for writing and reviewing Kotlin coroutine code: scope ownership, cancellation, StateFlow, SharedFlow and Channel. CX Codex +1 1,100installs compose-state-and-effects This skill guides state ownership and side-effect choices in Jetpack Compose. It keeps UI state at the lowest responsible layer and matches effect lifecycles to their owners. CX Codex +1 1,100installs using-chrisbanes-skills Reads a Kotlin or Jetpack Compose task and loads the right skill from the chrisbanes set. Useful when several concerns overlap in one change. CX Codex +1 1,100installs kotlin-control-flow A skill that steers your coding agent through Kotlin branching: when expressions, guard conditions, sealed-type exhaustiveness, smart casts. CX Codex +1 1,100installs compose-component-design A skill for designing and reviewing reusable Jetpack Compose component APIs: slots, modifier parameters, root layout placement. CX Codex +1 1,000installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor