
Kotlin Coroutines Flows
Covers structured concurrency patterns, Flow operators, and testing strategies for Kotlin coroutines in Android and KMP projects. You'll reach for this when setting up StateFlow in ViewModels, handling parallel async work with coroutineScope and async, or debugging why your Flow collectors aren't behaving. The guidance on SharingStarted.WhileSubscribed with a 5-second timeout is solid for surviving config changes, and the anti-patterns section will save you from common mistakes like GlobalScope leaks or catching CancellationException. Includes practical examples for debouncing search, retry logic with exponential backoff, and testing with Turbine. The dispatcher advice for KMP is particularly relevant since Dispatchers.IO doesn't exist on all platforms.
- skills.sh installs
- 5.2K
- GitHub stars
- 229.1K
- last updated
- Jul 14, 2026
Install
$ npx -y skills add affaan-m/everything-claude-code --skill kotlin-coroutines-flows --agent claude-codeInstalls into .claude/skills of the current project.
Files
Kotlin Coroutines & Flows
Patterns for structured concurrency, Flow-based reactive streams, and coroutine testing in Android and Kotlin Multiplatform projects.
When to Activate
- Writing async code with Kotlin coroutines
- Using Flow, StateFlow, or SharedFlow for reactive data
- Handling concurrent operations (parallel loading, debounce, retry)
- Testing coroutines and Flows
- Managing coroutine scopes and cancellation
Structured Concurrency
Scope Hierarchy
Application
└── viewModelScope (ViewModel)
└── coroutineScope { } (structured child)
├── async { } (concurrent task)
└── async { } (concurrent task)
Always use structured concurrency — never GlobalScope:
// BAD
GlobalScope.launch { fetchData() }
// GOOD — scoped to ViewModel lifecycle
viewModelScope.launch { fetchData() }
// GOOD — scoped to composable lifecycle
LaunchedEffect(key) { fetchData() }
Parallel Decomposition
Use coroutineScope + async for parallel work:
Sponsors
Details
- Repository
- github.com/affaan-m/everything-claude-code
- Categories
- Mobile Development, Java & JVM
- First seen
- Apr 16, 2026
More from affaan-m/everything-claude-code
All 256- Swiftui Patterns5.2K
- Investor Materials5.1K
- Laravel Tdd5.1K
- Regex Vs Llm Structured Text5.1K
- Compose Multiplatform Patterns5K
- Continuous Agent Loop5K
- Foundation Models On Device5K
- Investor Outreach5K
- Kotlin Patterns5K
- Rust Patterns5K
- Swift Actor Persistence5K
- Swift Protocol Di Testing5K
- Bun Runtime4.9K
- Nextjs Turbopack4.9K
- Plankton Code Quality4.9K
- Swift Concurrency 6 24.9K
- Visa Doc Translate4.9K
- Ai Regression Testing4.8K
- Architecture Decision Records4.8K
- Blueprint4.8K
- Everything Claude Code Conventions4.8K
- Exa Search4.8K
- Kotlin Testing4.8K
- Customs Trade Compliance4.7K