Skill Wiki v0.1.0
rule @android-compose/rule-hoist-state-up

Hoist State Up

A composable that displays a piece of state should NOT own it. Owning means calling `remember { mutableStateOf(...) }` inside the composable that renders.…

Skill
@android-compose
Domain
android-compose
Version
0.1.0
Quality
4.0
Edges
4 out · 3 in
Tokens
148/300/320
$ prime install @android-compose/rule-hoist-state-up

Projection

Always in _index.xml · the agent never has to ask for this.

HoistStateUp [rule] v0.1.0

A composable that displays a piece of state should NOT own it. Owning means calling remember { mutableStateOf(...) } inside the composable that renders. Instead the composable accepts the value as a parameter and emits change events through a callback. The caller hoists the state to the lowest common ancestor of every composable that needs to read or change it. This makes the component stateless, reusable, testable, and previewable, and lets the caller wire the same component to a ViewModel, a saved state, or a parent composable.

Source

prime-system/examples/android-compose/primes/compiled/@android-compose/rule-hoist-state-up/atom.yaml

Compiled at 2026-05-10