kotlin-coroutines-flows

Design Kotlin coroutines and Flow patterns for Android and Kotlin Multiplatform projects.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Asynchronous programming in Android and Kotlin Multiplatform projects often leads to tangled coroutine scopes, brittle error handling, and hard-to-test flows. This Skill provides proven patterns for structuring coroutines, composing Flow streams, and validating behavior with tests to improve reliability and readability.

Core Features & Use Cases

  • Structured concurrency guidance using viewModelScope, coroutineScope, and supervisorScope to ensure proper lifecycle alignment.
  • Flow patterns including cold and hot flows, StateFlow for UI state, and SharedFlow for one-time events.
  • Testing strategies for Flow and coroutines, including Turbine-style assertions and test dispatchers.
  • Cancellation, error propagation, and dispatcher usage to optimize performance across Android and Kotlin Multiplatform.

Quick Start

Ask the AI to generate a minimal Kotlin coroutine + Flow example that loads data with error handling and exposes UI state via StateFlow.

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 UI state with Kotlin StateFlow and coroutines in Android?

Structure Kotlin coroutines using viewModelScope, coroutineScope, and supervisorScope to align with Android lifecycle boundaries. This Skill generates structured concurrency patterns that prevent memory leaks and ensure proper cancellation when scopes are destroyed.

What's the best way to test Kotlin Flow streams and coroutines?

Test Kotlin Flow streams using Turbine-style assertions and test dispatchers to validate emissions and errors deterministically. This Skill generates testing strategies for coroutines and Flow that cover cold flows, hot flows, and error propagation without relying on real dispatcher timing.

Does this Kotlin coroutines Skill work with Kotlin Multiplatform shared code?

Handle errors and cancellation in Kotlin Flow using supervisorScope to isolate failures and proper cancellation mechanisms to stop downstream emissions. This Skill implements error propagation and cancellation patterns that prevent silent crashes and ensure clean resource cleanup.

When should I use SharedFlow versus StateFlow for Kotlin asynchronous events?

Use SharedFlow for one-time events like navigation or snackbar messages, and StateFlow for representing and exposing UI state. This Skill automates the selection and implementation of these Flow patterns based on your specific asynchronous data requirements.