kotlin-android
БесплатноБез исполняемых скриптовНе проверенUse when building or fixing a native Android app in Kotlin and Jetpack Compose on the UDF layered architecture — ViewModel/StateFlow, Hilt, Room, Retrofit…
от lza6★ 19 звёзд на GitHubОб этом скилле
Native Android with Kotlin & Compose
You build production native Android: Kotlin + Jetpack Compose + the UDF layered architecture (UI → domain → data). One rule governs everything: state flows down, events flow up, and there is exactly one source of truth per piece of state. Get that rule right and recomposition, rotation, and testing fall into place; break it and you get a screen that compiles but recomposes every frame, leaks coroutine scopes, blocks the main thread, or drops state on rotation.
This skill exists to stop the agent from reaching for the 2015 playbook — XML layouts,
findViewById, AsyncTask, LiveData inside Compose, GlobalScope.launch, MutableState
exposed straight out of a ViewModel. Emit a buildable, idiomatic module, not a toy.
Versions floor (2026)
These are floors verified against current docs (2026-06). Re-check the matrix before locking — Compose and AGP move together and a mismatch fails the build.
| Piece | Floor | Why it matters |
|---|---|---|
| Kotlin (KGP) | 2.2.x | K2 compiler is default & Stable; KGP must align with AGP. |
| AGP | 9.2+ when using Compose | Compose's compileSdk 37 requires AGP ≥ 9.2.0. |
| compileSdk | 37 | Current Compose target. |
| minSdk | 24 | Practical modern floor (~99% devices); Compose technically supports 21+. |
| JDK (build) | 17 | Required by current AGP/Compose toolchain. |
| Compose BOM | 2026.05.01 → Compose 1.11.2 | Pin artifacts via the BOM, never per-artifact versions. |
| Navigation | 2.8+ | Type-safe @Serializable routes land here. |
| Hilt + Room + Retrofit | current | DI / persistence / network. Wire Room & Hilt with KSP, not kapt. |
| Serialization | kotlinx.serialization | Retrofit converter + Navigation route types. |
The architecture in one screen
Three layers. Higher layers depend on lower; never the reverse.
UI layer Composable (stateless) ── reads ──> UiState
│ events up ▲ state down
ViewModel exposes StateFlow<UiState> │
│ calls
domain layer (optional) UseCase — only when logic spans repos or is reused
│ calls
data layer Repository (interface in domain, impl here)
├── Room DAO → Flow (single source of truth)
└── Retrofit → suspend (refreshes the source of truth)
- UI is dumb: render
UiState, send events. No business logic in a@Composable. - domain is optional: add use-cases only when a screen needs logic from >1 repository.
- data owns truth: the repository decides; Room is the cache that the UI observes.
Offline-first means Room is the source of truth. The network writes into Room; the UI
observes Room's Flow. WorkManager does background sync. The UI never reads the network
directly.
State & recomposition
Each rule has a one-line reason.
- Hoist state. A composable that owns mutable state can't be reused or previewed — pass state in, send events out.
remembersurvives recomposition;rememberSaveablesurvives rotation/process death. UserememberSaveablefor anything the user would be annoyed to lose (scroll, input).derivedStateOffor computed state — recomputes only when its inputs change, not every recomposition.key()/ stable keys inLazyColumn— without a stable item key, reorder/insert churns the whole list.- Business logic never lives in a
@Composable— composables run on every recomposition.
// Bad — logic + I/O in the composable; runs on every recomposition.
@Composable
fun ArticlesScreen(repo: ArticleRepository) {
val articles = runBlocking { repo.fetch() } // blocks UI thread, refetches constantly
LazyColumn { items(articles) { Text(it.title) } }
}
// Good — stateless UI driven by hoisted state; logic in the ViewModel.
@Composable
fun ArticlesScreen(state: ArticlesUiState, onRetry: () -> Unit) {
when (state) {
ArticlesUiState.Loading -> CircularProgressIndicator()
is ArticlesUiState.Error -> ErrorView(state.message, onRetry)
is ArticlesUiState.Success ->
LazyColumn { items(state.articles, key = { it.id }) { Text(it.title) } }
}
}
ViewModel + UI state
Model the screen as a sealed UiState so impossible states (loading and error) can't
exist. Expose it as StateFlow, never a mutable type.
sealed interface ArticlesUiState {
data object Loading : ArticlesUiState
data class Success(val articles: List<Article>) : ArticlesUiState
data class Error(val message: String) : ArticlesUiState
}
@HiltViewModel
class ArticlesViewModel @Inject constructor(
repository: ArticleRepository,
) : ViewModel() {
val uiState: StateFlow<ArticlesUiState> =
repository.observeArticles()
.map<List<Article>, ArticlesUiState> { ArticlesUiState.Success(it) }
.catch { emit(ArticlesUiState.Error(it.message ?: "
Установить kotlin-android в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл kotlin-android?
Use when building or fixing a native Android app in Kotlin and Jetpack Compose on the UDF layered architecture — ViewModel/StateFlow, Hilt, Room, Retrofit, coroutines, type-safe Navigation, and the Gradle/AGP surface. NOT shared Android and iOS UI from one Kotlin codebase (that is `compose-multiplatform`).
Как установить скилл kotlin-android?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл kotlin-android запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic