Skip to content
Development
Skill

/android-concurrency

Write correct coroutine scopes, lifecycle collection, and dispatcher injection in Android production code. Use for suspend functions, coroutine scopes, and dispatcher mechanics; defer ViewModel StateFlow/LiveData architecture, Fragment lifecycle recipes,

From plugin
agent-skills-standard
538200 skills1 MCP
Install
$ npx -y skills add hoangnguyen0403/agent-skills-standard --skill android-concurrency --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/android-concurrency

Context preview

The summary Claude sees to decide when to auto-load this skill.

Write correct coroutine scopes, lifecycle collection, and dispatcher injection in Android production code. Use for suspend functions, coroutine scopes, and dispatcher mechanics; defer ViewModel StateFlow/LiveData architecture, Fragment lifecycle recipes,

SKILL.md

android-concurrency.SKILL.md
name: android-concurrency
description: Write correct coroutine scopes, lifecycle collection, and dispatcher injection in Android production code. Use for suspend functions, coroutine scopes, and dispatcher mechanics; defer ViewModel StateFlow/LiveData architecture, Fragment lifecycle recipes, persistence/notifications, and unit-test recipes to their specific skills.
metadata:
  triggers:
    files:
    - '**/*ViewModel.kt'
    - '**/*UseCase.kt'
    - '**/*Repository.kt'
    keywords:
    - suspend
    - viewModelScope
    - lifecycleScope
    - Flow
    - coroutine
    - Dispatcher
    - DispatcherProvider
    - GlobalScope

Android Concurrency Standards

**Priority: P0 (CRITICAL)**

Implementation Guidelines

Structured Concurrency

  • **Scopes**: Always use `viewModelScope` (VM) or `lifecycleScope` (Activity/Fragment).
  • **Dispatchers**: INJECT Dispatchers (`DispatcherProvider`) for testability. not hardcode `Dispatchers.IO`.

Flow usage

  • **Cold Streams**: Use `Flow` for data streams.
  • **Hot Streams**: Use `StateFlow` (State) or `SharedFlow` (Events).
  • **Replay**: Use `SharedFlow` with `replay` only when late subscribers must receive recent events.
  • **Collection**: Use `collectAsStateWithLifecycle()` (Compose) or `repeatOnLifecycle` (Views).

Anti-Patterns

  • **No GlobalScope**: Use viewModelScope or lifecycleScope — never GlobalScope.
  • **No async/await by default**: Prefer simple suspend functions; async only for parallel calls.

References

  • [Dispatcher Pattern](references/implementation.md)

Canonical response anchors

  • Additional task-grounded exact anchors: hardcode
Read more
Ships withagent-skills-standard

The portable SDLC standards layer for AI coding agents. Sync once, then work in your own runtime.

Get the whole plugin

Other skills on agent-skills-standard.