kotlin-coroutines-flows

Provides Kotlin structured concurrency and Flow patterns for asynchronous programming.

Updated Mar 20, 2026
One-click install
npx skills add https://github.com/KanakMalpani/General-Private-Skills --skill kotlin-coroutines-flows-kanakmalpani
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-coroutines-flows
Source: https://github.com/KanakMalpani/General-Private-Skills/tree/main/skills/kotlin-coroutines-flows
Command: npx skills add https://github.com/KanakMalpani/General-Private-Skills --skill kotlin-coroutines-flows-kanakmalpani

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers building Android or multiplatform applications often struggle to implement reliable asynchronous patterns. This skill consolidates Kotlin Coroutines and Flow usage to help you write structured, testable, and responsive code.

Core Features & Use Cases

  • Structured concurrency guidance using viewModelScope, coroutineScope, and supervisorScope.
  • Flow patterns: cold Flow, StateFlow, SharedFlow with practical examples for UI state and event streams.
  • Testing approaches for Flows and coroutines, including common testing strategies and test doubles.
  • Real-world scenario: implement a responsive dashboard that loads data concurrently and handles cancellation.

Quick Start

Run a small sample that demonstrates launching coroutines and collecting a Flow in a ViewModel to observe UI state updates.

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 StateFlow and coroutines in Android?

Manage UI state with StateFlow by launching coroutines within viewModelScope to expose reactive data streams. This skill provides structured concurrency patterns using StateFlow and SharedFlow to handle UI state updates and event streams reliably.

How do I test Kotlin Flow patterns and coroutines?

Test Kotlin Flow patterns and coroutines using structured testing strategies and test doubles provided by this skill. It covers reliable testing approaches for cold Flow, StateFlow, and asynchronous cancellation handling to ensure responsive code stability.

What is the best way to handle structured concurrency in Kotlin Multiplatform projects?

The best way to handle structured concurrency in Kotlin Multiplatform projects is using coroutineScope and supervisorScope. This skill simplifies asynchronous programming by enforcing scope rules and cancellation handling across multiplatform and backend services.

Why does my Kotlin coroutine cancellation not stop the Flow collection?

Kotlin coroutine cancellation may fail to stop Flow collection if scope rules are not properly applied. This skill addresses cancellation handling constraints and provides Flow operator patterns to ensure structured concurrency and reliable cancellation.

Can I use Kotlin Flow operators for concurrent data loading in backend services?

Yes, you can use Kotlin Flow operators for concurrent data loading in backend services. This skill demonstrates reactive data stream patterns and real-world scenarios like building a responsive dashboard that loads data concurrently and handles cancellation.

When do I need to use SharedFlow instead of StateFlow for event streams?

You need to use SharedFlow instead of StateFlow when managing event streams rather than UI state. This skill clarifies Flow patterns, distinguishing cold Flow, StateFlow, and SharedFlow usage with practical examples for reactive data streams.