loom-kotlin
Installation
SKILL.md
Kotlin Language Expertise
Overview
Idiomatic, production-grade Kotlin 2.x on the JVM: null safety, data and sealed classes, coroutines with structured concurrency, Flow, Gradle Kotlin DSL builds, Ktor, Spring with Kotlin, and JUnit 5/kotest testing. Assumes the reader writes Kotlin already. The content is the part that goes wrong in production: runCatching swallowing cancellation, GlobalScope leaks, blocking calls on the wrong dispatcher, platform types from Java, final classes breaking Spring proxies.
Tooling
Gradle with the Kotlin DSL is the default build; the K2 compiler is the default since Kotlin 2.0. Use the wrapper (./gradlew) and keep versions in the catalog (gradle/libs.versions.toml).
| Task | Command |
|---|---|
| Full gate | ./gradlew check (tests plus detekt/ktlint when their plugins are applied) |
| Compile main and tests | ./gradlew testClasses |
| Unit tests | ./gradlew test |
| One test | ./gradlew test --tests 'com.acme.FooTest.bar' |
| Static analysis | ./gradlew detekt |
| Format | ./gradlew ktlintFormat (or spotlessApply with ktlint or ktfmt) |
| Dependency tree | ./gradlew dependencies --configuration runtimeClasspath |