No slash command · from kotlin-plugin
Tests Kotlin/JVM code with JUnit 5 or Kotest, MockK for mocking, coroutine/Flow testing with runTest and Turbine, Ktor testApplication, and Testcontainers integration tests.
Ships in kotlin-plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
| Signal in the build | Framework |
|---|---|
io.kotest:kotest-runner-junit5 | Kotest — mirror the spec style in neighbouring tests (FunSpec, StringSpec, BehaviorSpec, DescribeSpec) |
junit-jupiter (+ kotlin("test")) | JUnit 5 with kotlin.test assertions or AssertJ |
io.mockk:mockk | MockK for mocks (default for Kotlin) |
mockito-kotlin only | stay with Mockito — do not introduce MockK alongside it |
Tests live in src/test/kotlin, mirroring the main package; file names end in Test.kt (JUnit) or Spec.kt/Test.kt (Kotest, follow neighbours).
class CheckoutServiceTest {
private val repository = mockk<OrderRepository>()
private val service = CheckoutService(repository)
@Test
fun `places an order when the cart is not empty`() = runTest {
coEvery { repository.save(any()) } just Runs
val order = service.checkout(cartWith(sku = "A1", quantity = 2))
assertEquals(1, order.lines.size)
coVerify(exactly = 1) { repository.save(order) }
}
@Test
fun `rejects an empty cart`() = runTest {
assertFailsWith<EmptyCartException> { service.checkout(Cart.EMPTY) }
coVerify(exactly = 0) { repository.save(any()) }
}
}
@TestInstance(PER_CLASS) with mutable state).@ParameterizedTest + @CsvSource / @MethodSource.class CheckoutServiceSpec : FunSpec({
val repository = mockk<OrderRepository>()
val service = CheckoutService(repository)
beforeTest { clearMocks(repository) }
test("places an order when the cart is not empty") {
coEvery { repository.save(any()) } just Runs
service.checkout(cartWith(sku = "A1", quantity = 2)).lines shouldHaveSize 1
}
test("rejects an empty cart") {
shouldThrow<EmptyCartException> { service.checkout(Cart.EMPTY) }
}
})
runTest only for virtual-time control (or Kotest's coroutineTestScope = true).withData(...). Property tests (checkAll) only if the project already uses them.beforeTest, or use isolationMode = InstancePerTest if neighbours do.every { } / coEvery { } to stub, verify { } / coVerify { } to check; returns, throws, just Runs, answers { }.slot<Order>() + capture(slot).relaxed = true only for collaborators whose calls the test does not care about — never on the thing whose interaction you assert.mockkObject/mockkStatic are a smell — inject the dependency instead; if unavoidable, unmockkAll() in teardown.runTest { } (kotlinx-coroutines-test) skips delay with virtual time; advance with advanceTimeBy, advanceUntilIdle.CheckoutService(repository, io = StandardTestDispatcher(testScheduler)) — production code takes a CoroutineDispatcher parameter for this reason.java.time.Clock (or kotlinx.datetime.Clock) — use a fixed clock in tests.service.orderUpdates().test {
assertEquals(OrderStatus.PENDING, awaitItem().status)
assertEquals(OrderStatus.PAID, awaitItem().status)
cancelAndIgnoreRemainingEvents()
}
otherwise flow.take(n).toList().
@Test
fun `GET orders returns 401 without a token`() = testApplication {
application { module(testDependencies()) }
val response = client.get("/orders")
assertEquals(HttpStatusCode.Unauthorized, response.status)
}
ContentNegotiation on the test client (createClient { install(ContentNegotiation) { json() } }) and assert on decoded DTOs, not raw strings.PostgreSQLContainer, Kotest extension(...) or JUnit @Testcontainers) for real databases; run migrations before tests.@Tag("integration"), a dedicated source set or Gradle task) if the project does.fun order(id: OrderId = OrderId(UUID.randomUUID()), lines: List<OrderLine> = listOf(line())) = Order(id, lines, OrderStatus.PENDING).src/test/kotlin/.../fixtures or the testFixtures source set if configured../gradlew test # all tests
./gradlew test --tests '*Checkout*' # filter
./gradlew koverHtmlReport # Kover, if applied
./gradlew jacocoTestReport # JaCoCo, if applied
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
3 skills in this plugin
/kotlin-conventionsIdiomatic Kotlin for JVM projects: null safety without !!, val and read-only collections, data/sealed/value classes, exhaustive when, scope functions (let/apply/also/run/with) used sparingly, extension functions, default and named arguments, Result vs exceptions, collections vs sequences, Java interop annotations, package and file layout, Kotlin coding conventions. Stack-agnostic within Kotlin/JVM.
Use this skill to:
- Model domain types with data, sealed and value classes.
- Handle absence and errors explicitly and exhaustively.
- Keep code readable — no scope-function chains or clever one-liners.
- Interoperate with Java libraries without platform-type surprises.
Do NOT use this skill for:
- Coroutines and Flow (see kotlin-coroutines).
- Testing (see kotlin-testing).
- Gradle/Maven dependency management (see java-foundation:build-tooling).
/kotlin-coroutinesKotlin coroutines on the JVM: suspend functions, structured concurrency (coroutineScope, supervisorScope, application-owned scopes), dispatchers and blocking I/O, cancellation and CancellationException rules, timeouts, async/await parallelism, Flow (cold streams, operators, flowOn, StateFlow/SharedFlow), Ktor request coroutines, bridging callbacks and Java futures, dispatcher injection for tests.
Use this skill to:
- Write suspend APIs that are cancellable and do not block threads.
- Run independent work in parallel without leaking coroutines.
- Expose streams with Flow correctly.
- Keep coroutine code testable with injected dispatchers.
Do NOT use this skill for:
- General Kotlin idioms (see kotlin-conventions).
- Testing coroutines (see kotlin-testing — runTest, Turbine).
npx claudepluginhub aratkruglik/claude-sdlc --plugin kotlin-pluginOther plugins' skills for the same job