android-coroutines-pro
Skill8 starsChanged 12 days agoMITView on GitHub
Deep-reviews Kotlin coroutines and Flow code for structured-concurrency correctness — scope and dispatcher discipline, cooperative cancellation, exception propagation, hot/cold flow patterns, and coroutine testing. Use when reading, writing, or reviewing concurrency-heavy Kotlin/Android code.
In this repository40 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- android-accessibility-proSkill
- android-adaptive-layout-proSkill
- android-compose-proSkill
- android-design-system-proSkill
- android-gradle-architecture-proSkill
- android-library-proSkill
- android-memory-storage-proSkill
- android-modularization-proSkill
- app-intents-proSkill
- beta-deployment-proSkill
- coredata-swift6-proSkill
- cross-platform-parity-proSkill
- flaky-tests-proSkill
- foundation-models-proSkill
- instruments-profiling-proSkill
- linting-proSkill
- localization-proSkill
- motion-design-proSkill
- r8-shrink-proSkill
- store-compliance-proSkill
- swift-accessibility-proSkill
- swift-adaptive-layout-proSkill
- swift-concurrency-proSkill
- swiftdata-proSkill
- swift-design-system-proSkill
- swift-docc-proSkill
- swift-error-handling-proSkill
- swift-library-proSkill
- swift-logging-proSkill
- swift-memory-storage-proSkill
- swift-modularization-proSkill
- swift-package-proSkill
- swift-testing-proSkill
- swiftui-proSkill
- visionos-proSkill
- xcode-security-proSkill
- xml-to-compose-migration-proSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Check scope and dispatcher discipline using references/structured-concurrency.md — every coroutine's lifetime tied to a real lifecycle, …
- Very specific: line 16
Check cancellation cooperation using references/cancellation.md — CancellationException discipline, CPU-loop checkpoints, cleanup paths.
- Very specific: line 17
Check exception propagation using references/exceptions.md — launch vs async semantics, supervisor boundaries, handler placement.
- Very specific: line 18
Check Flow construction and exposure using references/flows.md — cold/hot boundaries, stateIn/shareIn configuration, operator semantics.
- Very specific: line 19
Check the tests using references/testing.md — virtual time, dispatcher substitution, Turbine discipline.
- Distinctive: line 21
If doing a partial review, load only the relevant reference files.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Review Kotlin coroutines and Flow code for correctness. This is the deep-review companion to the always-on android-coroutines-best-practices.md rule — the rule steers while writing; this skill audits what was written. The Android sibling of swift-concurrency-pro. Report only genuine problems; don't nitpick.
Review process:
- Check scope and dispatcher discipline using
references/structured-concurrency.md— every coroutine's lifetime tied to a real lifecycle, dispatchers injected. - Check cancellation cooperation using
references/cancellation.md—CancellationExceptiondiscipline, CPU-loop checkpoints, cleanup paths. - Check exception propagation using
references/exceptions.md—launchvsasyncsemantics, supervisor boundaries, handler placement. - Check Flow construction and exposure using
references/flows.md— cold/hot boundaries,stateIn/shareInconfiguration, operator semantics. - Check the tests using
references/testing.md— virtual time, dispatcher substitution, Turbine discipline.
If doing a partial review, load only the relevant reference files.
Core Instructions
- Every coroutine needs an owner. The first question for any
launch/async: which scope, why that scope, and what cancels it. "Nothing cancels it" is a finding. - Cancellation is the invariant most code silently breaks. Trace every broad
catchand everyrunCatchingaround suspend code — swallowedCancellationExceptioncorrupts structured concurrency at a distance. - Distinguish bug classes from style. A swallowed cancellation or a deferred
asyncexception is correctness; a missingflowOnthat happens to run on the right dispatcher anyway is a latent risk; name which is which. - Flow exposure is API design. What a ViewModel/repository exposes (
StateFlowvsSharedFlowvs coldFlow, replay, sharing policy) determines consumer behavior — review it like a public interface. - Suspend under a non-suspending lock is a deadlock pattern (
synchronized/ReentrantLockaround suspension points) — always flag. - Assume Kotlin 2.x, kotlinx.coroutines 1.8+, Hilt for injection. Dispatchers arrive via qualified injection (
@IoDispatcher), never hardcoded at use sites.
Output Format
Organize findings by file. For each issue: file/line, the violated principle, brief before/after. Skip clean files. End with a prioritized summary — correctness (cancellation/exceptions/leaks) first, then structure, then style.
Example finding:
SyncRepository.kt
Line 58: runCatching around suspend call swallows cancellation.
// Before — cancellation is caught as failure; the coroutine keeps running "successfully"
val result = runCatching { api.sync() }
// After — rethrow cancellation; catch only what you can handle
val result = try {
Result.success(api.sync())
} catch (e: CancellationException) {
throw e
} catch (e: IOException) {
Result.failure(e)
}References
references/structured-concurrency.md— scope-to-lifecycle mapping,repeatOnLifecycle, dispatcher injection,GlobalScope/runBlockingbans, job hierarchy review.references/cancellation.md— cooperation checkpoints (ensureActive/yield),CancellationExceptiondiscipline,NonCancellablecleanup,withTimeoutedges.references/exceptions.md—launchvsasyncpropagation,coroutineScopevssupervisorScope,CoroutineExceptionHandlerplacement, rethrow patterns.references/flows.md— cold vs hot,stateIn/shareIn+WhileSubscribed(5_000),flowOnplacement,callbackFlow/awaitClose,collectLatest/flatMapLatest/conflatesemantics.references/testing.md—runTest,StandardTestDispatchervsUnconfinedTestDispatcher,MainDispatcherRule, Turbine,backgroundScopeforstateIn, virtual-time control.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

