/compose-agent:compose-agent [focus area, e.g. 'state', 'effects', 'navigation', 'paging', 'lifecycle', 'animation', 'testing', 'focus', 'kmp']from compose-agent
Reviews, writes, and modifies Jetpack Compose code for correctness and modern API usage. Targets state management, side effects, performance, Navigation 3, Paging 3, coroutines, animations, UI testing, focus/keyboard navigation, and Compose Multiplatform boundaries.
Ships in compose-agent. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Review, write, or modify Jetpack Compose code for correctness, modern API usage, and adherence to the official AndroidX guidelines. Report only genuine problems — do not nitpick or invent issues.
Target track (unless the repo says otherwise):
2.0.20+ with Compose Compiler 1.5.4+ (Strong Skipping Mode on by default).androidx.lifecycle with collectAsStateWithLifecycle().androidx.navigation3) when the project can adopt it; otherwise Navigation 2.8+.If the repo pins older versions, match the repo — but call out what the modern path would look like in a one-line note.
references/api.md.references/state.md.LaunchedEffect, DisposableEffect, produceState, snapshotFlow, rememberUpdatedState) using references/effects.md.references/performance.md.Modifier.Node over composed { } — using references/modifiers.md.references/navigation.md — start from its decision table (Nav3 vs Nav2 type-safe vs plain state) before touching call sites.references/concurrency.md.stateIn, shareIn, flatMap variants, combine, error handling, backpressure, asStateFlow()) using references/flows.md.references/component-api.md.references/testing.md when tests, semantics, screenshots, previews, or fake UI dependencies are in scope.references/focus.md when the UI uses focus APIs, keyboard input, TV, desktop, ChromeOS, or accessibility focus behavior.references/kmp.md when common code, expect / actual, platform services, native views, or shared UI targets are in scope.remembered Animatable, target-driven launches, spring over tween, deferred animated reads, AnimatedContent keys — using references/animation.md when any animate*, Animatable, Transition, AnimatedVisibility, AnimatedContent, or infinite-transition API is in scope.collectAsLazyPagingItems (the paging differ — not collectAsStateWithLifecycle, which does not apply to PagingData), stable itemKey, LoadState branches, user-driven refresh() / retry() — using references/paging.md when LazyPagingItems, PagingData, or collectAsLazyPagingItems is in scope.references/kotlin.md.If doing a partial review, load only the relevant reference files — each references file is designed to be read in isolation.
LaunchedEffect, DisposableEffect, produceState, the ViewModel, or — for event/gesture-driven work only — rememberCoroutineScope().launch inside a handler. Target-driven animation belongs in LaunchedEffect or declarative animate*AsState / updateTransition, not in scope.launch from the composition body. See references/animation.md and references/effects.md.Modifier names the parameter modifier, types it Modifier = Modifier, and applies it to the outermost layout only. Never create a modifier parameter you do not forward.modifier: Modifier = Modifier → other optional parameters with defaults → trailing content: @Composable () -> Unit slots last. One modifier parameter per component.remember. See references/component-api.md.collectAsStateWithLifecycle() in UI code. Plain collectAsState() keeps collecting when the screen is not visible and burns battery and bandwidth. Exception: Flow<PagingData<T>> is collected with collectAsLazyPagingItems(), never collectAsStateWithLifecycle() — see references/paging.md.rememberSaveable over remember for UI state that should survive configuration change or process death, unless the value is unserializable or derivable.mutableIntStateOf, mutableLongStateOf, mutableFloatStateOf, mutableDoubleStateOf) for primitive state. Raw mutableStateOf<Int>(...) boxes.onSizeChanged / onGloballyPositioned / onPlaced) must not write state a sibling reads in composition (a cross-phase back-write, a measure → recompose loop), and never mutate a mutableStateListOf / mutableStateMapOf inside a composable body that also reads it (composition-phase self-invalidation, a mutate → recompose loop). Consume measured values in layout/draw, or mutate snapshot state from an event / LaunchedEffect / state holder. See references/performance.md.remember(index) on a pure function, or remember-ing an already-auto-memoized callback under Strong Skipping (SSM memoizes lambdas even with unstable captures). Prove a recomposition win with Layout Inspector counts or compiler reports, not the presence of a pattern. See references/performance.md.CompositionLocal. Use explicit parameters.HorizontalPager, PullToRefreshBox, FlowRow/FlowColumn, enableEdgeToEdge()).MaterialTheme.colorScheme.* (directly or via a blend), its text and icon colors must read from the same theming source. Hard-coded Color.Black / Color.White / raw ARGB literals over theme-driven backgrounds are dark-mode regressions. See references/component-api.md.animate*AsState for single state-driven values and updateTransition for synchronized ones; reach for Animatable only when you need imperative control (gesture, fling, sequence). Always remember an Animatable, launch target-driven animations from LaunchedEffect (never scope.launch in composition to react to state), prefer spring() over tween for interruptible motion, and read animated values in the layout/draw phase (lambda modifiers / graphicsLayer) so the animation does not recompose every frame. See references/animation.md.collectAsLazyPagingItems(), render with items(count = …, key = …) and stable domain ids, branch on loadState for loading/empty/error/append, and keep refresh() / retry() on user actions — not in the composition body. See references/paging.md.Organize findings by file. For each issue:
collectAsStateWithLifecycle() instead of collectAsState()").developer.android.com/... or AndroidX component guidelines).Skip files with no issues. End with a prioritized summary — three items max, highest impact first.
feature/profile/ProfileScreen.ktLine 34: Use collectAsStateWithLifecycle() — UI Flows must stop collecting when the screen is not STARTED.
// Before
val user by viewModel.user.collectAsState()
// After
val user by viewModel.user.collectAsStateWithLifecycle()
https://developer.android.com/topic/architecture/ui-layer/state-production#continuous-vs-discrete
Line 58: Pass modifier to the outermost layout, not to inner content.
// Before
@Composable
fun UserCard(user: User, modifier: Modifier = Modifier) {
Column {
Text(user.name, modifier = modifier) // modifier swallowed here
Text(user.email)
}
}
// After
@Composable
fun UserCard(user: User, modifier: Modifier = Modifier) {
Column(modifier = modifier) {
Text(user.name)
Text(user.email)
}
}
https://developer.android.com/develop/ui/compose/api-guidelines#naming-modifiers
Line 72: Defer the animated offset read to the layout phase using the lambda form.
// Before
val dx by animateDpAsState(targetValue = if (expanded) 0.dp else (-200).dp, label = "drawerOffset")
Box(modifier = Modifier.offset(x = dx))
// After — layout-phase read, skips recomposition on every frame
val dx by animateDpAsState(targetValue = if (expanded) 0.dp else (-200).dp, label = "drawerOffset")
Box(modifier = Modifier.offset { IntOffset(dx.roundToPx(), 0) })
ProfileScreen.kt:72, HomeScreen.kt:110, DetailScreen.kt:88 recompose every frame. Switch to lambda-form modifiers.collectAsState() — replace with collectAsStateWithLifecycle() to avoid collecting in the background.UserCard swallows its modifier parameter. Forward it to the outermost layout.End of example.
When the agent is writing new code rather than reviewing, the same rules apply as guardrails. Before generating a composable, silently check:
modifier: Modifier = Modifier?key =?LaunchedEffect, produceState, or the ViewModel — not in the composition body?collectAsStateWithLifecycle()? (A Flow<PagingData<T>> is the exception — it uses collectAsLazyPagingItems().)LoadState handled, and refresh/retry user-driven?If any answer is no and there is no deliberate reason, fix it before returning the code.
Out of scope in v1 — delegate elsewhere or scope down explicitly:
material-3 skill.jetpack-compose-audit skill in the same repo.contentDescription, icon-only buttons without labels, touch targets under 48dp) but do not grade.If the user needs any of the above, narrow the scope and say so.
references/api.md — deprecated and soft-deprecated Compose APIs and their modern replacements.references/state.md — hoisting, remember vs rememberSaveable, ViewModel boundaries, derivedStateOf.references/effects.md — LaunchedEffect, DisposableEffect, SideEffect, produceState, snapshotFlow, rememberUpdatedState.references/performance.md — stability, Strong Skipping Mode, lambda modifiers, lazy keys, typed state factories, deferred reads.references/modifiers.md — modifier ordering, lambda form, Modifier.Node over composed { }.references/navigation.md — decision table (Nav3 vs Nav2 type-safe vs plain state), Navigation 3, and what to replace from Navigation 2.references/concurrency.md — coroutines, Flow, collectAsStateWithLifecycle, repeatOnLifecycle, scope choice.references/flows.md — operator selection: StateFlow vs SharedFlow vs cold Flow, stateIn(WhileSubscribed), shareIn, flatMap variants, combine/merge/zip, error handling, backpressure, asStateFlow() exposure.references/component-api.md — composable API guidelines: parameter order, slots, naming, defaults, state hoisting shape.references/testing.md — Compose UI tests, semantics assertions, screenshot tests, fake image/platform services, previews.references/focus.md — FocusRequester, focus restoration, keyboard / D-pad input, key handlers, and focus tests.references/kmp.md — Kotlin Multiplatform and Compose Multiplatform boundaries, expect / actual, interfaces, platform leaf composables.references/animation.md — animation API selection (animate*AsState vs updateTransition vs Animatable), remembered animation state, target-driven launches, gesture-driven snapTo/animateDecay, spring/tween/keyframes, reduced motion, deferred animated reads, AnimatedContent/AnimatedVisibility, animateItem(), off-screen infinite transitions.references/paging.md — Paging 3 in Compose: when to page vs plain lists, collectAsLazyPagingItems, stable itemKey, LoadState UI, pull-to-refresh, anti-patterns for paginated lazy lists.references/kotlin.md — Kotlin coding conventions and Android Kotlin style the LLM keeps missing.evals/evals.json holds write-mode acceptance cases — prompts that ask this skill to write Compose, plus the expectations the produced code must satisfy. Cases 0–2 mirror the jetpack-compose-audit scoring rules 1:1 (cross-phase back-writes, Strong Skipping false leads, snapshot self-invalidation) — bin/ci keeps them in lockstep so the authoring path can't drift from the audit path; cases 3–4 add foundational phase-correct reads and lifecycle-aware Flow collection. Run a model with this skill loaded against each prompt and check every expectation.
Every rule in this skill traces back to one of:
https://developer.android.com/develop/ui/compose and its subpageshttps://developer.android.com/kotlin/style-guidehttps://kotlinlang.org/docs/coding-conventions.htmlhttps://www.jetbrains.com/help/kotlin-multiplatform-dev/https://android.googlesource.com/platform/frameworks/support/+/androidx-main/compose/docs/compose-api-guidelines.mdhttps://android.googlesource.com/platform/frameworks/support/+/androidx-main/compose/docs/compose-component-api-guidelines.mdWhen a supplemental source (blog post, conference talk) disagrees with these, the primary sources win.
evals/evals.json (opens in a new tab)references/animation.md (opens in a new tab)references/api.md (opens in a new tab)references/component-api.md (opens in a new tab)references/concurrency.md (opens in a new tab)references/effects.md (opens in a new tab)references/flows.md (opens in a new tab)references/focus.md (opens in a new tab)references/kmp.md (opens in a new tab)references/kotlin.md (opens in a new tab)references/modifiers.md (opens in a new tab)references/navigation.md (opens in a new tab)references/paging.md (opens in a new tab)references/performance.md (opens in a new tab)references/state.md (opens in a new tab)references/testing.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub hamen/compose_skill --plugin compose-agentOther plugins' skills for the same job