affaan-m avatar

Kotlin Coroutines Flows

This covers the bread and butter of async Kotlin: structured concurrency patterns, Flow operators, StateFlow for UI state, and testing with runTest and Turbine. You get practical examples of parallel decomposition with async/await, combining multiple flows for complex UI state, and one-time events with SharedFlow. The anti-patterns section is honest about common mistakes like GlobalScope leaks and collecting flows in init blocks. Most valuable for Android or KMP developers who've moved past basic launch/async and need patterns for real app state management, like handling debounced search, retries with backoff, or keeping upstream flows alive through configuration changes with WhileSubscribed.

skills.sh installs
5.9K
GitHub stars
300.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add affaan-m/ecc --skill kotlin-coroutines-flows --agent claude-code

Installs 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/ecc
Categories
Testing & QA, Debugging, Mobile Development, Java & JVM
First seen
Jul 14, 2026

More from affaan-m/ecc

All 263
1jeffallan avatarprompt-engineerjeffallan/claude-skillsWrites, refactors, and evaluates prompts for LLMs — generating optimized prompt templates, structured output schemas, evaluation rubrics, and test suites. Use w5.9Kskills.sh installs
2forcedotcom avataragentforce-architecture-analyzeforcedotcom/sf-skillsDeclared architecture snapshot for one Agentforce agent: planner, topics, actions, flows, Apex, prompt templates, and NGA plugins. Renders a human-readable arch5.9Kskills.sh installs
3affaan-m avatarui-demoaffaan-m/eccRecord polished UI demo videos using Playwright. Use when the user asks to create a demo, walkthrough, screen recording, or tutorial video of a web application.5.8Kskills.sh installs
4forcedotcom avataragentforce-observeforcedotcom/sf-skillsAnalyze production Agentforce agent behavior using session traces and Data Cloud. TRIGGER when: user queries STDM session data or Data Cloud trace records; inve5.8Kskills.sh installs
5getsentry avatarcode-reviewgetsentry/skillsPerform code reviews following Sentry engineering practices. Use when reviewing pull requests, examining code changes, or providing feedback on code quality. Co5.7Kskills.sh installs
6jeffallan avatarterraform-engineerjeffallan/claude-skillsUse when implementing infrastructure as code with Terraform across AWS, Azure, or GCP. Invoke for module development (create reusable modules, manage module ver5.7Kskills.sh installs