Jetpack Compose side effects
Picks the right Compose effect API and fixes effects that rerun, go stale or leak, so your Android screens behave.
What we improved
Corrected the "do it once" pattern. The original said LaunchedEffect(Unit) re-runs after a configuration change and recommended remember { } instead, while putting a side effect inside remember. remember is also lost on rotation and runs du
Improved by YourAISkill from the original by skydoves, under its Apache-2.0 licence. The download includes the author's licence and a CHANGES.md listing every change. Both Claude reviews read the improved version.
Claude's review
8/10 Clear decision tree and symptom table for Compose effect APIs with correct wrong/right pairs covering stale callbacks, snapshotFlow, lifecycle effects and per-row ViewModels.
We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.
In detail
Use this skill to choose the cheapest correct effect API in Jetpack Compose — `LaunchedEffect`, `DisposableEffect`, `SideEffect`, `rememberUpdatedState`, and skydoves/compose-effects' `RememberedEffect` and `ViewModelStoreScope`. Covers stale-callback bugs in long-lived `LaunchedEffect`, setup/teardown for non-coroutine subscribers, avoiding a coroutine scope just to react to a key change, and per-row ViewModels in a `LazyColumn`. Trigger when the user mentions LaunchedEffect, DisposableEffect, RememberedEffect, SideEffect, rememberUpdatedState, ViewModelStoreScope, effect restarts unexpectedly, leaked listener, or per-item ViewModel.
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: using-efficient-effects
description: Choose the cheapest correct side effect API in Jetpack Compose and diagnose effect bugs by symptom (runs twice, ignores a new value, replays a snackbar after rotation, keeps running in the background). Covers LaunchedEffect keys and restarts, rememberUpdatedState for stale callbacks, DisposableEffect for listeners, SideEffect, rememberCoroutineScope for event driven work, snapshotFlow for reacting to fast changing state without restarting, LifecycleStartEffect and LifecycleResumeEffect for start and stop work, doing something once (per entry versus across rotation), and per item ViewModels in lazy lists. Use when the user mentions LaunchedEffect, DisposableEffect, SideEffect, rememberUpdatedState, rememberCoroutineScope, snapshotFlow, an effect that restarts unexpectedly or never sees the new value, a leaked listener, work that should pause in the background, or a ViewModel per LazyColumn row. Optional notes cover the compose-effects library (RememberedEffect, ViewModelStoreScope).
license: Apache-2.0. See LICENSE for complete terms.
metadata:
author: Jaewoong Eum (skydoves)
keywords:
- jetpack-compose
- performance
- launchedeffect
- disposableeffect
- rememberupdatedstate
- snapshotflow
- lifecycle-effects
- side-effects
---
<!-- Modified by YourAISkill (youraiskill.com) on 2 December 2026 from the original by skydoves. See CHANGES.md. -->
# Using Efficient Effects: pick the cheapest correct effect API
Compose's core effect APIs: `LaunchedEffect` (a coroutine that restarts when a key changes), `DisposableEffect` (setup with a cleanup block), `SideEffect` (runs after every successful composition), plus helpers that decide how effects see changing values (`rememberUpdatedState`, `snapshotFlow`) and where coroutines live (`rememberCoroutineScope`). Picking the wrong one wastes coroutines, restarts work on every frame, leaks a listener, or silently calls a stale callback. This skill is the decision tree.
Ground rule: effect bodies run **after** a composition is applied. Never perform side effects directly in a composable body or inside `remember { }`: composition can run many times, run speculatively, or be thrown away.
## When to use this skill
- The user asks which effect API to use, or why an effect restarts unexpectedly or never sees the new value.
- A long-lived `LaunchedEffect` calls an old version of a callback the parent has since replaced.
- A non-Compose subscriber (listener, observer, receiver, sensor) needs setup on entry and teardown on key change or exit.
- An effect is keyed on a value that changes every frame or every scroll pixel.
- Work should start and stop with the screen's lifecycle (camera, location, video playback), not just with composition.
- A `LazyColumn` row seems to need its own `ViewModel`.
## When NOT to use this skill
- Deriving one state from another: use `derivedStateOf` or a plain computation, not an effect.
- Showing a flow's latest value in UI: use `collectAsStateWithLifecycle()` (lifecycle-runtime-compose).
- Work that must survive leaving the screen or a configuration change (a network save): put it in the ViewModel (`viewModelScope`), not in a composable effect.
## Workflow: decision tree
...From skydoves's repository, Apache-2.0 licence.
Related skills
-
Checked
Compose UI test setup
Sets up the right Gradle test dependencies for Jetpack Compose UI tests, so they launch instead of failing early.
8/101 credit -
Checked
Android Gradle Plugin upgrade
Moves Kotlin Multiplatform projects to Android Gradle Plugin 9 and fixes the build failures it causes.
8/101 credit -
Checked
Android Edge-to-Edge Fix
Makes Jetpack Compose apps draw edge to edge, so buttons, lists and text fields never hide behind system bars.
8/101 credit -
Checked
Offline Android LLM apps
Builds an Android app that runs an open LLM on the phone with LiteRT, so it works without a server.
7/101 credit -
Checked
Android TV Compose Migration
Moves an Android TV app from old Leanback screens to Compose for TV, with remote control focus that works.
7/101 credit -
Checked
CometChat Android Chat Setup
Adds working CometChat chat screens to your Android app in Kotlin or Jetpack Compose, set up in the right order.
7/101 credit