kotlin-concurrency-expert

Review Kotlin Coroutines usage for structured concurrency and lifecycle safety.

1|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/escorponox/musiharmony --skill kotlin-concurrency-expert-escorponox
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-concurrency-expert
Source: https://github.com/escorponox/musiharmony/tree/main/.claude/skills/kotlin-concurrency-expert
Command: npx skills add https://github.com/escorponox/musiharmony --skill kotlin-concurrency-expert-escorponox

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses common concurrency issues in Kotlin/Android development, ensuring robust, lifecycle-aware, and efficient asynchronous operations.

Core Features & Use Cases

  • Coroutine Review & Remediation: Analyzes and fixes bugs related to structured concurrency, thread safety, and lifecycle management.
  • Performance Improvement: Optimizes coroutine usage to prevent ANRs, memory leaks, and improve responsiveness.
  • Use Case: A developer is experiencing ANRs in their Android app due to blocking main thread operations. This Skill can identify the problematic code and refactor it to use appropriate dispatchers like Dispatchers.IO or Dispatchers.Default.

Quick Start

Review the provided Kotlin code snippet for coroutine lifecycle safety issues.

Frequently Asked Questions about kotlin-concurrency-expert

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

FAQPage Schema
How do I fix ANRs caused by blocking the main thread in Kotlin coroutines on Android?

To fix ANRs in Kotlin coroutines, you must move blocking operations off the main thread by injecting appropriate dispatchers like Dispatchers.IO or Dispatchers.Default. This ensures asynchronous operations do not block the Android UI thread.

How do I prevent memory leaks when collecting Kotlin coroutines in Android?

To prevent memory leaks with Kotlin coroutines, you need to use lifecycle-aware collection and proper scope management. This ensures that asynchronous operations are safely cancelled when the Android lifecycle component is destroyed.

What is structured concurrency in Kotlin and how does it manage coroutine lifecycles?

Structured concurrency in Kotlin is a design pattern that ties coroutine lifecycles to specific scopes, preventing memory leaks. It ensures parent scopes wait for child coroutines, enforcing cooperative cancellation and safe exception handling.

Why are my Kotlin coroutines causing race conditions and how can I resolve them?

Kotlin coroutines cause race conditions when asynchronous operations access shared state without proper thread management. You can resolve them by applying best practices for thread safety and dispatcher injection to synchronize concurrent data access.

Can I use this to review asynchronous code for safe exception handling in Kotlin Android apps?

Yes, you can review asynchronous Kotlin code to ensure safe exception handling for robust Android programming. It analyzes coroutine scopes and cooperative cancellation to remediate uncaught exceptions and prevent application crashes.

What are the limitations of using Dispatchers.Default for cooperative cancellation in Kotlin?

Using Dispatchers.Default for cooperative cancellation in Kotlin requires your coroutine code to periodically check for cancellation. If your asynchronous operations perform long-running blocking tasks without yielding, cooperative cancellation will fail and cause ANRs.