compose-state-authoring
Installation
SKILL.md
Compose state authoring
Not every remember { … } belongs here. This skill covers local UI state (remember { mutableStateOf(…) }, mutableStateListOf / mutableStateMapOf) and @ReadOnlyComposable. Other remembered APIs live in focused skills:
rememberCoroutineScope/rememberUpdatedState→compose-side-effectsrememberLazyListState/rememberScrollStateused for frame-rate reads →compose-state-deferred-reads- Focus navigation, focus state,
FocusRequesterownership, behavior →compose-focus-navigation
Core principle
A @Composable is a function the runtime re-runs whenever its inputs change. Writing local state correctly comes down to two questions:
- Mutable local state — does my
varsurvive recomposition and trigger it? If not, it silently resets on every recompose and writes are invisible. - What kind of composable is this? — do I mutate composition (place layout nodes, allocate slots,
remember) or only read it? If only read,@ReadOnlyComposablelets the runtime skip work.
Get either wrong and the symptoms are subtle: state that vanishes or optimizations that don't apply.