compose-state-authoring

Checks KotlinJS/KMP projects for forbidden Java and C++ usages.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/soygabimoreno/Los-ANDROIDES --skill compose-state-authoring
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-state-authoring
Source: https://github.com/soygabimoreno/Los-ANDROIDES/tree/main/.agents/skills/compose-state-authoring
Command: npx skills add https://github.com/soygabimoreno/Los-ANDROIDES --skill compose-state-authoring

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents subtle Jetpack Compose bugs where UI state resets or fails to update because local variables are not correctly backed by Compose state.

Core Features & Use Cases

  • Correct recomposition-safe local state: Ensure var in a composable survives recomposition and triggers updates via remember { mutableStateOf(...) } or mutableStateListOf / mutableStateMapOf.
  • Proper handling of state collection mutations: Avoid patterns like remember { mutableStateOf(mutableListOf(...)) } followed by .add(...) that bypass snapshot observation; use mutableStateListOf / mutableStateMapOf or replace the value.
  • Apply @ReadOnlyComposable safely: Mark composables as read-only only when they truly only read composition state and never allocate UI/layout nodes, call remember, or call non-read-only composables.

Quick Start

Use the compose-state-authoring skill to review a Compose @Composable and verify every local var is backed by remember + mutableStateOf (or the correct mutableStateListOf / mutableStateMapOf) and that any @ReadOnlyComposable function only performs valid read-only operations.

Frequently Asked Questions about compose-state-authoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my Jetpack Compose UI state reset during recomposition?

Jetpack Compose UI state resets during recomposition when local variables are not backed by `remember` and `mutableStateOf`. You must wrap state initialization in `remember { mutableStateOf(...) }` to ensure values survive recomposition cycles.

How do I properly observe list mutations in Jetpack Compose state?

To properly observe list mutations in Jetpack Compose state, use `mutableStateListOf` or `mutableStateMapOf` instead of `remember { mutableStateOf(mutableListOf(...)) }`. Standard mutable collections bypass snapshot observation, causing UI updates to fail when items are added.

When can I safely apply the @ReadOnlyComposable annotation?

You can safely apply the `@ReadOnlyComposable` annotation only when a composable function strictly reads composition state without allocating UI nodes, calling `remember`, or invoking non-read-only composables to prevent invalid runtime optimizations.

How do I write recomposition-safe local state in a @Composable function?

To write recomposition-safe local state in a @Composable function, ensure every local `var` is backed by `remember` plus `mutableStateOf`, `mutableStateListOf`, or `mutableStateMapOf` to trigger correct snapshot mutation observation and UI updates.

What is the best way to prevent Jetpack Compose snapshot observation bugs?

The best way to prevent Jetpack Compose snapshot observation bugs is to avoid wrapping standard mutable collections in `mutableStateOf`. Replace value references or use `mutableStateListOf` to ensure mutations are tracked by the snapshot system correctly.

Does using remember with mutableStateOf fix all Compose state update issues?

Using `remember` with `mutableStateOf` does not fix all Compose state update issues. If you store a mutable collection like `mutableListOf` inside `mutableStateOf`, calling `.add()` bypasses snapshot observation, so you must use `mutableStateListOf` instead.