About kotlin-android
kotlin-android is a skill for Android development with Jetpack libraries. It covers MVVM, Compose UI, type-safe navigation, and troubleshooting common issues.
Key features
- 01MVVM pattern examples
- 02Compose UI examples
- 03Type-safe navigation
- 04Compose recomposition troubleshooting
- 05ViewModel recreation troubleshooting
Use cases
- 01Build an Android app using MVVM
- 02Create interfaces with Compose
- 03Implement type-safe app navigation
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ pluginagentmarketplace/ custom-plugin-kotlin --skill kotlin-androidAfter installing, type/kotlin-androidin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
assets/config.yamlschema.jsonreferences/GUIDE.mdPATTERNS.mdscripts/validate.pyDetails
From the project READMEKotlin Android Skill
Production-ready Android development with Jetpack libraries.
Topics Covered
MVVM Pattern
@HiltViewModel
class UserViewModel @Inject constructor(
private val repository: UserRepository
) : ViewModel() {
private val _uiState = MutableStateFlow(UiState())
val uiState = _uiState.asStateFlow()
fun load() = viewModelScope.launch {
_uiState.update { it.copy(isLoading = true) }
repository.getUsers()
.onSuccess { users -> _uiState.update { it.copy(users = users, isLoading = false) } }
}
}
Compose UI
@Composable
fun UserScreen(viewModel: UserViewModel = hiltViewModel()) {
val state by viewModel.uiState.collectAsStateWithLifecycle()
UserContent(state)
}
Type-Safe Navigation
@Serializable
data class ProfileRoute(val userId: String)
composable<ProfileRoute> { entry ->
val route: ProfileRoute = entry.toRoute()
}
Troubleshooting
| Issue | Resolution |
|---|---|
| Recomposition loop | Mark class @Stable or use derivedStateOf |
| ViewModel recreated | Use hiltViewModel() not viewModel() |
Usage
Skill("kotlin-android")
Comments
Markdown supported