jetpack-compose-performance
Diagnose and optimize Android Jetpack Compose UI code. Use this skill
Install / Use
npx skills add android/skills --skill jetpack-compose-performanceInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Development & EngineeringSupported Platforms
Tags
Our assessment of jetpack-compose-performance
jetpack-compose-performance scores 86/100 on our quality scale, 2423rd of 4,601 Development & Engineering skills we index.
Its SKILL.md is 20 KB long, well organised into 9 sections and no code examples: a thorough specification that gives an agent plenty to work with.
With 7,514 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 27 days ago, so jetpack-compose-performance is actively maintained.
- It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
jetpack-compose-performance compared with similar skills
All 4 of these similar skills score higher than jetpack-compose-performance; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| jetpack-compose-performance (this skill)by android | 86 | 7.5k | 27d ago | SKILL.md |
| taste-skillby Leonxlnx | 100 | 99.8k | today | CLAUDE.md |
| ai-job-searchby MadsLorentzen | 100 | 60.2k | today | CLAUDE.md |
| claude-howtoby luongnv89 | 100 | 42.1k | today | CLAUDE.md |
| algorithmic-artby anthropics | 100 | 177.9k | 28d ago | SKILL.md |
Frequently asked questions
- How do I install jetpack-compose-performance?
- Run
npx skills add android/skills --skill jetpack-compose-performance. The install tabs above show the steps for each supported agent. - Which AI agents does jetpack-compose-performance work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is jetpack-compose-performance safe to use?
- It is Apache-2.0-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is jetpack-compose-performance still maintained?
- The repository was last updated 27 days ago, so jetpack-compose-performance is actively maintained.
Skill content
View source on GitHubname: jetpack-compose-performance description: Diagnose and optimize Android Jetpack Compose UI code. Use this skill when analyzing performance bottlenecks of existing code to minimize recomposition overhead and prevent dropped frames and UI lag. license: Complete terms in LICENSE.txt metadata: author: Google LLC last-updated: '2026-10-13' keywords:
- Jetpack Compose
- performance
- UI development
- optimization
- recomposition
- lazy layouts
- graphics
- stability
- memory
- allocation
- jank
- rendering
- state computation
- state derivation
- snapshotFlow
- produceState
- derivedStateOf
- computedStateOf
- sharedElement
- sharedBounds
- CompositionLocal
Foundational prerequisites
Before micro-optimizing composables, ensure standard production flags are in place:
- Release Build: Never profile or benchmark debuggable builds; ART runtime verification severely degrades performance.
- R8 Minification: Keep R8 enabled to optimize bytecode and coroutine dispatch.
- Baseline Profiles: Generate baseline profiles for critical user journeys (cold start, key scrolling feeds) so the ART VM pre-compiles and preloads classes ahead of time.
Optimization audit workflow
- Exhaustive Scan : Scan the target code against all 7 core categories in the following sections. Evaluate every
@Composablefunction, modifier chain, and lazy-layout data model against all checklist rules rather than stopping after the first issue found. - Mandatory Reference Read Before Flagging or Editing : Whenever a file matches a rule in Categories 1--7, you MUST open and read the corresponding
references/*.mdfile for the approved fix pattern and full scope guards before reporting a finding or editing code. Never rely on the summary bullets alone to write fixes.
1. State, snapshots, and stability (references/state-and-stability.md)
MANDATORY : Before flagging or fixing any issue in this category, you MUST read references/state-and-stability.md.
- Phase Deferral (Lambdas) : Wrap frequently changing state reads in lambdas (such as
Modifier.offsetorModifier.graphicsLayer) so reads occur in Layout or Draw phase rather than Composition. - Prohibit Backwards Writes (Verify Read-Before-Write Order) : Never modify state in a later phase or after it has already been read in the same composition pass (
Read -> Write, orComposition Read -> Layout or Draw Write). Prevent backwards writes across phases to avoid first-frame popping, jank, and infinite recomposition loops (Backwards Write). Do not flag a state assignment at the start of a composable (Write -> ReadorComposition Write -> Draw Read) as a backwards write---a backwards write strictly requires a read of that state to precede the write. - Avoid Redundant State Wrapping in Composition (
Write -> Read) : Do not wrap synchronous values inremember { mutableStateOf(...) }only to overwrite them immediately at the top of composition before reading them (for example,var path by remember { mutableStateOf(Path()) }; path = viewModel.getPath()). While not a backwards write, this adds unnecessary slot table andMutableStatesnapshot overhead (and risks becoming a backwards write if a read is later added preceding the assignment); use a plain localvalor read the value directly inside the target phase (such asModifier.drawWithCache). - Explicit
rememberKeys & Slot Overhead : Always pass all input variables and composable parameters referenced insiderememberas calculation keys. Remember thatrememberstoreskeys + 1objects in the slot table and checks key equality on every recomposition; onlyrememberwhen allocations are heavy or identity must be preserved. Do not pass snapshot state values/properties (e.g.state.value) as keys when wrappingderivedStateOf(passing theStateinstance itself is fine if the instance reference can change). computedStateOfvsderivedStateOf(Compose 1.13+) : On Compose 1.13+, usecomputedStateOffor simple condition checks and filtered state from fast-changing inputs (such asscrollState.value > 0), which provides significantly faster invalidation thanderivedStateOf(on Compose< 1.13, useremember { derivedStateOf { ... } }). ReservederivedStateOffor heavy calculations that benefit from multi-read caching, or trivial calculations read frequently enough per composition (roughly10 / numberOfStatesReadPerCalculationtimes without invalidating between reads) to make up for the invalidation cost.- Synchronous State Derivation : Audit for asynchronous
produceState+snapshotFlowblocks observing Compose states (such as scroll positions or collection sizes); replace them with synchronousremember { derivedStateOf { ... } }(orcomputedStateOfon Compose 1.13+). - Trivial Primitives : Prefer plain custom Kotlin getters (
get()) overderivedStateOforcomputedStateOffor simple boolean expressions and property lookups. - Collection State Tracking : Back whole-list updates with standard
mutableListOf()andmutableStateOf(list, neverEqualPolicy())with load-bearing assignments instead ofmutableStateListOf(). - Snapshot Collections : Use
SnapshotStateList.toList()for repeated queries or iterations to avoid per-element read observation overhead. - Repeated State Reads : Extract repeated Compose
Stateproperty reads into a local variable at the top of the block. - State in Setters : Avoid reading Compose
Stateinside custom property setters; use a raw backing field when triggering change side-effects and batch multi-property updates. - Stability & Skipping Trade-Offs (Skipping Isn't Free) : Do not fixate on stability or treat
@Immutable,@Stable, orImmutableListas default solutions. Skipping a composable is not free: each parameter is stored in the slot table as if remembered, and all inputs must be compared on recomposition. Strong Skipping Mode already skips composables with unstable parameters (including standardkotlin.collections.List) when instance equality (===) matches. Annotating models or usingImmutableListforces structural equality (.equals()), which can be significantly more expensive than recomposition itself for large collections or complex classes. - Never Add
@Stable,@Immutable, orImmutableListto Collection Models : When writing or optimizing code, never add@Immutableor@Stableto models containing collections (List,Set,Map), and never recommend replacingkotlin.collections.List<T>withImmutableList<T>(or addingImmutableListtostability_config.txt). CallingO(N).equals()on collections on every recomposition pass is more expensive thanO(1)instance equality (===) under Strong Skipping Mode. - Scope Guard for Removing Existing
@Stable/@ImmutableAnnotations (Large Lazy Datasets Only) :- When to Remove : Only recommend removing existing
@Stableor@Immutableannotations from data models when both conditions are met: (1) the model is used within a lazy layout (LazyColumn,LazyRow,LazyGrid,Pager,ScalingLazyColumn) as the input feed or item model, and (2) it contains a large dataset or deep nested collection hierarchy (e.g., feed streams, large lists of tags/items, or multi-level nested lists likePostwithList<Paragraph>andList<Markup>), where recursiveO(N).equals()checks degrade scrolling and recomposition performance. - When to Leave Untouched : For all other existing
@Stable,@Immutable, orImmutableListusages in a codebase---such as non-lazy UI models, standalone components, or models with small/bounded collections (e.g., a card with a few badges, thumbnails, or metadata rows) where dataset size is small or unknown---leave the existing annotations untouched and do not flag them . Never blindly grep and flag all@Stable/@Immutableclasses across a codebase without verifying they feed a lazy layout with a large dataset.
- When to Remove : Only recommend removing existing
- When to Add
@Stable/@ImmutableUnder Strong Skipping Mode : Flatdata classes withvalprimitive/Stringproperties in Compose modules are already inferred as stable by the compiler and use.equals()automatically---do not add redundant@Immutableannotations to them. Only add@Stableor@Immutablewhen the compiler cannot infer stability (e.g. classes from non-Compose modules or interfaces) and a data source (such as Room or MVI reducers) allocates new object instances for unchanged items on every emission, provided the class is small, flat, has no collections (List,Set,Map), and its.equals()check is trivialO(1). - Make Composables Cheaper Instead of Forcing Skipping: Do not overindex on recomposition counts. Skipping one composable during an active recomposition pass saves little time once composition is scheduled (leaving the house is the bulk of the cost). Focus on making composables cheap to execute, deferring state reads to Layout/Draw, and verifying with benchmarks rather than assuming skipping improves performance.
2. Layouts and measurement optimization (references/layouts.md)
MANDATORY : Before flagging or fixing any issue in this category, you MUST read references/layouts.md.
- Coordinates & Placement : Avoid
onGloballyPositioned; useModifier.onVisibilityChangedfor viewport tracking,Modifier.onPlacedorModifier.onLayoutRectChangedfor local bounds, and queryrequireLayoutCoordinates()on demand insideModifier.Nodeevent handlers. - Anchor Floating Content via Custom
Layout: When attaching floating labels or tooltips to a component, use a customLayoutmeasuring and placing both children relative to each other. Never trackonGloballyPositionedcoordinates inMutableStateto position floating content withoffset, which causes a 1-frame lag and schedules a second composition pass. - Phase Deferral for Offsets : Wrap dynamic offsets in lambdas (
Modifier.offset { IntOffset(...) }) to skip Composition straight to Layout. - Tree Depth & Decorative Wrappers : Avoid redundant wrapper
Boxes and decorativeCanvasnodes; attach modifiers directly or useModifier.drawBehind. - Subcomposition Overhead : Avoid
BoxWithConstraints/SubcomposeLayoutinside hot paths and lazy items; prefer standard modifiers,Modifier.layout, orLayoutModifierNode. - Intrinsic Measurements: Use intrinsic measurements judiciously and avoid deeply nested intrinsic chains.
3. Lazy layouts optimization (references/lazy-layouts.md)
MANDATORY : Before flagging or fixing any issue in this category, you MUST read references/lazy-layouts.md.
- Lazy Layout Scope Guard : Directives for
keyandcontentTypeapply strictly to Lazy containers (LazyColumn,LazyRow,LazyGrid). Never flag standard non-lazy containers (Column,Row,Box) iterating over collections. - Mandatory
contentTypeand Primitivekey: Always specify both primitivekeys (Int,Long,String) andcontentTypes for all items in lazy layouts (LazyColumn,LazyRow,LazyGrid). When usingitemsoritemsIndexed, never omitcontentType:contentType = { _, item -> item.type }. OmittingcontentTypeprevents Compose from reusing composition slots during scrolling. - In-Item Index Lookups : Replace
list.indexOf(item)withitemsIndexedto eliminateO(N²)lookups during layout passes. - **Observable Selection &
Truncated for display — read the full file on GitHub.
Related Skills
taste-skill
99.8kAgent skills that give coding agents taste: art direction, reference images and a browser check instead of generic AI pages
ai-job-search
60.2kThe job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.
claude-howto
42.1kA visual, example-driven guide to Claude Code — from basic concepts to advanced agents, with copy-paste templates that bring immediate value.
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
