Skip to content
Back to skills

Compose State And Effects

ASecurity

Use when writing or reviewing Jetpack Compose state ownership, remember state, state hoisting, screen state holders, LaunchedEffect, DisposableEffect, SideEffect, Flow collection, navigation, snackbar, analytics, or focus requests.

  • 1,070 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 5, 2026
developmenttestingapiperformance

Works with

  • api

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned September 30, 2026

npx -y skills add chrisbanes/skills --skill compose-state-and-effects --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Compose State And Effects?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Compose State And Effects
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/chrisbanes-compose-state-and-effects/badge)](https://www.skillsdirectory.com/skills/chrisbanes-compose-state-and-effects)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: compose-state-and-effects
description: Use when writing or reviewing Jetpack Compose state ownership, remember state, state hoisting, screen state holders, LaunchedEffect, DisposableEffect, SideEffect, Flow collection, navigation, snackbar, analytics, or focus requests.
---

# Compose state and effects

## Core principle

Give every piece of UI state one lowest responsible owner, then run imperative
work through the effect whose lifecycle follows that owner. Composition renders;
state and effects make rendering change safely.

A screen-ownership review is incomplete until it names the plain, previewable
content composable that receives immutable state and event callbacks separately
from app wiring and composition-owned runtime objects.

## Procedure

1. Establish the requested scope and visible behavioral requirements. Treat an
   ownership change as a finding only when code or task evidence shows a
   lifecycle, testability, business, or coordination need.
2. Inventory mutable UI state, app state, event streams, app dependencies, and
   imperative work in the affected screen or component.
3. Place each state value at its lowest necessary owner: local UI state,
   hoisted state, a plain UI state holder, or a screen state holder.
4. For a screen boundary, keep durable data and intents in the wiring owner,
   Compose runtime objects in composition or a plain UI state holder, and
   rendering in a previewable content composable that takes immutable state
   and callbacks. Read [State hoisting](references/state-hoisting.md) for the
   implementation shape; naming only state and intents is not that boundary.
   Keep this content callable with sample state and callbacks; an `@Preview`
   wrapper is optional and is not required for the state-driven boundary.
   Before adding it, confirm the module declares its tooling; do not assume
   Compose runtime or UI dependencies provide it. Respect the task's file
   scope: do not add tooling or change build files unless authorized. If
   Preview tooling is needed but unavailable within scope, omit the wrapper
   and report the setup gap.
5. Choose an effect API whose lifecycle matches the work, and key it by the
   semantic input that should restart or dispose it.
6. Load the focused reference for every material concern below. Do not use a
   reference merely because its topic is adjacent.
7. Route frame-rate reads, cross-phase back-writing, and
   `@ReadOnlyComposable` contracts to [Compose performance](../compose-performance/SKILL.md).
   For that contract, distinguish a read of snapshot `State.value` from an
   operation that changes the composer; the state read alone is not a violation.
8. Before responding to a screen-ownership review, verify all three screen
   seams in step 4 when visible code needs them.
9. Finish when every state value has one owner, every effect has a justified
   lifecycle and key, and the UI can be previewed and tested without app
   dependencies. For review-only work, report no change when no evidence-backed
   issue remains; do not invent product requirements.

## Topic router

| Signal | Read |
|---|---|
| Bare local `var`, `remember { mutableStateOf(...) }`, state lists/maps, or reset state | [Local state](references/local-state.md) |
| State shared by siblings, UI state holders, ViewModel/component wiring, or previewable screen boundaries | [State hoisting](references/state-hoisting.md) |
| `LaunchedEffect`, `DisposableEffect`, `SideEffect`, `snapshotFlow`, `rememberCoroutineScope`, `rememberUpdatedState`, `produceState`, imperative `requestFocus`, callbacks, event Flow collection, snackbar, navigation, or analytics | [Side effects](references/side-effects.md) |
| Focus ownership and keyboard/TV/D-pad behavior | [Compose focus navigation](../compose-focus-navigation/SKILL.md) |
| Tests or previews for the resulting UI contract | [Compose UI testing patterns](../compose-ui-testing-patterns/SKILL.md) |

Files in this skill

  • SKILL.md3.2 KB
  • references/local-state.md1.8 KB
  • references/side-effects.md2.6 KB
  • references/state-hoisting.md2.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…