kotlin-coroutines

Installation
SKILL.md

Kotlin Coroutines

Treat cancellation, ownership, and lifecycle as public contracts, not implementation details.

Core rules

  • Every launched coroutine must have an owner whose lifetime is explicit. Avoid GlobalScope.
  • Prefer coroutineScope for fail-together work and supervisorScope only when sibling failure isolation is required by contract.
  • Re-throw CancellationException; broad exception handlers must not consume cancellation.
  • Move blocking calls to an appropriate dispatcher or replace them with cancellable asynchronous APIs.
  • Do not expose a cold Flow as if it were shared state. Choose cold Flow, StateFlow, or SharedFlow from subscriber and replay semantics.
  • Bound channels and queues. Define overflow, fairness, ordering, and shutdown behavior.
  • Preserve context intentionally; do not pass request-scoped mutable state through globals or thread locals.
  • Make cleanup run on success, failure, timeout, and cancellation. Use finally and cancellable resource APIs.

Review sequence

Installs
3
First Seen
13 days ago
kotlin-coroutines — full-stack-skills/kotlin-skills