What problem does it solve?
Cross-platform Compose projects face fragmentation of UI logic, inconsistent state handling, fragile navigation, and performance regressions from unnecessary recompositions; this Skill consolidates idiomatic patterns to build consistent, testable, and efficient shared UIs across Android, iOS, desktop, and web.
Core Features & Use Cases
- Single-state ViewModel with StateFlow: Use a single immutable screen state exposed as StateFlow to simplify state management and lifecycle-safe collection in Composables.
- Type-safe navigation: Define serializable route objects and use NavHost patterns for predictable navigation, dialogs, and bottom-sheet flows.
- Composable design & slot APIs: Build reusable composables with slot-based APIs and correct modifier ordering to enable flexible theming and testing.
- Performance patterns: Apply stability annotations, derivedStateOf, keyed lazy lists, and allocation avoidance strategies to reduce unnecessary recompositions.
- Platform-specific integration: Use expect/actual composables to adapt platform behaviors such as status bars while keeping shared UI logic in common code.
Quick Start
In your KMP project, expose a single immutable screen state from a ViewModel as StateFlow, collect it in Composables with lifecycle-aware helpers, and refactor UI into stateless slot-based composables for reuse.