kotlin-coroutines-structured-concurrency

Enforce structured concurrency and correct suspend-scope boundaries in Kotlin coroutine code.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/soygabimoreno/Los-ANDROIDES --skill kotlin-coroutines-structured-concurrency
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-coroutines-structured-concurrency
Source: https://github.com/soygabimoreno/Los-ANDROIDES/tree/main/.agents/skills/kotlin-coroutines-structured-concurrency
Command: npx skills add https://github.com/soygabimoreno/Los-ANDROIDES --skill kotlin-coroutines-structured-concurrency

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps you prevent subtle Kotlin coroutine issues caused by unowned CoroutineScopes, hidden launch sites, incorrect cancellation handling, and unsafe blocking primitives that lead to silent failures or broken cancellation propagation.

Core Features & Use Cases

  • Structured concurrency review guidance: Identify patterns like stored CoroutineScope, construction-time launches, and fire-and-forget launches from non-UI layers.
  • Cancellation-safe error handling: Detect and correct broad catches (e.g., Exception/Throwable) that swallow CancellationException, and ensure cancellation rethrows correctly.
  • Boundary-correct coroutine design: Use suspend APIs so callers own scopes, and apply the UI boundary carve-out only at state-holder layers like ViewModels.

Quick Start

Use this skill when reviewing Kotlin coroutine code and you notice a stored CoroutineScope, an init/initializer launch, a non-suspending function that calls scope.launch, a runBlocking in app code, or a catch that might swallow cancellation.

Frequently Asked Questions about kotlin-coroutines-structured-concurrency

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

FAQPage Schema
How do I fix silent failures in Kotlin coroutines?

Silent failures in Kotlin coroutines are fixed by enforcing structured concurrency and detecting hidden launch sites like stored CoroutineScope or construction-time launches. Move async work into suspend APIs so callers own the scope and failures surface correctly.

What is the correct way to replace runBlocking in app code?

The correct way to replace runBlocking in app code is using runTest or appropriate suspend boundaries instead. runBlocking creates unsafe blocking bridges, while suspend APIs allow caller-owned scopes to maintain correct cancellation semantics.

How do I review Kotlin code for structured concurrency issues?

Review Kotlin code for structured concurrency issues by checking for stored CoroutineScope, init block launches, and non-suspending APIs that call scope.launch. Ensure UI boundary carve-outs only exist at state-holder layers like ViewModels.

Can I launch a coroutine from a non-suspending function?

Launching a coroutine from a non-suspending function creates unowned fire-and-forget work that breaks structured concurrency. You should move async work into suspend APIs so the caller owns the CoroutineScope and cancellation propagates correctly.

When should I not use a stored CoroutineScope in Kotlin?

You should not use a stored CoroutineScope in Kotlin when it allows hidden launch sites to bypass structured concurrency. Stored scopes cause silent failures and broken cancellation semantics by detaching async work from the caller's lifecycle.