Kotlin Specialist
Idiomatic Kotlin: coroutines, Flow, multiplatform, Compose, Ktor.
When to use
Coroutine concurrency; Flow stream handling; Kotlin Multiplatform (KMP) projects; Android with Jetpack Compose; Ktor servers; type-safe DSL design.
Core workflow
- Analyze — module/target layout (common/jvm/native), Gradle config.
- Design — sealed classes for state, data classes, interfaces.
- Implement — coroutines with structured concurrency; Flow for streams.
- UI / server — Compose state hoisting; or Ktor routes + plugins.
- Test —
runTest, Turbine for Flow, MockK; verify cancellation behavior.
Key practices
- Structured concurrency: scope-bound
launch/async; never GlobalScope.
suspend functions main-safe via withContext(Dispatchers.IO).
- Flow: cold streams,
flowOn for upstream dispatcher, collect in scope.
- Sealed classes/interfaces for exhaustive
when state machines.
- KMP: shared business logic in
commonMain, platform code via expect/actual.
- Compose: hoist state, remember, key stable; avoid recomposition pitfalls.
Constraints
MUST: structured concurrency (scoped); main-safe suspend functions; sealed types for state; exhaustive when; cancellation cooperation (ensureActive/isActive); test with runTest.
MUST NOT: GlobalScope; block in coroutines (Thread.sleep/blocking I/O on Main); swallow CancellationException; mutable shared state without sync; leak Android contexts.
Output
- Sealed/data model types. 2. Coroutine/Flow implementation. 3. Compose or Ktor wiring. 4. Tests. 5. Brief note on concurrency design.
Knowledge
Kotlin, coroutines, Flow/StateFlow/SharedFlow, structured concurrency, KMP (expect/actual), Jetpack Compose, Ktor, sealed classes, DSL builders, MockK, Turbine.
1---2name: kotlin-specialist3description: "Use when building Kotlin apps needing coroutine concurrency, Flow streams, Kotlin Multiplatform (KMP), Jetpack Compose UI, Ktor servers, or type-safe DSLs. Triggers: Kotlin, coroutines, Kotlin Multiplatform, KMP, Jetpack Compose, Ktor, Flow, Android Kotlin, suspend function, sealed classes."4version: 1.0.05license: MIT6tags: [kotlin, coroutines, flow, kmp, jetpack-compose, ktor, android, dsl]7source: https://github.com/jeffallan/claude-skills/tree/main/skills/kotlin-specialist8derived_from: awesomeclaude9metadata:10 source: https://skillmd.com/skills/aashutosh396/kotlin-specialist11---1213# Kotlin Specialist1415Idiomatic Kotlin: coroutines, Flow, multiplatform, Compose, Ktor.1617## When to use1819Coroutine concurrency; Flow stream handling; Kotlin Multiplatform (KMP) projects; Android with Jetpack Compose; Ktor servers; type-safe DSL design.2021## Core workflow22231. **Analyze** — module/target layout (common/jvm/native), Gradle config.242. **Design** — sealed classes for state, data classes, interfaces.253. **Implement** — coroutines with structured concurrency; Flow for streams.264. **UI / server** — Compose state hoisting; or Ktor routes + plugins.275. **Test** — `runTest`, Turbine for Flow, MockK; verify cancellation behavior.2829## Key practices3031- Structured concurrency: scope-bound `launch`/`async`; never `GlobalScope`.32- `suspend` functions main-safe via `withContext(Dispatchers.IO)`.33- Flow: cold streams, `flowOn` for upstream dispatcher, collect in scope.34- Sealed classes/interfaces for exhaustive `when` state machines.35- KMP: shared business logic in `commonMain`, platform code via `expect`/`actual`.36- Compose: hoist state, remember, key stable; avoid recomposition pitfalls.3738## Constraints3940MUST: structured concurrency (scoped); main-safe suspend functions; sealed types for state; exhaustive `when`; cancellation cooperation (`ensureActive`/`isActive`); test with `runTest`.41MUST NOT: `GlobalScope`; block in coroutines (`Thread.sleep`/blocking I/O on Main); swallow `CancellationException`; mutable shared state without sync; leak Android contexts.4243## Output44451. Sealed/data model types. 2. Coroutine/Flow implementation. 3. Compose or Ktor wiring. 4. Tests. 5. Brief note on concurrency design.4647## Knowledge4849Kotlin, coroutines, Flow/StateFlow/SharedFlow, structured concurrency, KMP (expect/actual), Jetpack Compose, Ktor, sealed classes, DSL builders, MockK, Turbine.