kotlin-specialist

Implement idiomatic Kotlin coroutine workflows with Flow and structured concurrency.

Updated Mar 5, 2026
One-click install
npx skills add https://github.com/Astrumon/Spovishun --skill kotlin-specialist-astrumon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-specialist
Source: https://github.com/Astrumon/Spovishun/tree/main/.claude/skills/kotlin-specialist
Command: npx skills add https://github.com/Astrumon/Spovishun --skill kotlin-specialist-astrumon

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps engineers write correct, idiomatic Kotlin for coroutine-driven asynchronous systems, reducing concurrency bugs, improper cancellation handling, and inconsistent dispatcher usage across a codebase.

Core Features & Use Cases

  • Coroutine correctness & structured concurrency: guidance on using scoped CoroutineScope, SupervisorJob, avoiding GlobalScope, using isActive checks, and always propagating CancellationException.
  • Reactive streams & testing: patterns for Cold Flow, StateFlow, and testing approaches using runTest and Turbine to validate stream behavior and cancellation.
  • Project conventions & tooling: recommendations for Gradle Kotlin DSL dependency management, Koin-based injection of CoroutineDispatcher, and enforced static checks using detekt and ktlint.
  • Spovishun-specific rules: dispatcher restrictions (only data/db/DatabaseFactory.kt may use Dispatchers.IO), TelegramBot SupervisorJob scope, and never hardcode Dispatchers.IO inside classes.

Quick Start

Ask the Kotlin Specialist to implement a suspend repository method that returns a Flow of user updates, injects a CoroutineDispatcher via Koin, and follows the project's dispatcher and cancellation rules.

Frequently Asked Questions about kotlin-specialist

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement structured concurrency with Kotlin coroutines and avoid GlobalScope?

Structured concurrency in Kotlin coroutines requires using scoped CoroutineScope and SupervisorJob instead of GlobalScope. You should implement isActive checks and always propagate CancellationException to ensure async processing cancels correctly when parent scopes clear.

What's the best way to test Kotlin Flow and suspend functions?

Testing Kotlin Flow and suspend functions requires using runTest and Turbine to validate stream behavior. This testing approach verifies StateFlow and Cold Flow streams properly handle cancellation and structured concurrency rules during asynchronous workflows.

How do I inject CoroutineDispatcher with Koin in a Kotlin project?

Inject CoroutineDispatcher with Koin by defining DI modules that provide dispatcher instances. Never hardcode Dispatchers.IO inside classes; restrict Dispatchers.IO usage to data/db/DatabaseFactory.kt for database layers to maintain proper async processing boundaries.

Why does my Kotlin coroutine cancellation not propagate correctly?

Coroutine cancellation fails when CancellationException is not properly propagated. Enforce structured concurrency by checking isActive within suspend functions and avoiding GlobalScope, which detaches async processing from parent scopes and breaks cancellation chains.

Can I use Gradle Kotlin DSL with detekt and ktlint static checks?

Gradle Kotlin DSL supports configuring detekt and ktlint static checks to enforce project conventions. Apply these tools to validate idiomatic Kotlin code, proper coroutine usage, and dispatcher restrictions across JVM and Kotlin projects.

Does this approach work for Telegram bot command handling with SupervisorJob?

Telegram bot command handling uses SupervisorJob scopes to manage structured concurrency. Suspend functions and Flow handle streaming updates, while CoroutineDispatcher injection via Koin ensures async processing follows dispatcher restrictions without hardcoding Dispatchers.IO.