compose-navigation-architecture
Installation
SKILL.md
Compose Navigation Architecture Governance
This skill centralizes all architectural mandates for Jetpack Compose Navigation to ensure consistency, testability, and decoupled UI layers across all Android projects.
1. The AppState Pattern Mandate
The application MUST govern its navigation and global state via the AppState pattern. This prevents the root @Composable from becoming bloated with logic and isolates lifecycle and navigation boundaries.
- Encapsulation: Create an
AppStateclass (e.g.,<AppName>AppState) that holds theNavHostController, globalSnackbarHostState, andCoroutineScope. - Window Size Classes: The
AppStateMUST observe and exposeWindowSizeClassor orientation states to drive adaptive layouts passively. - Factory Function: Provide a
@Composable fun remember<AppName>AppState(...)to instantiate and remember this state across recompositions.
See AppState & Type-Safe Destinations for full implementation templates.
2. Destinations & Type-Safe Navigation
Navigation routes MUST be strongly typed. String-based navigation (Navigation 1.0/2.0) is forbidden.