Agent skill

Android Coroutines

by Moustachauve in Moustachauve/WLED-Android

Authoritative rules and patterns for production-quality Kotlin Coroutines onto Android.

Apache-2.0Auto-check passedDevelopment

Install Android Coroutines

skills CLI
$ npx skills add Moustachauve/WLED-Android --skill android-coroutines -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Moustachauve/WLED-Android android-coroutines --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Moustachauve/WLED-Android.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/android-coroutines .claude/skills/android-coroutines && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
android-coroutines
GitHub stars
169
Used in
3 other repos
Token cost
~1.4k tokens
SKILL.md length
443 words
Files
1
Skills in repo
17
Repo updated
First seen
Licence
Apache-2.0

At a glance

Authoritative rules and patterns for production-quality Kotlin Coroutines onto Android.

  • Works in 9 steps: Dispatcher Injection (Testability) → Main-Safety → Lifecycle-Aware Collection → …
  • Development work in your project
  • SKILL.md covers Responsibilities, Applicability, Critical Rules & Constraints and Code Patterns
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Android Coroutines is an agent skill from Moustachauve/WLED-Android. Authoritative rules and patterns for production-quality Kotlin Coroutines onto Android. Covers structured concurrency, lifecycle integration, and reactive streams.

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development. It works with Android and Kotlin. The repository describes itself as: Native Android application for WLED. The licence is Apache-2.0.

When your agent uses it

  • Development work in your project

Example prompts

  • “/android-coroutines”

Workflow steps

9 steps, taken from the step headings in SKILL.md.

  1. Dispatcher Injection (Testability)
  2. Main-Safety
  3. Lifecycle-Aware Collection
  4. ViewModel Scope Usage
  5. Mutable State Encapsulation
  6. GlobalScope Prohibition
  7. Exception Handling
  8. Cancellability
  9. Callback Conversion

What it can do on your machine

Read from SKILL.md and the folder at commit 7e164a8. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are kotlin).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Android Coroutines loads about 1.4k tokens when it runs. Until then it costs about 46 tokens; SKILL.md has 443 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~46
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Moustachauve/WLED-Android at commit 7e164a8, republished under its Apache-2.0 licence (© Moustachauve). 443 words, ~1,385 tokens.

Download SKILL.mdSave it as .claude/skills/android-coroutines/SKILL.md (or your agent's skills folder).
name
android-coroutines
description
Authoritative rules and patterns for production-quality Kotlin Coroutines onto Android. Covers structured concurrency, lifecycle integration, and reactive streams.

Android Coroutines Expert Skill

This skill provides authoritative rules and patterns for writing production-quality Kotlin Coroutines code on Android. It enforces structured concurrency, lifecycle safety, and modern best practices (2025 standards).

Responsibilities

  • Asynchronous Logic: Implementing suspend functions, Dispatcher management, and parallel execution.
  • Reactive Streams: Implementing Flow, StateFlow, SharedFlow, and callbackFlow.
  • Lifecycle Integration: Managing scopes (viewModelScope, lifecycleScope) and safe collection (repeatOnLifecycle).
  • Error Handling: Implementing CoroutineExceptionHandler, SupervisorJob, and proper try-catch hierarchies.
  • Cancellability: Ensuring long-running operations are cooperative using ensureActive().
  • Testing: Setting up TestDispatcher and runTest.

Applicability

Activate this skill when the user asks to:

  • "Fetch data from an API/Database."
  • "Perform background processing."
  • "Fix a memory leak" related to threads/tasks.
  • "Convert a listener/callback to Coroutines."
  • "Implement a ViewModel."
  • "Handle UI state updates."

Critical Rules & Constraints

1. Dispatcher Injection (Testability)
  • NEVER hardcode Dispatchers (e.g., Dispatchers.IO, Dispatchers.Default) inside classes.
  • ALWAYS inject a CoroutineDispatcher via the constructor.
  • DEFAULT to Dispatchers.IO in the constructor argument for convenience, but allow it to be overridden.
kotlin
// CORRECT
class UserRepository(
    private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO
) { ... }

// INCORRECT
class UserRepository {
    fun getData() = withContext(Dispatchers.IO) { ... }
}
2. Main-Safety
  • All suspend functions defined in the Data or Domain layer must be main-safe.
  • One-shot calls should be exposed as suspend functions.
  • Data changes should be exposed as Flow.
  • The caller (ViewModel) should be able to call them from Dispatchers.Main without blocking the UI.
  • Use withContext(dispatcher) inside the repository implementation to move execution to the background.
3. Lifecycle-Aware Collection
  • NEVER collect a flow directly in lifecycleScope.launch or launchWhenStarted (deprecated/unsafe).
  • ALWAYS use repeatOnLifecycle(Lifecycle.State.STARTED) for collecting flows in Activities or Fragments.
kotlin
// CORRECT
viewLifecycleOwner.lifecycleScope.launch {
    viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
        viewModel.uiState.collect { ... }
    }
}
4. ViewModel Scope Usage
  • Use viewModelScope for initiating coroutines in ViewModels.
  • Do not expose suspend functions from the ViewModel to the View. The ViewModel should expose StateFlow or SharedFlow that the View observes.
