using-strong-skipping-correctly — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited using-strong-skipping-correctly (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Strong Skipping Mode is the Compose compiler behavior that became the default with the Kotlin Compose compiler plugin shipped in Kotlin 2.0.20. It changes two things at once: every restartable composable becomes skippable regardless of param stability (unstable params are compared with ===, stable params with equals), and every capturing lambda literal written inside a @Composable function is automatically wrapped in remember(captures) { ... }. Both behaviors are on by default; neither requires opt-in flags on Kotlin 2.0.20+. Lambdas with no captures are already compiler-emitted singletons and are NOT wrapped — only capturing lambdas need (and get) the auto-remember treatment.
That sounds like "stability no longer matters", and for a lot of UI code it almost is. But the change leaves three sharp edges: stable types still need correct equals semantics so the === fallback does not invalidate every recompose, lambdas in non-@Composable scopes (LazyListScope.items { }, Modifier.pointerInput { }, plain object expressions) are not auto-memoized, and a few intentional cases need explicit opt-out via @DontMemoize or @NonSkippableComposable. This skill walks the verification, audit, and escape-hatch decisions for working in a strong-skipping world.
@Stable?" or "does this composable skip now?".onClick = { vm.add(it) } allocating per recompose?".restartable skippable everywhere.@DontMemoize or @NonSkippableComposable in code or compiler output and asks what they do.../../stability/understanding-stability-inference/SKILL.md.../../stability/enforcing-stability-in-ci/SKILL.md.equals-based skipping to work — use ../../stability/diagnosing-compose-stability/SKILL.md to fix the underlying types.../debugging-recompositions/SKILL.md to instrument first.org.jetbrains.kotlin.plugin.compose. Strong Skipping is on by default. To turn it off on Kotlin 2.0.20+, use composeCompiler { featureFlags.add(ComposeFeatureFlag.StrongSkipping.disabled()) } (the legacy enableStrongSkippingMode = true property is @Deprecated("Use the featureFlags option instead") and still works on older Kotlin).../../stability/diagnosing-compose-stability/SKILL.md).../../measurement/testing-compose-in-release-mode/SKILL.md).*-composables.txt (restartable skippable fun Foo(...)).Before claiming any behavior is "because of strong skipping", confirm the toolchain is on a version where it is the default, or the legacy flag is set.
./gradlew :app:dependencies --configuration kotlinCompilerPluginClasspathRelease | grep -i composeExpect the Compose compiler plugin to come from Kotlin 2.0.20 or later. In build.gradle.kts:
plugins {
alias(libs.plugins.kotlin.android) // Kotlin 2.0.20+
alias(libs.plugins.kotlin.compose) // org.jetbrains.kotlin.plugin.compose
}To disable strong skipping on Kotlin 2.0.20+ (the modern feature-flag DSL):
import androidx.compose.compiler.plugins.kotlin.ComposeFeatureFlag
composeCompiler {
featureFlags.add(ComposeFeatureFlag.StrongSkipping.disabled())
}The legacy property composeCompiler { enableStrongSkippingMode = true } is @Deprecated("Use the featureFlags option instead") in modern Compose Compiler Gradle plugin releases. It still works (and is still the only switch on older Kotlin 1.9.x / 2.0.0–2.0.10), but new code should prefer featureFlags.add(ComposeFeatureFlag.StrongSkipping.disabled()) when opting out.
Then regenerate Compose Compiler reports and grep for a known previously-unstable signature:
./gradlew :app:assembleRelease
grep -A1 "restartable" app/build/compose_compiler/app-release-composables.txt | head -40Under strong skipping, every restartable composable should print restartable skippable, including ones that take List<Foo> or other unstable parameters. If a composable is still listed restartable without skippable, it is using @NonSkippableComposable (intentional) or the mode has been turned off (e.g. someone added featureFlags.add(ComposeFeatureFlag.StrongSkipping.disabled()) or set the legacy enableStrongSkippingMode = false).
Strong skipping wraps every capturing lambda literal written inside a @Composable function in remember(captures) { ... }. The captured-values list is the compiler-generated remember key. Capture-less lambdas (e.g. { vm.refresh() } where vm is a stable file-scope reference, or { /* no-op */ }) are already compiler-emitted singletons and are NOT auto-remembered — there is nothing to key on. Three consequences:
remember(captures) and re-used across recompositions while the captures compare equal.List<Foo> literal not hoisted) re-captures on every recompose because the unstable capture compares with ===, and a fresh literal is a new reference.Inspect the suspect call site. The mental model: "what does this lambda close over, and is each capture stable by equals and identity-stable across recompositions?".
// RIGHT — captures stable id + stable callback; auto-remembered by strong skipping
@Composable
fun Row(snack: Snack, onClick: (Long) -> Unit) {
Button(onClick = { onClick(snack.id) }) { Text(snack.name) }
}// WRONG — captures a freshly allocated list literal; new reference each recompose
@Composable
fun Header(title: String) {
Toolbar(actions = listOf(Action.Share, Action.Save)) { /* ... */ }
}
// WRONG because: `listOf(...)` allocates a new List every recompose. Even with strong
// skipping the unstable param compares with ===, fails, and Toolbar recomposes every time.// RIGHT — hoist the unstable literal so its identity is stable
@Composable
fun Header(title: String) {
val actions = remember { listOf(Action.Share, Action.Save) }
Toolbar(actions = actions) { /* ... */ }
}Auto-remember only applies to lambdas inside a `@Composable` function context. The following are not @Composable scopes; lambdas inside them are not auto-remembered and need a manual remember(key) if allocation matters:
LazyListScope.items { ... }, LazyGridScope.items { ... }, LazyVerticalGrid.items { ... }, etc. — the items block is a regular Kotlin DSL builder.Modifier.pointerInput { ... }, Modifier.draggable { ... }, Modifier.scrollable { ... } — non-@Composable lambdas.object : DefaultLifecycleObserver { }).Modifier.drawBehind { ... }, Modifier.drawWithCache { ... } — the lambda parameters are not @Composable.For these, hoist a stable lambda yourself, keyed on whatever may change:
// WRONG — onClick allocated per item per recompose; strong skipping does not reach here
LazyColumn {
items(snacks, key = { it.id }) { snack ->
SnackRow(snack, onClick = { vm.select(snack.id) })
}
}
// WRONG because: `items { snack -> ... }` is LazyListScope, not a @Composable function.
// Strong skipping does not auto-remember the onClick lambda — a new instance allocates per row,
// per recompose, and SnackRow's `===` comparison on the lambda param fails every time.// RIGHT — hoist a stable handler keyed on the stable callback
LazyColumn {
items(snacks, key = { it.id }) { snack ->
val onClick = remember(snack.id) { { vm.select(snack.id) } }
SnackRow(snack, onClick = onClick)
}
}// RIGHT — even better: pass the id-aware callback once
LazyColumn {
items(snacks, key = { it.id }) { snack ->
SnackRow(snack, onClick = vm::select) // method reference is stable
}
}Strong skipping is opinionated. A handful of cases legitimately need the opposite behavior. The full reference table is in references/escape-hatches.md; the high-level decision tree:
EXPRESSION only, not TYPE) — the lambda must NOT be auto-remembered. Use when the lambda intentionally captures a fresh value per call (e.g. a logger that should record the latest counter, not the one captured by the first composition). Apply it at the call site: Button(onClick = @DontMemoize { ... }), never at a parameter type position like (@DontMemoize () -> Unit).MaterialTheme.colorScheme getters use it.// RIGHT — logger composable that must always emit
@NonSkippableComposable
@Composable
fun RecompositionLogger(label: String) {
SideEffect { Log.d("Recomp", "tick: $label @ ${System.currentTimeMillis()}") }
}// RIGHT — annotate the lambda expression that intentionally captures fresh per-call state.
// @DontMemoize is @Target(EXPRESSION) — apply it on the lambda literal, NOT on the type.
@Composable
fun TraceClicks(counter: Int, content: @Composable (() -> Unit) -> Unit) {
content(@DontMemoize { Log.d("Click", "counter at click time = $counter") })
}Reading reports tells the story up to the function boundary. To confirm a specific composable is or is not being skipped at runtime, instrument with @TraceRecomposition from compose-stability-analyzer. Cross-link ../../measurement/tracing-recompositions-at-runtime/SKILL.md for the full setup. The two-line summary:
@TraceRecomposition(traceStates = true)
@Composable
fun SnackRow(snack: Snack, onClick: (Long) -> Unit) { /* ... */ }Logcat will print one line per recomposition with the changed parameters, which directly answers "did strong skipping skip this call or not?".
Strong skipping does not eliminate the need for @Immutable / @Stable. It changes the comparison from equals to === for unstable params. === is reference equality. If a stable type is needed in a hot path, mark it @Immutable so equals is used and structurally-equal instances skip.
// WRONG
data class Filter(val tags: List<String>, val sort: SortOrder)
@Composable
fun FilterBar(filter: Filter) { /* ... */ }
// WRONG because: Filter is unstable (List<String> is unstable). Strong skipping makes
// FilterBar skippable, but only when `prevFilter === newFilter`. A copy() with the same
// content fails identity, recomposes the bar, every time.// RIGHT
@Immutable
data class Filter(val tags: ImmutableList<String>, val sort: SortOrder)
@Composable
fun FilterBar(filter: Filter) { /* ... */ }
// RIGHT because: @Immutable + ImmutableList makes Filter stable. Strong skipping uses
// equals(), and structurally-equal copies skip.// WRONG
@Composable
fun Toolbar(title: String) {
ActionRow(actions = listOf(Action.Share, Action.Save))
}
// WRONG because: a fresh List allocates per recompose. Strong skipping makes ActionRow
// skippable, but the List param fails === every time and the body re-runs.// RIGHT
private val ToolbarActions = persistentListOf(Action.Share, Action.Save)
@Composable
fun Toolbar(title: String) {
ActionRow(actions = ToolbarActions)
}See workflow step 3. The short version: items { } is not @Composable, strong skipping does not reach inside it, hoist a stable callback or use a method reference.
@DontMemoize for intentionally-fresh lambdas// WRONG — auto-remembered lambda captures `counter` from the FIRST composition
@Composable
fun LoggingButton(counter: Int) {
Button(onClick = { Log.d("Btn", "counter = $counter") }) { Text("hit") }
}
// WRONG because: under strong skipping the lambda is auto-remembered, but `counter` is a
// stable Int capture, so the remember key is the int value. This is actually fine here.
// Where it bites is when the developer EXPECTS each invocation to capture fresh state but
// the lambda is being passed across a memoization boundary that hides the capture.// RIGHT — explicit opt-out where freshness is the contract.
// @DontMemoize is @Target(EXPRESSION) — apply on the lambda literal, never on the type.
@Composable
fun TraceContent(latest: Int, body: @Composable (() -> Unit) -> Unit) {
body(@DontMemoize { sendTelemetry("snapshot=$latest") })
}@DontMemoize is rarely needed in app code. Reach for it only after measuring; the default behavior is correct for almost all UI.
@NonSkippableComposable for side-effect-only composables// RIGHT
@NonSkippableComposable
@Composable
fun FrameTicker(onTick: () -> Unit) {
SideEffect { onTick() }
}The annotation says "this composable has work to do every recomposition; do not let the skip guard short-circuit it". Use sparingly — most composables that "must run every time" are actually misplaced state reads; fix the read site first.
Strong skipping makes nearly every composable skippable in the report, which makes the report less useful for spotting regressions by eye. Combine with ../../stability/enforcing-stability-in-ci/SKILL.md so the baseline diff catches a composable that flips from skippable to not.
./gradlew :app:dependencies and confirm Kotlin 2.0.20+ (default ON). On older Kotlin, confirm the legacy enableStrongSkippingMode = true flag in composeCompiler { }. If the project explicitly disables Strong Skipping via featureFlags.add(ComposeFeatureFlag.StrongSkipping.disabled()), treat the rest of this skill as not applicable.*-composables.txt report. Annotations like @NonSkippableComposable and lambdas inside LazyListScope.items { } remain footguns the report makes visible.@Immutable / @Stable over relying on reference equality for unstable types passed in hot paths. === is a poor substitute for structural equals when the producer of the value (copy(), map { }, builder DSL) does not preserve identity.@DontMemoize or @NonSkippableComposable without a one-line code comment explaining why. These are advanced opt-outs; the next reader will assume they are mistakes if the rationale is not co-located.listOf(...) allocated in a composable param fails === regardless of strong skipping. Hoist into remember { ... } or a top-level persistentListOf(...).../../stability/enforcing-stability-in-ci/SKILL.md so a composable regressing from skippable to not skippable (e.g. someone adds @NonSkippableComposable without justification) fails CI.@Composable function before answering yes/no. The answer flips entirely at the @Composable boundary.Skippability is a diagnostic, not a KPI: under strong skipping every composable is "skippable" in the report, but only the ones whose params actually compare equal will skip at runtime. The interesting question is no longer "is it skippable?" but "do its params compare equal across the recomposition the developer cares about?".
featureFlags.add(ComposeFeatureFlag.StrongSkipping.disabled()) opt-out is in effect — or, on older Kotlin, that the legacy enableStrongSkippingMode = true flag is set.*-composables.txt shows restartable skippable on previously-unstable-param composables.listOf, mapOf, ad-hoc lambdas in non-@Composable scopes).@DontMemoize / @NonSkippableComposable / @NonRestartableComposable / @ReadOnlyComposable in the changed code has a co-located comment explaining why.@TraceRecomposition (see ../../measurement/tracing-recompositions-at-runtime/SKILL.md) that the composable skips when its inputs are equal.../../stability/enforcing-stability-in-ci/SKILL.md) covers the changed module so a future regression in skip behavior fails CI.references/escape-hatches.md — full reference table of @NonRestartableComposable, @NonSkippableComposable, @DontMemoize, @ReadOnlyComposable with code samples and decision matrix.For diagnosing why a composable is unstable in the first place, see ../../stability/diagnosing-compose-stability/SKILL.md. For instrumenting a specific composable to see if it actually skips at runtime, see ../debugging-recompositions/SKILL.md and ../../measurement/tracing-recompositions-at-runtime/SKILL.md. For preventing a strong-skipping regression in CI, see ../../stability/enforcing-stability-in-ci/SKILL.md.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.