kotlin-coroutines-flows

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

2|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/Zenobia000/ai-brainstorming --skill kotlin-coroutines-flows-zenobia000
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-coroutines-flows
Source: https://github.com/Zenobia000/ai-brainstorming/tree/main/.claude/custom-rule%26skill/skills/kotlin-coroutines-flows
Command: npx skills add https://github.com/Zenobia000/ai-brainstorming --skill kotlin-coroutines-flows-zenobia000

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates common pitfalls of writing asynchronous Kotlin code for Android and Kotlin Multiplatform projects, such as memory leaks from unmanaged coroutines, buggy reactive stream handling, and flaky async tests, saving developers hours of debugging and refactoring.

Core Features & Use Cases

  • Structured Concurrency Patterns: Implement lifecycle-aware coroutine scopes, parallel task decomposition, and supervisor scopes to avoid GlobalScope leaks and manage concurrent operations safely.
  • Flow Reactive Stream Management: Build debounced search inputs, retry logic with exponential backoff, combined UI state streams, and one-time event handling with SharedFlow for production-ready apps.
  • Coroutine Testing Utilities: Write reliable, non-flaky tests for coroutines and Flows using Turbine and TestDispatcher to validate async behavior across different scenarios.
  • Use Case: A solo KMP developer building a cross-platform app can use this Skill to implement a shared data layer that loads user profile and content in parallel, handles network errors with retries, and exposes a single StateFlow for UI consumption on all platforms.

Quick Start

Use the kotlin-coroutines-flows skill to add a debounced search feature to your ViewModel that fetches results from a repository and updates the UI state safely without leaking coroutines.

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?

Prevent Kotlin coroutine memory leaks by implementing structured concurrency with lifecycle-aware coroutine scopes and supervisor scopes, ensuring concurrent operations are safely managed and canceled instead of relying on GlobalScope.

How to handle one-time events and UI state with Kotlin Flow?

Handle one-time events and UI state with Kotlin Flow by combining multiple streams into a single StateFlow for UI consumption, and dispatch specific transient occurrences using SharedFlow patterns.

What's the best way to write non-flaky tests for Kotlin coroutines and Flow?

Write non-flaky tests for Kotlin coroutines and Flow by utilizing TestDispatcher to control virtual time and employing Turbine to validate asynchronous reactive stream emissions across different test scenarios.

Can I use structured concurrency for parallel data loading in Kotlin Multiplatform?

You can use structured concurrency for parallel data loading in Kotlin Multiplatform by decomposing parallel tasks within shared scopes and applying cross-platform dispatcher usage to safely target KMP platforms.

How do I add retry logic with exponential backoff to a Kotlin Flow?

Add retry logic with exponential backoff to a Kotlin Flow by applying reactive stream error handling operators that intercept network failures and schedule automated delayed retries for production-ready apps.

How do I implement debounced user input processing in Kotlin?

Implement debounced user input processing in Kotlin by applying Flow operators to reactive stream patterns, which delays emission until user typing pauses, ensuring safe UI state updates without leaking coroutines.