Show full SKILL.md (174 more words)Show less
5. Mutable State Encapsulation
  • NEVER expose MutableStateFlow or MutableSharedFlow publicly.
  • Expose them as read-only StateFlow or Flow using .asStateFlow() or upcasting.
6. GlobalScope Prohibition
  • NEVER use GlobalScope. It breaks structured concurrency and leads to leaks.
  • If a task must survive the current scope, use an injected applicationScope (a custom scope tied to the Application lifecycle).
7. Exception Handling
  • NEVER catch CancellationException in a generic catch (e: Exception) block without rethrowing it.
  • Use runCatching only if you explicitly rethrow CancellationException.
  • Use CoroutineExceptionHandler only for top-level coroutines (inside launch). It has no effect inside async or child coroutines.
8. Cancellability
  • Coroutines feature cooperative cancellation. They don't stop immediately unless they check for cancellation.
  • ALWAYS call ensureActive() or yield() in tight loops (e.g., processing a large list, reading files) to check for cancellation.
  • Standard functions like delay() and withContext() are already cancellable.
9. Callback Conversion
  • Use callbackFlow to convert callback-based APIs to Flow.
  • ALWAYS use awaitClose at the end of the callbackFlow block to unregister listeners.

Code Patterns

Repository Pattern with Flow
kotlin
class NewsRepository(
    private val remoteDataSource: NewsRemoteDataSource,
    private val externalScope: CoroutineScope, // For app-wide events
    private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO
) {
    val newsUpdates: Flow<List<News>> = flow {
        val news = remoteDataSource.fetchLatestNews()
        emit(news)
    }.flowOn(ioDispatcher) // Upstream executes on IO
}
Parallel Execution
kotlin
suspend fun loadDashboardData() = coroutineScope {
    val userDeferred = async { userRepo.getUser() }
    val feedDeferred = async { feedRepo.getFeed() }
    
    // Wait for both
    DashboardData(
        user = userDeferred.await(),
        feed = feedDeferred.await()
    )
}
Testing with runTest
kotlin
@Test
fun testViewModel() = runTest {
    val testDispatcher = StandardTestDispatcher(testScheduler)
    val viewModel = MyViewModel(testDispatcher)
    
    viewModel.loadData()
    advanceUntilIdle() // Process coroutines
    
    assertEquals(expectedState, viewModel.uiState.value)
}

© Moustachauve, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .github/skills/android-coroutines of Moustachauve/WLED-Android.

Open the folder on GitHubat commit 7e164a8

Used in 3 other repositories

We found 4 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 3 other GitHub owners. This page covers the copy in Moustachauve/WLED-Android, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Android Coroutines next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Android Coroutines compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Android Coroutines this skillMoustachauve/WLED-Android1693 repos~1.4kAutomated safety check: PassApache-2.0
Ha Android Concurrencyhome-assistant/android4k—~1kAutomated safety check: PassApache-2.0
Task Workflowikarenkov/Modo343—~2.4kAutomated safety check: PassNone
Release Changelogsk2andy/candy-browser508—~593Automated safety check: PassMPL-2.0
Ha Android Logging Errorshome-assistant/android4k—~845Automated safety check: PassApache-2.0
Composewebview Code Reviewparkwoocheol/compose-webview103—~2kAutomated safety check: PassMIT

