kotlin-android
11
总安装量
7
周安装量
#28174
全站排名
安装命令
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-kotlin --skill kotlin-android
Agent 安装分布
opencode
6
codex
5
antigravity
5
gemini-cli
5
cursor
4
Skill 文档
Kotlin 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")