/stackwise:jetpack-compose-expertfrom stackwise
Builds idiomatic Jetpack Compose screens with Material 3, ViewModel + StateFlow, type-safe Navigation Compose, Hilt DI, Room data layers, and Compose UI tests for Kotlin 2.x / Compose BOM 2026 apps.
Ships in stackwise. 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.
Turns Claude into a senior Android engineer shipping idiomatic Kotlin 2.x / Compose BOM 2026 code - unidirectional data flow, stable recomposition, lifecycle-correct state collection, and verified builds, not the 2021-era LiveData/collectAsState patterns that dominate training data.
StateFlow state exposed to composables the lifecycle-correct way@Serializable route classes)LaunchedEffect, DisposableEffect, rememberUpdatedState, snapshotFlowcomposeTestRule, semantics) and Robolectric-hosted testsderivedStateOf)gradle/libs.versions.toml and module build.gradle.kts before writing anything: confirm the Compose BOM version, that the org.jetbrains.kotlin.plugin.compose Gradle plugin is applied (required with Kotlin 2.x - composeOptions.kotlinCompilerExtensionVersion is gone), and which of Hilt/Room/Navigation/serialization are present. Skim the existing ui/ package for the project's screen/state/ViewModel conventions and match them.@HiltViewModel exposing a single StateFlow<UiState> via stateIn(viewModelScope, WhileSubscribed(5_000), initial). Collect in UI only with collectAsStateWithLifecycle(). Use Material 3 components, type-safe navigation routes, and immutable UI models../gradlew lint (plus ./gradlew :app:compileDebugKotlin if lint is configured lightly); fix all reported issues and re-run until clean before proceeding. Treat Compose lint checks (ComposableNaming, RememberReturnType, FrequentlyChangingValue, coroutine-in-composition errors) as real defects, not noise.runTest + Turbine for Flows) and Compose UI tests for the changed UI, then run ./gradlew test; fix all failures and re-run until clean. For instrumented UI tests, run ./gradlew connectedAndroidTest on a device/emulator; fix all reported issues and re-run until clean../gradlew installDebug, then start via adb shell am start), exercise the changed flow, and watch adb logcat for crashes and Choreographer/StrictMode warnings. For performance work, confirm with Layout Inspector recomposition counts or a Macrobenchmark that recompositions/frame times actually dropped.Load detailed guidance only when the task needs it:
| Topic | Reference | Load When |
|---|---|---|
State hoisting, stability, strong skipping, @Stable/@Immutable, immutable collections, derivedStateOf, lazy list performance | references/state-recomposition.md | Any recomposition/performance question, unstable-parameter warnings, jank in lists, or designing where state lives |
ViewModel + StateFlow, stateIn, collectAsStateWithLifecycle, Hilt setup, Room + Flow, coroutine scoping | references/architecture-viewmodel.md | Creating/refactoring a screen's state layer, wiring DI, adding a Room-backed feature, or viewModelScope vs rememberCoroutineScope decisions |
Navigation Compose: @Serializable routes, toRoute(), nested graphs, bottom bar back-stack behavior, deep links | references/navigation.md | Adding or restructuring routes, passing arguments, tab navigation state loss, or deep-link work |
Side effects: LaunchedEffect keys, rememberUpdatedState, DisposableEffect, snapshotFlow, one-shot events | references/side-effects.md | Any effect API usage, "effect restarts too often / never restarts" bugs, or bridging snapshot state to Flows |
Testing: composeTestRule, semantics/testTag, synchronization, Robolectric Compose tests, Turbine ViewModel tests | references/testing.md | Writing or fixing any Compose or ViewModel test, flaky waits, or choosing JVM vs device-hosted tests |
Screen wiring - lifecycle-aware collection, stateless content composable:
@Composable
fun OrdersScreen(
onOrderClick: (String) -> Unit,
viewModel: OrdersViewModel = hiltViewModel(),
) {
val state by viewModel.uiState.collectAsStateWithLifecycle() // NOT collectAsState()
OrdersContent(state = state, onOrderClick = onOrderClick, onRetry = viewModel::retry)
}
@Composable
private fun OrdersContent( // stateless: previewable and testable
state: OrdersUiState,
onOrderClick: (String) -> Unit,
onRetry: () -> Unit,
) { /* Material 3 UI driven only by `state` */ }
Type-safe navigation (Navigation 2.8+, kotlinx.serialization - no string routes):
@Serializable data object OrdersRoute
@Serializable data class OrderDetailRoute(val orderId: String)
NavHost(navController, startDestination = OrdersRoute) {
composable<OrdersRoute> {
OrdersScreen(onOrderClick = { id -> navController.navigate(OrderDetailRoute(id)) })
}
composable<OrderDetailRoute> { backStackEntry ->
val route = backStackEntry.toRoute<OrderDetailRoute>()
OrderDetailScreen(orderId = route.orderId)
}
}
Stable UI state - immutable models so skipping works:
@Immutable
data class OrdersUiState(
val orders: ImmutableList<OrderUi> = persistentListOf(), // kotlinx.collections.immutable
val isLoading: Boolean = false,
val error: String? = null,
)
Effect keyed correctly, latest callback without restart:
@Composable
fun SessionTimeout(onTimeout: () -> Unit) {
val currentOnTimeout by rememberUpdatedState(onTimeout)
LaunchedEffect(Unit) { // effect must run once for the composable's lifetime
delay(SESSION_MS)
currentOnTimeout() // always calls the latest lambda
}
}
collectAsState() instead of collectAsStateWithLifecycle() - collectAsState() keeps collecting while the app is backgrounded, wasting work and keeping upstream flows (location, DB observers) alive. Always use collectAsStateWithLifecycle() from lifecycle-runtime-compose; pair it with stateIn(..., WhileSubscribed(5_000), ...) in the ViewModel so upstream stops too.equals-same values, and lambdas are auto-remembered. Do not blanket-wrap every lambda in remember; do still fix genuinely churning values - a List rebuilt every emission fails equals and defeats skipping. Prefer ImmutableList/@Immutable UI models over sprinkling @Stable on mutable classes.LaunchedEffect keys. LaunchedEffect(Unit) with a captured callback runs stale code (use rememberUpdatedState); keying on an object that changes identity every recomposition restarts the effect every frame. Key on the values whose change should cancel-and-restart the work - nothing more, nothing less.rememberCoroutineScope for business logic. That scope dies when the composable leaves composition - a save/upload launched there is cancelled by rotation. Business work belongs in viewModelScope; rememberCoroutineScope is only for UI-lifetime calls like snackbarHostState.showSnackbar(), LazyListState.animateScrollToItem(), or drawer/sheet animations.LazyColumn without key (or with index keys) - inserts/removals recompose every following item and break animateItem() and scroll position. Provide a stable id: items(orders, key = { it.id }) { ... }. Also never put a LazyColumn with fillMaxHeight semantics inside a scrollable Column - use one lazy container with multiple item/items blocks.navigate("detail/$id") plus NavType boilerplate is the deprecated idiom. Use @Serializable route classes with composable<Route> and toRoute(); pass ids, not full objects, and reload data in the destination's ViewModel via SavedStateHandle.toRoute().derivedStateOf - e.g. val showButton = listState.firstVisibleItemIndex > 0 directly in composition recomposes on every scroll frame. Wrap frequently-changing reads whose result changes rarely: val showButton by remember { derivedStateOf { listState.firstVisibleItemIndex > 0 } }. Conversely, don't use derivedStateOf for plain combinations of infrequently-changing state - that's just remember(a, b).enableEdgeToEdge() in the Activity, let Material 3 Scaffold pass innerPadding to content (and actually apply it), and use WindowInsets.safeDrawing/imePadding() for custom layouts - hardcoded status-bar heights and systemUiVisibility flags are dead APIs.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
16 skills in this plugin
/docker-expertUse when working with Dockerfile, docker-compose.yml, .dockerignore, or multi-stage builds. Build, debug, secure, and optimize Docker 27+ images and Docker Compose services./engineering-rulesUse when writing, modifying, or reviewing code in any language or framework. Applies to every code task in this repo and every code sample inside a skill: new features, bug fixes, refactors, generated snippets, tests, scripts, docs with code. Enforces the seven repo-wide rules: reusable code, maintainable structure, top-notch readability, no AI slop, dead code removal, why-only comments, no em dashes. Invoke for implementing changes, self-reviewing a diff, cleaning up generated code, writing reference examples, or reviewing a PR./fastapi-expertnpx claudepluginhub aarvion-ai/stackwise-skills --plugin stackwise