kotlin-coroutines-flows

Implement structured concurrency and Flow patterns for Kotlin asynchronous programming.

1|Updated Mar 8, 2026
One-click install
npx skills add https://github.com/vinitgirdhar/GRID_ --skill kotlin-coroutines-flows-vinitgirdhar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-coroutines-flows
Source: https://github.com/vinitgirdhar/GRID_/tree/main/.agent/skills/kotlin-coroutines-flows
Command: npx skills add https://github.com/vinitgirdhar/GRID_ --skill kotlin-coroutines-flows-vinitgirdhar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Kotlin developers often struggle to implement robust, asynchronous logic across Android and Kotlin Multiplatform projects. This skill provides structured concurrency patterns, Flow-based reactive streams, and testing guidance to reduce boilerplate and debugging time.

Core Features & Use Cases

  • Structured concurrency patterns for scope management, cancellation, and error handling.
  • Flow operator usage (map, flatMap, combine) and StateFlow/SharedFlow for UI state and events.
  • End-to-end guidance for testing coroutines and Flows, including test dispatchers and fake repositories.
  • Practical examples across Android and multiplatform targets to demonstrate reliable async workflows.

Quick Start

Create a small Kotlin snippet that demonstrates launching a coroutine, emitting values with Flow, and collecting them in a 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 implement structured concurrency and manage coroutine scopes in Kotlin?

Structured concurrency in Kotlin requires binding coroutine launches to a specific scope to ensure cancellation and error handling. This skill provides patterns for scope management, ensuring async workflows do not leak or crash unexpectedly.

What is the best way to use StateFlow and SharedFlow for UI state in Android?

StateFlow and SharedFlow expose reactive streams for UI state and events in Android. This skill specifies patterns for their usage alongside Flow operators like map and combine to handle state emissions reliably.

How do I test Kotlin coroutines and Flows with fake repositories?

Testing Kotlin coroutines and Flows requires using test dispatchers to control virtual time and fake repositories to isolate dependencies. This skill outlines end-to-end strategies for validating async logic.

Can I use these Kotlin coroutine and Flow patterns in Kotlin Multiplatform projects?

Yes, these Kotlin coroutine and Flow patterns apply directly to Kotlin Multiplatform projects. The guidance covers structured concurrency, dispatchers, and reactive streams across multiplatform targets.

Why does my Kotlin Flow cancellation not work properly during collection?

Flow cancellation fails when structured concurrency rules are ignored or dispatchers are misconfigured. This skill details cancellation patterns and dispatcher usage to ensure async workflows terminate correctly.