一键导入
kotlin
Clean Architecture, project structure, and patterns for pure Kotlin modules.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Clean Architecture, project structure, and patterns for pure Kotlin modules.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Git Worktree: parallel working trees for isolated branch-level execution, debugging, and safe experimentation.
Durable project-memory rules for `.agent-memory/` plus session-memory boundaries.
Review routing, independent post-implementation review gates, multi-model escalation, and targeted optimization follow-up.
Planning-track selection, epic/feature decomposition, readiness gates, and plan-delta rules.
Architecture, Jetpack Compose, Navigation3 KMP, and Koin DI rules for Android apps.
Practical rules for designing, evolving, and integrating APIs safely.
| name | kotlin |
| description | Clean Architecture, project structure, and patterns for pure Kotlin modules. |
| user-invocable | false |
Use this skill for pure Kotlin or Kotlin Multiplatform modules where clean boundaries and testable async code matter.
When writing Kotlin business logic (Core/Domain modules):
UseCases (Interactors):
fun execute(): Result<T>.operator fun invoke.Result<T> (success or failure) to explicitly model outcomes.Helper or Manager MUST be injected into the UseCase, not the Repository.Repositories and DataSources:
User, List<Item>), NOT Result<T>. The UseCase handles error mapping into Result.interface.Dependency Graph:
UI/Component -> UseCase -> Repository -> DataSourcesuspend functions for one-shot async operations and Flow for streams of reactive data.Dispatchers.IO or Dispatchers.Default inside UseCases or Repositories. Pass them via constructor injection so they can be easily replaced with UnconfinedTestDispatcher in unit tests.coroutineScope and supervisorScope over GlobalScope. Never launch unmanaged coroutines.suspend function should be safe to call from any dispatcher (main-safe). If a function performs blocking I/O, it MUST shift its own execution context internally using withContext(dispatcher).CancellationException. If catching a generic Exception inside a coroutine, explicitly check and rethrow CancellationException to avoid breaking structured concurrency and memory leaks.CoroutineExceptionHandler exclusively for uncaught exceptions in root coroutines (launch). Note that it does NOT work for async (where exceptions are deferred until await()).run, also, apply, let). Only use them when they significantly improve readability.kotlinx.serialization over Jackson/Gson for multiplatform readiness.ContentNegotiation with kotlinx.serialization for JSON parsing. Define separate request/response DTOs rather than exposing domain models directly to the network layer.Result<T> from a UseCase must be mapped by the ViewModel/Component into a precise, UI-friendly Error State or a One-Time UI Event.build.gradle.kts).gradle/libs.versions.toml) for all dependencies and plugins.core (pure Kotlin, no framework dependencies) from framework-specific modules (like app, backend, android, etc.).