Similar skills

  • Ha Android Concurrency

    home-assistant/android

    Home Assistant Android coroutine and threading guidance. An agent skill from home-assistant/android.

    4k GitHub stars~1k tokensUpdated today
    DevelopmentAuto-check passed
  • Task Workflow

    ikarenkov/Modo

    Spec-driven workflow for non-trivial work. An agent skill from ikarenkov/Modo.

    343 GitHub stars~2.4k tokensUpdated 3 mo ago
    DevelopmentAuto-check passed
  • Release Changelog

    sk2andy/candy-browser

    Create or update Candy Browser's English, image-rich, versioned release notes for the in-app What's New presentation and the matching GitHub release.

    508 GitHub stars~593 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Ha Android Logging Errors

    home-assistant/android

    Home Assistant Android logging and error handling. An agent skill from home-assistant/android.

    4k GitHub stars~845 tokensUpdated today
    DevelopmentAuto-check passed
  • Composewebview Code Review

    parkwoocheol/compose-webview

    Performs code quality checks and reviews for ComposeWebView.

    103 GitHub stars~2k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Git GitHub Ops

    c5inco/compose-pokedexer

    Handles Pokedexer Git and GitHub workflows: inspect changes, prepare commit messages, manage branches and pushes, and create or update issues and pull requests with safe file-based inputs.

    143 GitHub stars~1.3k tokensUpdated 6 days ago
    DevelopmentAuto-check passed

More from Moustachauve/WLED-Android

All 17 skills in this repo
  • Compose Performance Audit

    Moustachauve/WLED-Android

    Audit and improve Jetpack Compose runtime performance from code review and architecture.

    169 GitHub starsUsed in 3 repos~1.7k tokens
    Auto-check passed
  • Compose UI

    Moustachauve/WLED-Android

    Best practices for building UI with Jetpack Compose, focusing on state hoisting, detailed performance optimizations, and theming.

    169 GitHub starsUsed in 3 repos~676 tokens
    Auto-check passed
  • Gradle Build Performance

    Moustachauve/WLED-Android

    Debug and optimize Android/Gradle build performance. An agent skill from Moustachauve/WLED-Android.

    169 GitHub starsUsed in 3 repos~2k tokens
    Auto-check passed
  • Kotlin Concurrency Expert

    Moustachauve/WLED-Android

    Kotlin Coroutines review and remediation for Android. An agent skill from Moustachauve/WLED-Android.

    169 GitHub starsUsed in 3 repos~1.4k tokens
    Auto-check passed
  • Coil Compose

    Moustachauve/WLED-Android

    Expert guidance on using Coil for image loading in Jetpack Compose.

    169 GitHub starsUsed in 2 repos~789 tokens
    Auto-check passed
  • XML To Compose Migration

    Moustachauve/WLED-Android

    Convert Android XML layouts to Jetpack Compose. An agent skill from Moustachauve/WLED-Android.

    169 GitHub starsUsed in 2 repos~2.6k tokens
    Auto-check passed

Works with

Categories

Questions about Android Coroutines

What does Android Coroutines do?

Authoritative rules and patterns for production-quality Kotlin Coroutines onto Android. Android Coroutines is an agent skill from Moustachauve/WLED-Android. Authoritative rules and patterns for production-quality Kotlin Coroutines onto Android.

When should I use Android Coroutines?

Android Coroutines fits situations like: development work in your project.

How do I install Android Coroutines in Claude Code?

Run `npx skills add Moustachauve/WLED-Android --skill android-coroutines -a claude-code`. Or copy the skill folder (.github/skills/android-coroutines in Moustachauve/WLED-Android) into .claude/skills/android-coroutines in your project. Claude Code loads it when a task matches its description.

How do I install Android Coroutines in Codex?

Run `npx skills add Moustachauve/WLED-Android --skill android-coroutines -a codex`. Or copy the skill folder (.github/skills/android-coroutines in Moustachauve/WLED-Android) into .agents/skills/android-coroutines in your project. Codex loads it when a task matches its description.

Can I use Android Coroutines in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Moustachauve/WLED-Android --skill android-coroutines -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/android-coroutines, .gemini/skills/android-coroutines, .github/skills/android-coroutines and .opencode/skills/android-coroutines in your project.

What does Android Coroutines need to run?

SKILL.md names no scripts, command-line tools or credentials: Android Coroutines is instructions for the agent only.

Does Android Coroutines access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Android Coroutines safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Android Coroutines use?

Android Coroutines is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Android Coroutines use?

About 1.4k tokens (SKILL.md is roughly 5.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Android Coroutines?

Skills that share tags, products or a category with Android Coroutines: Ha Android Concurrency (home-assistant/android, 4k stars), Task Workflow (ikarenkov/Modo, 343 stars), Release Changelog (sk2andy/candy-browser, 508 stars) and Ha Android Logging Errors (home-assistant/android, 4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Android Coroutines?

Moustachauve (a GitHub user) maintains it in Moustachauve/WLED-Android, which has 169 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on October 9, 2026.

Source: Moustachauve/WLED-Android on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.