kotlin-coroutines-flows

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

1|Updated May 12, 2026
One-click install
npx skills add https://github.com/Manvendra08/TradingBot --skill kotlin-coroutines-flows-manvendra08
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-coroutines-flows
Source: https://github.com/Manvendra08/TradingBot/tree/main/_agent/skills/kotlin-coroutines-flows
Command: npx skills add https://github.com/Manvendra08/TradingBot --skill kotlin-coroutines-flows-manvendra08

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the common pain points of writing unmaintainable, leaky asynchronous code in Kotlin Android and Kotlin Multiplatform projects, eliminating issues like memory leaks from unstructured coroutine scopes and unpredictable reactive stream behavior.

Core Features & Use Cases

  • Structured Concurrency Patterns: Implement proper coroutine scope hierarchies, parallel task decomposition, and supervisor scopes to avoid memory leaks and unhandled cancellations.
  • Flow Reactive Stream Management: Use StateFlow, SharedFlow, and core Flow operators for UI state, one-time events, debounced inputs, and retry logic.
  • Testing Support: Write reliable tests for coroutines and Flows using Turbine and TestDispatchers. Use case: For example, use this Skill to build a reactive dashboard ViewModel that loads user data and stats in parallel, handles debounced search input, and survives configuration changes without losing state or leaking coroutines.

Quick Start

Use the kotlin-coroutines-flows skill to implement a parallel data loading ViewModel with StateFlow UI state and retry logic for your Android application.

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

Prevent memory leaks in Kotlin coroutines by enforcing structured concurrency patterns. This involves implementing proper coroutine scope hierarchies and supervisor scopes to manage lifecycle events, ensuring unhandled cancellations are safely propagated without leaking contexts.

What is the best way to manage reactive UI state with Kotlin Flows?

Manage reactive UI state with Kotlin Flows by using StateFlow and SharedFlow. These core Flow operators handle UI state persistence and one-time events reliably, allowing your Android application to survive configuration changes without losing state.

How do I test Kotlin coroutines and Flows reliably?

Test Kotlin coroutines and Flows reliably by utilizing Turbine and TestDispatchers. These tools provide a controlled virtual time environment to verify reactive stream emissions, cooperative cancellation safety, and parallel data loading behavior.

Can I use Kotlin coroutines for parallel data loading in a Kotlin Multiplatform project?

Yes, you can use Kotlin coroutines for parallel data loading in a Kotlin Multiplatform project. The Skill enforces structured concurrency patterns to decompose parallel tasks and manage coroutine scope lifecycles across shared KMP codebases safely.

Why does my Android ViewModel lose coroutine state during configuration changes?

Your Android ViewModel loses coroutine state during configuration changes if coroutine scope lifecycle management is unstructured. Implementing StateFlow for UI state and proper scope hierarchies ensures data persists and coroutines do not leak during recreations.

How do I handle debounced user input and retry logic with reactive streams?

Handle debounced user input and retry logic with reactive streams by applying core Flow operators. Implementing these operators with proper error handling and retry logic ensures unpredictable reactive stream behavior is controlled during user input events.