compose-kotlin-agent-skills
Enterprise Android/Kotlin skill for 2026 — Kotlin 2.x K2 compiler, AGP 9, Navigation 3, edge-to-edge Compose, strict MVI with atomic _state.update, banned AI antipatterns. Jetpack Compose, Hilt, Room, KMP, CameraX/ML Kit, performance, testing. Use when writing Kotlin for Android, building Compose UI, MVVM/MVI architecture, debugging recomposition, Room DAOs, Navigation 3, coroutines, or asking "structure Android app", "ViewModel UiState", "collectAsStateWithLifecycle", "edge to edge", "AGP 9", "K2 compiler", "Play Store release".
- License 许可
- MIT
- 最近更新
- 2026-06-15
- Stars
- ★ 2
- Forks
- 1
01 前言 Front Matter
- name
- compose-kotlin-agent-skills
- license
- MIT
- metadata
- { "author": "haidrrrry", "version": "2.2.0", "standard": "agentskills.io", "platforms": { "host": [ "macos", "linux", "windows" ], "target": [ "android", "kotlin-multiplatform", "compose-multiplatform" ], "agent_compatibility": 27 } }
- description
- Enterprise Android/Kotlin skill for 2026 — Kotlin 2.x K2 compiler, AGP 9, Navigation 3, edge-to-edge Compose, strict MVI with atomic _state.update, banned AI antipatterns. Jetpack Compose, Hilt, Room, KMP, CameraX/ML Kit, performance, testing. Use when writing Kotlin for Android, building Compose UI, MVVM/MVI architecture, debugging recomposition, Room DAOs, Navigation 3, coroutines, or asking "structure Android app", "ViewModel UiState", "collectAsStateWithLifecycle", "edge to edge", "AGP 9", "K2 compiler", "Play Store release".
02 资源文件 78
- 其他.gitattributes608 B
- 参考文档.github/ISSUE_TEMPLATE/bug_report.md953 B
- 参考文档.github/ISSUE_TEMPLATE/feature_request.md1018 B
- 参考文档.github/ISSUE_TEMPLATE/new_agent.md939 B
- 参考文档.github/pull_request_template.md1.5 KB
- 参考文档.github/workflows/skill-lint.yml2.0 KB
- 参考文档AGENTS.md6.7 KB
- 参考文档agents/_shared-snippet.md948 B
- 参考文档agents/aider.md1.1 KB
- 参考文档agents/amazon-q.md1.0 KB
- 参考文档agents/augment.md872 B
- 参考文档agents/bolt.md739 B
- 参考文档agents/claude.md897 B
- 参考文档agents/cline.md1.0 KB
- 参考文档agents/codex.md1.1 KB
- 参考文档agents/continue.md987 B
- 参考文档agents/copilot.md1.3 KB
- 参考文档agents/cursor.md1.2 KB
- 参考文档agents/deepseek.md948 B
- 参考文档agents/devin.md867 B
- 参考文档agents/factory.md891 B
- 参考文档agents/gemini.md1.2 KB
- 参考文档agents/goose.md907 B
- 参考文档agents/jetbrains-ai.md1.1 KB
- 参考文档agents/kimi.md994 B
- 参考文档agents/opencode.md814 B
- 参考文档agents/openhands.md924 B
- 参考文档agents/qwen-code.md760 B
- 参考文档agents/README.md2.1 KB
- 参考文档agents/replit.md926 B
- 参考文档agents/roo-code.md933 B
- 参考文档agents/sourcegraph-cody.md907 B
- 参考文档agents/tabnine.md942 B
- 参考文档agents/trae.md908 B
- 参考文档agents/windsurf.md992 B
- 参考文档agents/zed.md930 B
- 参考文档CHANGELOG.md4.4 KB
- 其他CITATION.cff582 B
- 参考文档CODE_OF_CONDUCT.md1.0 KB
- 其他examples/animated-clock/.gitkeep—
- 参考文档examples/animated-clock/README.md1.8 KB
- 其他examples/authenticator/.gitkeep—
- 参考文档examples/authenticator/README.md2.6 KB
- 参考文档examples/todo-mvi/README.md1.7 KB
- 其他examples/todo-mvi/TodoRepository.kt2.0 KB
- 其他examples/todo-mvi/TodoScreen.kt5.9 KB
- 其他examples/todo-mvi/TodoViewModel.kt4.1 KB
- 许可证LICENSE1.0 KB
- 参考文档marketing/medium-post.md9.8 KB
- 参考文档marketing/README.md1.7 KB
- 参考文档marketing/reddit-post.md4.8 KB
- 参考文档modules/README.md1.8 KB
- 参考文档README.md17.1 KB
- 参考文档references/.gitkeep—
- 参考文档references/00-banned-antipatterns.md3.1 KB
- 参考文档references/01-architecture.md13.2 KB
- 参考文档references/02-compose-ui.md13.5 KB
- 参考文档references/03-animations.md13.4 KB
- 参考文档references/04-coroutines-flow.md10.8 KB
- 参考文档references/05-hilt-di.md9.9 KB
- 参考文档references/06-room-db.md12.6 KB
- 参考文档references/07-navigation.md9.6 KB
- 参考文档references/08-kmp-cmp.md10.3 KB
- 参考文档references/09-networking.md9.9 KB
- 参考文档references/10-performance.md8.5 KB
- 参考文档references/11-testing.md9.6 KB
- 参考文档references/12-camera-mlkit.md9.5 KB
- 参考文档references/13-release-checklist.md8.2 KB
- 参考文档references/14-datastore.md5.8 KB
- 参考文档references/15-paging3.md7.9 KB
- 参考文档references/16-coil-image.md5.4 KB
- 参考文档references/17-accessibility.md5.1 KB
- 参考文档references/18-gradle-build-logic.md4.8 KB
- 参考文档references/19-xml-to-compose-migration.md6.5 KB
- 参考文档ROADMAP.md3.1 KB
- 脚本scripts/update_lock.sh416 B
- 脚本scripts/validate_skills.py14.2 KB
- 参考文档SECURITY.md890 B
03 SKILL.md 正文
Android & Kotlin — Enterprise Production Skill (2026)
Authoritative Android engineering kit. Real patterns from AnimatedClockJetpacl, Authenticator, RepLock.
Not an Android library, voice-assistant skill, on-device LLM SDK, or Compose UI library. This is markdown for coding AIs — clone into
.cursor/skills/or.claude/skills/. See README § "What this is NOT".
Meta index: AGENTS.md · CI: python3 scripts/validate_skills.py
Sub-Skills (Modular)
| Skill | Path | Scope |
|---|---|---|
| Architecture | skills/android-kotlin-architecture/SKILL.md |
MVI/MVVM, modules, UseCases, UDF |
| Compose UI | skills/android-kotlin-compose/SKILL.md |
UI, edge-to-edge, performance, motion |
| Testing | skills/android-kotlin-testing/SKILL.md |
Turbine, Compose tests, Hilt fakes |
2026 Toolchain — Non-Negotiable
| Tool | Minimum | Notes |
|---|---|---|
| Kotlin | 2.0+ (2.1.x) | K2 compiler only — no K1 fallback |
| AGP | 9.0+ | Built-in Kotlin, new DSL defaults |
| Compose BOM | 2025.05+ | Material 3, strong skipping default |
| Navigation | 3.x (2.9+ artifact) |
Type-safe NavKey, @Serializable routes |
| compileSdk / targetSdk | 35+ | Edge-to-edge mandatory |
| JDK | 17 | Required for AGP 9 |
[versions]
kotlin = "2.1.20"
agp = "9.0.0"
compose-bom = "2025.05.00"
navigation = "2.9.0"
room = "2.7.1"
hilt = "2.56.2"
lifecycle = "2.9.0"
coroutines = "1.10.2"
Kotlin 2.x / K2 Compiler Constraints
- Enable K2 —
kotlin.compiler.execution.strategydefault; usekspnotkaptfor Hilt/Room. - Smart casts — prefer
when (val x = state) { is Loaded -> ... }over unsafe!!. - Sealed hierarchy —
sealed interface UiState+data object Loading : UiStatefor exhaustivewhen. @JvmInline value classfor IDs (@JvmInline value class UserId(val raw: String)).@Immutable/@Stableon UiState and UI models passed to Compose.- Explicit API optional for libraries —
kotlin { explicitApi() }in published modules. - No
!!except in tests with comment — userequireNotNull/ early return. data classcopy for state — never mutate UiState fields in place.
sealed interface AccountsUiState {
data object Loading : AccountsUiState
data class Ready(
val accounts: List<AccountUi>,
val query: String = ""
) : AccountsUiState
data class Error(@StringRes val messageRes: Int) : AccountsUiState
}
MVI Guardrails — Atomic State Only
Allowed mutation: _state.update { it.copy(...) } or _state.update { prev -> ... }.
Banned in ViewModel:
// BANNED
_state.value = AccountsUiState(...) // naked assign
_state.value.accounts.add(item) // mutating list inside state
mutableStateOf / mutableStateListOf in VM // Compose scope only
viewModelScope.launch { _state.value = ... } // use update inside launch
Required pattern:
class AccountsViewModel @Inject constructor(
private val repository: AccountsRepository
) : ViewModel() {
private val _state = MutableStateFlow<AccountsUiState>(AccountsUiState.Loading)
val state: StateFlow<AccountsUiState> = _state.asStateFlow()
private val _effects = Channel<AccountsEffect>(Channel.BUFFERED)
val effects: Flow<AccountsEffect> = _effects.receiveAsFlow()
fun onEvent(event: AccountsEvent) {
when (event) {
AccountsEvent.Refresh -> refresh()
is AccountsEvent.QueryChanged -> _state.update { current ->
when (current) {
is AccountsUiState.Ready -> current.copy(query = event.query)
else -> current
}
}
}
}
private fun refresh() {
viewModelScope.launch {
_state.update { AccountsUiState.Loading }
repository.load()
.onSuccess { list ->
_state.update { AccountsUiState.Ready(accounts = list.map { it.toUi() }) }
}
.onFailure {
_state.update { AccountsUiState.Error(R.string.error_load_failed) }
}
}
}
}
UI collects:
@Composable
fun AccountsRoute(vm: AccountsViewModel = hiltViewModel()) {
val state by vm.state.collectAsStateWithLifecycle()
LaunchedEffect(Unit) {
vm.effects.collect { effect -> /* one-shot: nav, snackbar */ }
}
AccountsScreen(state = state, onEvent = vm::onEvent)
}
Navigation 3 + Edge-to-Edge
@Serializable data object Home
@Serializable data class Detail(val id: String)
@Composable
fun AppNavHost(navController: NavHostController = rememberNavController()) {
NavHost(navController, startDestination = Home) {
composable<Home> { HomeScreen(onOpen = { navController.navigate(Detail(it)) }) }
composable<Detail> { entry ->
val route = entry.toRoute<Detail>()
DetailScreen(id = route.id)
}
}
}
- Routes =
@Serializabletypes, not string paths - Pass IDs in nav args — fetch models in destination ViewModel
enableEdgeToEdge()in Activity — see compose sub-skill
Deep dive: references/07-navigation.md
Banned Antipatterns — AI Hallucination Lookup
Full table with WRONG/RIGHT pairs and row numbers: references/00-banned-antipatterns.md
Load before reviewing any agent-generated Kotlin. Compose audit checklist: skills/android-kotlin-compose/SKILL.md § REVIEW MODE.
Reference Routing
| File | Topic |
|---|---|
references/00-banned-antipatterns.md |
Master banned table — load first for reviews |
references/01-architecture.md |
Clean Arch, MVVM, modules |
references/02-compose-ui.md |
Composition, M3, theming |
references/03-animations.md |
Motion, Canvas |
references/04-coroutines-flow.md |
Flow, errors, cancellation |
references/05-hilt-di.md |
DI, scopes |
references/06-room-db.md |
Room, offline-first |
references/07-navigation.md |
Nav 3, deep links |
references/08-kmp-cmp.md |
KMP, expect/actual |
references/09-networking.md |
Ktor, JWT |
references/10-performance.md |
Recomposition, Coil, profiles |
references/11-testing.md |
Turbine, UI tests |
references/12-camera-mlkit.md |
CameraX, pose |
references/13-release-checklist.md |
R8, Play Store |
references/14-datastore.md |
DataStore, SP migration, encryption |
references/15-paging3.md |
Paging 3, RemoteMediator, asState() |
references/16-coil-image.md |
Coil 3.4, AsyncImage, cache |
references/17-accessibility.md |
TalkBack, semantics, WCAG |
references/18-gradle-build-logic.md |
Convention plugins, KSP, R8, baseline profiles |
references/19-xml-to-compose-migration.md |
XML → Compose, RxJava → Flow |
Platforms
Target (what the docs teach): Android · Kotlin Multiplatform · Compose Multiplatform
Host (where the docs are read): macOS · Linux · Windows — anywhere your AI agent runs
Agent compatibility: 27 install guides → agents/README.md
Repo: https://github.com/haidrrrry/compose-kotlin-agent-skills
Mandatory Defaults (Summary)
- Strings:
stringResource/@StringRes— zero hardcoded UI text - State: ViewModel
StateFlow+_state.update { } - UI: Stateless composables,
modifierfirst optional param - Lists:
LazyColumn+ keys +contentType - DI:
@HiltViewModel+ constructor inject - Tests: Fakes + Turbine — see testing sub-skill
Validation Before PR
python3 scripts/validate_skills.py --strict
Anti-Rationalizations
| Excuse | Reality |
|---|---|
| "UiState overkill" | data object Loading costs one line |
| "Keys later" | Broken scroll/focus NOW |
| "Prototype skip repo" | Prototypes ship |
| "collectAsState fine" | Background collector drains battery |
Examples
| Path | Patterns |
|---|---|
examples/animated-clock/ |
Canvas, rotate(), particles |
examples/authenticator/ |
Room Flow, combine, CompositionLocal theme |
04 同仓库更多 Skills
solana-dev
Use when user asks to "build a Solana dapp", "write an Anchor program", "create a token", "debug Solana errors", "set up wallet connection", "test my Solana program", "deploy to devnet", or "explain Solana concepts" (rent, accounts, PDAs, CPIs, etc.). End-to-end Solana development playbook covering wallet connection, Anchor/Pinocchio programs, Codama client generation, LiteSVM/Mollusk/Surfpool testing, and security checklists. Integrates with the Solana MCP server for live documentation search. Prefers framework-kit (@solana/client + @solana/react-hooks) for UI, wallet-standard-first connection (incl. ConnectorKit), @solana/kit for client/RPC code, and @solana/web3-compat for legacy boundaries.
generating-trading-signals
Generate trading signals using technical indicators (RSI, MACD, Bollinger Bands, etc.). Combines multiple indicators into composite signals with confidence scores. Use when analyzing assets for trading opportunities or checking technical indicators. Trigger with phrases like "get trading signals", "check indicators", "analyze for entry", "scan for opportunities", "generate buy/sell signals", or "technical analysis".
prediction-monitor
Prediction Monitor - Auto-activating skill for ML Deployment. Triggers on: prediction monitor, prediction monitor Part of the ML Deployment skill category.
strategy-advisor
High-level strategic thinking and business decision guidance for planning and direction-setting. Use when: making strategic decisions, evaluating business options, setting direction, analyzing trade-offs, or when user mentions strategy, business planning, competitive analysis, or long-term planning.
app-paywall-pilot
Design, audit, debug, and implement App Store-compliant mobile paywalls, subscription flows, pricing screens, trials, offers, feature gates, and subscription lifecycle UX. Use when the user asks to audit my paywall, fix App Store 3.1.2 rejection, improve trial-to-paid, choose plans/prices/trials, review RevenueCat/Adapty/Apphud/Superwall setup, calculate LTV/ROAS, or build paywall implementation.
figma
Use the Figma MCP server to fetch design context, screenshots, variables, and assets from Figma, and to translate Figma nodes into production code. Trigger when a task involves Figma URLs, node IDs, design-to-code implementation, or Figma MCP setup and troubleshooting.