Unidirectional data flow, a ViewModel per screen, baseline profiles for startup.
Constitution — Android with Jetpack Compose
Version 1.0.0 · Ratified 2026-11-10
These principles hold for every spec, plan and task of the project. A spec may add rules; it never weakens these.
-
Unidirectional data flow. State flows down and events flow up. Each screen exposes one immutable UI state as a
StateFlow, collected withcollectAsStateWithLifecycle; composables never change shared state directly. -
A ViewModel per screen. Each screen has one ViewModel injected with Hilt that survives configuration changes. State that must survive process death goes through
SavedStateHandle. -
Baseline profiles for startup. A Macrobenchmark module generates the baseline profile that ships with every release. Cold start stays under 1 s on the reference mid-range device, and a regression in the benchmark fails CI.
-
State hoisting. Composables take state and event lambdas as parameters and stay stateless where they can, so each one has a
@Preview.rememberholds only UI state such as an expanded flag. -
Cheap recomposition. Parameters are stable or immutable, lazy lists give every item a
key, and the Compose compiler reports are checked when a screen changes. A screen that recomposes on every frame is a defect. -
Structured coroutines. Work runs in
viewModelScopeorlifecycleScopewith injected dispatchers.GlobalScopeandrunBlockingon the main thread fail the review. -
Accessible by default. Every icon and image has a
contentDescriptionor is marked decorative, touch targets are at least 48 dp and screens are checked with TalkBack. Compose UI tests find nodes by their semantics. -
Material 3 theming. Colors and type come from
MaterialTheme, with dark theme and dynamic color supported. A hard-coded color in a composable fails the review.