Jetpack Compose Builder
Installation
SKILL.md
Jetpack Compose Builder
Build the state and data flow first, the pixels second - most Compose bugs are state-ownership and recomposition bugs, not layout bugs. The costly failure is a screen that works in a demo, then recomposes entire subtrees on every keystroke or scroll frame because state lives in the wrong place and parameters are unstable.
Operating procedure
Step 1: Gather inputs
Before writing a composable, establish:
- The screen's state shape: what the user sees, what can change, and what triggers each change.
- Which state is UI-local (text field focus, expanded flags) versus screen-level (loaded data, selection) versus app-level (auth, theme).
- The data source: ViewModel exposing StateFlow, or a snapshot-state holder for pure-UI screens.
- List characteristics if any: item count, item identity (stable server ids?), reorder/insert behavior.
- Refresh-rate target of the flagship devices in the install base (60Hz gives a 16.6ms frame budget, 120Hz gives 8.3ms).
Step 2: Map state ownership before drawing anything
Decide which state is UI-local (remember) versus screen-level (ViewModel exposing StateFlow, collected via collectAsStateWithLifecycle()). Hold mutable state in the lowest common ancestor that needs it - no lower (parent cannot drive it) and no higher (recomposes too wide a scope).