kotlin-coroutines-expert

kotlin-coroutines-expert is a skill for Claude Code, Codex from rabee-elkholy/android-harness-kit. It costs 30 tokens per session (450 once invoked), scanned A, original, MIT.

A Kotlin guide for writing coroutines and Flow in Android applications. Coroutines handle asynchronous work, while Flow represents values that arrive over time, such as network or database updates.

In plain words
What is it for?
Structuring concurrent operations, handling failures and cancellation, exposing StateFlow data, and testing asynchronous Android code.
Why use it?
It helps prevent common problems such as leaked work, unsafe cancellation, swallowed errors, and poorly managed concurrent tasks.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Structuring concurrent operations, handling failures and cancellation, exposing StateFlow data, and testing asynchronous Android code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rabee-elkholy/android-harness-kit/kotlin-coroutines-expert
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add rabee-elkholy/android-harness-kit --skill kotlin-coroutines-expert
Clone the repo
git clone --depth 1 https://github.com/rabee-elkholy/android-harness-kit

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for kotlin-coroutines-expert

README.md
[![agentmods](https://agentmods.dev/badge/skills/rabee-elkholy/android-harness-kit/kotlin-coroutines-expert/github.svg)](https://agentmods.dev/skills/rabee-elkholy/android-harness-kit/kotlin-coroutines-expert)
Your own site
<a href="https://agentmods.dev/skills/rabee-elkholy/android-harness-kit/kotlin-coroutines-expert"><img src="https://agentmods.dev/badge/skills/rabee-elkholy/android-harness-kit/kotlin-coroutines-expert/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for kotlin-coroutines-expert

Your own site · 80×15
<a href="https://agentmods.dev/skills/rabee-elkholy/android-harness-kit/kotlin-coroutines-expert"><img src="https://agentmods.dev/badge/skills/rabee-elkholy/android-harness-kit/kotlin-coroutines-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 450 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00030 $0.00450
Opus 5 $0.00015 $0.00225
Sonnet 5 $0.00006 $0.00090
Haiku 4.5 $0.00003 $0.00045

Measured 10d ago against content hash e09b043a2d1f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

kotlin-coroutines-expert scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/skills/kotlin-coroutines-expert/SKILL.md · 49 lines

What it actually says

Kotlin Coroutines Expert

Overview

Authoritative guide for asynchronous programming, reactive data streams, and cancellation/exception safety in this Android app.


1. Structured Concurrency

  • Always launch coroutines within a defined CoroutineScope (e.g., viewModelScope with applicationExceptionHandler).
  • Use coroutineScope or supervisorScope to group concurrent tasks.
  • Never use GlobalScope (causes memory leaks and uncontrollable lifetimes).
suspend fun loadDashboardData(): DashboardData = supervisorScope {
    val userDeferred = async { userRepo.getUser() }
    val stepsDeferred = async { stepsRepo.getTodaySteps() }
    
    DashboardData(
        user = userDeferred.await(),
        steps = stepsDeferred.await()
    )
}

2. Exception & Cancellation Safety

  • Top-level scopes should use CoroutineExceptionHandler.
  • Never swallow CancellationException — if caught, rethrow it to allow proper cancellation propagation.
  • For network calls, catch specific domain exceptions (IOException, HttpException) instead of a generic empty catch (e: Exception).

3. Reactive Streams (Flow & StateFlow)

  • Expose read-only StateFlow<T> or SharedFlow<T> from ViewModels; keep MutableStateFlow private.
  • For One-Shot UI events (navigation, toast, dialog), use Channel<Event> with receiveAsFlow() or SharedFlow<Event>(replay = 0). Never use sticky MutableLiveData.
  • Use flowOn(Dispatchers.IO) for heavy data transformations before collecting on the Main thread.

4. Testing Coroutines

  • Use runTest from kotlinx-coroutines-test.
  • Inject TestDispatcher (e.g. StandardTestDispatcher or UnconfinedTestDispatcher) into ViewModels/UseCases instead of hardcoding Dispatchers.IO.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 49 lines · 30 tokens per session scan A e09b043a2d1f

Subscribe to this mod's changes

kotlin-coroutines-expert is a skill published in the GitHub repository rabee-elkholy/android-harness-kit (3 stars, last pushed 11d ago), licensed MIT. It adds 30 tokens to every session and 450 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

compose-navigation

Jetpack Compose Navigation for Android AI agents. Use this skill whenever implementing navigation, NavHost, NavController, back stack, deep links, navigation arguments, routes, type-safe navigation, @Serializable routes, navController.navigate, popBackStack, navigateUp, bottom navigation, tab navigation, nested…

piyushverma0/android-agent-skills · 138 tokens

kotlin-patterns

Idiomatic Kotlin patterns for Android AI agents. Use this skill whenever writing Kotlin code for Android, especially: coroutines, Flow, StateFlow, SharedFlow, viewModelScope, lifecycleScope, Dispatchers, withContext, suspend functions, sealed classes, sealed interfaces, data classes, extension functions, scope…

piyushverma0/android-agent-skills · 134 tokens

hilt-di

Hilt dependency injection for Android AI agents. Use this skill whenever setting up Hilt, writing @HiltViewModel, @AndroidEntryPoint, @HiltAndroidApp, @Module, @InstallIn, @Provides, @Binds, @Singleton, @ViewModelScoped, @ActivityScoped, @EntryPoint, @AssistedInject, @HiltWorker, @HiltAndroidTest, @BindValue, or…

piyushverma0/android-agent-skills · 155 tokens

kotlin-android-architecture

Expert guidance on a modern Kotlin-first Android application architecture using Clean Architecture, Gradle module separation, version catalogs, and Hilt DI. Use this when asked about project structure, module layout, or dependency injection.

almasumdev/awesome-kotlin-android-agent-skills · 49 tokens

kotlin-flow

Expert guidance on Kotlin Flow — cold vs hot flows, StateFlow / SharedFlow, common operators, combining, back-pressure, and testing with Turbine. Use this for any reactive data stream work.

almasumdev/awesome-kotlin-android-agent-skills · 44 tokens

livedata-to-flow

Expert guidance on migrating LiveData to StateFlow / SharedFlow, including lifecycle-aware collection, Transformations replacements, and Java interop. Use this when modernizing a ViewModel or removing the lifecycle-livedata dependency.

almasumdev/awesome-kotlin-android-agent-skills · 49 tokens