一键导入
kotlin-patterns
Idiomatic Kotlin: null safety, immutability, sealed types, structured concurrency, extension functions, DSL builders, Gradle Kotlin DSL
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Idiomatic Kotlin: null safety, immutability, sealed types, structured concurrency, extension functions, DSL builders, Gradle Kotlin DSL
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Flyway-migrasjoner for PostgreSQL: navnekonvensjoner (V{n}__desc.sql), skjema for krav/feilmelding/filvalideringsfeil, DBListener-testing med TestContainers
Post-send livssyklus: StatusService poller /mottaksstatus; StoppKravService; RapportService + AvstemmingRouting-frontend for manuell reskontroføring
HOCON-basert konfigurasjon med PropertiesConfig singleton for Ktor batch-tjenester på NAIS (FSS)
SlackService feilakkumulering og Tags-basert varsling for prosesseringsfeil i SKE-batch
Endring av eksisterende krav (endre rente og endre hovedstol): EndreKravService, request-DTOer, status-konformering og SKE API PUT-endepunkter
Kotest BehaviorSpec/MockK-mønstre for sokos-ske-krav: scenariostruktur, DBListener/SftpListener, MockHttpClient, circuit-breaker-reset og matchers
| name | kotlin-patterns |
| description | Idiomatic Kotlin: null safety, immutability, sealed types, structured concurrency, extension functions, DSL builders, Gradle Kotlin DSL |
Idiomatic conventions for this codebase. Detailed examples live in the sub-files — load them on demand.
| Idiom | Use for |
|---|---|
val over var | Default; prefer immutability |
data class / copy() | Value objects with equals/hashCode and non-destructive updates |
sealed class/interface | Restricted type hierarchies (state, results) |
value class | Zero-overhead type-safe wrappers |
Expression when | Exhaustive pattern matching |
?. / ?: / requireNotNull | Null-safe access; avoid !! without a justified check |
let / run / apply / also / with | Scope functions for locality and readability |
| Extension functions | Add behaviour without inheritance |
require / check | Preconditions for public API |
suspend + coroutineScope / async | Structured concurrency |
Flow | Cold reactive streams |
sequence | Lazy evaluation over collections |
Delegation by | Reuse without inheritance |
@DslMarker), Gradle Kotlin DSL?, ?., ?:)sealed for modeled statesuspend + structured concurrency for asyncktlintFormat before committingrunBlocking in production codeGlobalScope.launch!! without a preceding null check