kotlin-coroutines-flows

Implement structured coroutine and Flow patterns for Kotlin Android and Multiplatform projects.

Updated May 9, 2026
One-click install
npx skills add https://github.com/kk20300113-png/my-claude-skills --skill kotlin-coroutines-flows-kk20300113-png
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-coroutines-flows
Source: https://github.com/kk20300113-png/my-claude-skills/tree/main/kotlin-coroutines-flows
Command: npx skills add https://github.com/kk20300113-png/my-claude-skills --skill kotlin-coroutines-flows-kk20300113-png

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the common pain points of writing unmaintainable, leak-prone asynchronous code in Kotlin Android and Kotlin Multiplatform projects, including improper coroutine scope management, unhandled flow emissions, and flaky async test execution.

Core Features & Use Cases

  • Structured Concurrency Patterns: Provides implementation patterns for proper scope hierarchy, parallel async decomposition with async/await, and supervisorScope for fault-tolerant sibling operations, eliminating GlobalScope related memory leaks.
  • Reactive Flow Management: Covers StateFlow/SharedFlow usage for UI state and one-time events, flow operators for debounce, retry, and stream combining, and cross-platform dispatcher configuration for Kotlin Multiplatform compatibility.
  • Coroutine Testing Utilities: Includes workflows for testing StateFlow with Turbine, implementing fake flow repositories, and configuring test dispatchers for reliable, deterministic async test execution.
  • Real-World Use Case: For example, use this Skill to build a search feature that debounces user input, retries failed API calls with exponential backoff, and updates UI state reactively without memory leaks or cancellation issues.

Quick Start

Use the kotlin-coroutines-flows skill to add a debounced, retry-enabled search flow with reactive UI state updates to your Android or KMP ViewModel.

Frequently Asked Questions about kotlin-coroutines-flows

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

FAQPage Schema
How do I prevent memory leaks when using Kotlin coroutines in Android?

Manage reactive UI state in Kotlin by using StateFlow for state exposure and SharedFlow for one-time events. This Skill delivers implementation patterns for StateFlow/SharedFlow usage, ensuring robust reactive UI state updates without unhandled flow emissions.

How do I test Kotlin coroutines and flows deterministically?

Test Kotlin coroutines and flows deterministically by configuring test dispatchers and using Turbine for StateFlow testing. This Skill provides workflows for implementing fake flow repositories and configuring test dispatchers to eliminate flaky async test execution.

What is the best way to handle retries and debouncing in a Kotlin Flow stream?

Handle retries and debouncing in a Kotlin Flow stream by applying flow operators for debounce, retry, and stream combining. This Skill covers reactive Flow stream implementation patterns, including exponential backoff for failed API calls and cross-platform dispatcher configuration.

Can I use Kotlin coroutines and flows for Kotlin Multiplatform projects?

You can use Kotlin coroutines and flows in Kotlin Multiplatform projects by configuring cross-platform dispatchers for compatibility. This Skill provides async patterns for structured concurrency, reactive Flow management, and parallel async operations tailored for KMP environments.