kotlin--androidlisted
Install: claude install-skill Claudient/Claudient
# Kotlin + Android
## When to activate
- Building Android apps with Jetpack Compose
- Setting up ViewModel with StateFlow or SharedFlow
- Configuring Room database (entity, DAO, database class)
- Integrating Retrofit for HTTP and Moshi/Gson for JSON
- Wiring dependency injection with Hilt
- Preparing a release for Google Play Store submission
## When NOT to use
- Cross-platform Flutter or React Native projects
- Android apps still using Views/XML layouts with no Compose involvement
- Kotlin Multiplatform (KMP) projects where Android is just one target
## Instructions
### Compose Recomposition Optimization
Recomposition reruns composable functions when their inputs change. Avoid unnecessary work:
**Use `remember` to cache computed values and objects across recompositions:**
```kotlin
@Composable
fun ExpensiveList(items: List<Item>) {
// Without remember — sorted on every recomposition
val sorted = items.sortedBy { it.name }
// With remember — re-sorts only when items reference changes
val sorted = remember(items) { items.sortedBy { it.name } }
LazyColumn {
items(sorted, key = { it.id }) { item ->
ItemRow(item)
}
}
}
```
**Use `derivedStateOf` for values derived from observable state to reduce recomposition frequency:**
```kotlin
@Composable
fun ScrollToTopButton(listState: LazyListState) {
// Without derivedStateOf — recomposes on every scroll pixel
val showButton = listState.firstVisibleItemIndex > 0