kotlin-coroutines-flows

Manage asynchronous Kotlin code with structured concurrency and Flow-based state.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/sakamoto-family-smile/agent_monorepo --skill kotlin-coroutines-flows-sakamoto-family-smile
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-coroutines-flows
Source: https://github.com/sakamoto-family-smile/agent_monorepo/tree/main/.claude/skills/ecc/kotlin-coroutines-flows
Command: npx skills add https://github.com/sakamoto-family-smile/agent_monorepo --skill kotlin-coroutines-flows-sakamoto-family-smile

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Handles the complexity of asynchronous Kotlin code by providing proven patterns for structured concurrency, Flow-based streams, and reliable coroutine testing.

Core Features & Use Cases

  • Structured Concurrency management using viewModelScope and coroutineScope.
  • Flow-based reactive streams with StateFlow and SharedFlow for UI state and events.
  • Testing patterns for Flows, StateFlow, and coroutine-based logic with runTest and Turbine.

Quick Start

Start by replacing GlobalScope usage with structured scopes and introducing StateFlow to drive UI state.

Frequently Asked Questions about kotlin-coroutines-flows

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

FAQPage Schema
How do I manage structured concurrency with Kotlin coroutines in Android?

Manage structured concurrency by replacing GlobalScope with viewModelScope and coroutineScope to orchestrate asynchronous tasks. This ensures predictable cancellation and scoping within Android applications.

What is the best way to handle UI state with StateFlow in Kotlin?

Handle UI state with StateFlow by introducing it to drive reactive state streams that emit current values to consumers, ensuring consistent state management across configuration changes in Android apps.

How do I test Kotlin Flow streams and StateFlow logic?

Test Kotlin Flow streams and StateFlow logic using the runTest API for coroutine-based code and Turbine for Flow emissions to validate asynchronous state updates reliably without blocking threads.

Does Kotlin coroutine Flow work with Kotlin Multiplatform projects?

Kotlin coroutine Flow works with Kotlin Multiplatform projects to provide robust coroutine orchestration across shared modules, applying Flow operators and StateFlow for consistent asynchronous behavior.

Why does my Kotlin coroutine leak memory when using GlobalScope?

Kotlin coroutines leak memory when using GlobalScope because it lacks structured concurrency, keeping operations alive indefinitely; replacing GlobalScope with viewModelScope ensures proper cancellation and prevents leaks.