| license | Apache-2.0 |
| name | jetpack-compose-navigation-expert |
| description | Jetpack Compose navigation expert with type-safe routes, Hilt DI, and MVVM/MVI architecture. Activate on: Jetpack Compose navigation, Compose type-safe routes, Hilt dependency injection, MVVM Android, MVI pattern, Compose state management, NavHost, ViewModel. NOT for: XML layouts (use frontend-architect), iOS SwiftUI (use swiftui-data-flow-expert), React Native (use react-native-architect). |
| allowed-tools | Read,Write,Edit,Bash(gradle:*,adb:*) |
| category | Mobile Development |
| tags | ["android","jetpack-compose","navigation","architecture"] |
| pairs-with | [{"skill":"frontend-architect","reason":"Shared reactive UI patterns between Compose and React"},{"skill":"android-background-task-specialist","reason":"ViewModels coordinate with background tasks via WorkManager"}] |
Jetpack Compose Navigation Expert
Expert in Jetpack Compose navigation with type-safe routes, Hilt dependency injection, and clean MVVM/MVI architecture.
Activation Triggers
Activate on: "Jetpack Compose navigation", "Compose type-safe routes", "Hilt DI", "MVVM Android", "MVI pattern", "Compose state management", "NavHost", "ViewModel Compose", "navigation-compose"
NOT for: XML layouts → frontend-architect | iOS SwiftUI → swiftui-data-flow-expert | React Native → react-native-architect
Quick Start
- Add Navigation Compose —
implementation("androidx.navigation:navigation-compose:2.9.x") with type-safe routes
- Define routes as serializable classes —
@Serializable data class ProductRoute(val id: String)
- Set up Hilt —
@HiltViewModel for ViewModels with constructor injection
- Implement MVVM — ViewModel holds UI state, composables observe via
collectAsStateWithLifecycle
- Handle deep links — declarative deep link mapping in NavHost
Core Capabilities
| Domain | Technologies |
|---|
| Navigation | Navigation Compose 2.9, type-safe routes, nested graphs |
| DI | Hilt 2.53, @HiltViewModel, @Inject, module scoping |
| Architecture | MVVM, MVI (Circuit, Mavericks), UDF (unidirectional data flow) |
| State | StateFlow, collectAsStateWithLifecycle, SavedStateHandle |
| Async | Kotlin Coroutines, Flow, Room with Flow, Retrofit suspend |
Architecture Patterns
Type-Safe Navigation (Compose 2.8+)
@Serializable
data object HomeRoute
@Serializable
data class ProductRoute( productId: String)
( orderId: String, showConfirmation: = )
) {
NavHost(navController = navController, startDestination = HomeRoute) {
composable<HomeRoute> {
HomeScreen(
onProductClick = { id ->
navController.navigate(ProductRoute(productId = id))
}
)
}
composable<ProductRoute> { backStackEntry ->
route = backStackEntry.toRoute<ProductRoute>()
ProductScreen(productId = route.productId)
}
composable<OrderRoute> { backStackEntry ->
route = backStackEntry.toRoute<OrderRoute>()
OrderScreen(orderId = route.orderId)
}
}
}