Agent-skills-standard android-concurrency
Standards for Coroutines, Flow, and Threading. Use when writing suspend functions, choosing coroutine scopes, switching between StateFlow and SharedFlow, injecting Dispatchers for testability, or debugging threading issues in Android. (triggers: **/*ViewModel.kt, **/*UseCase.kt, **/*Repository.kt, suspend, viewModelScope, lifecycleScope, Flow, coroutine, Dispatcher, DispatcherProvider, GlobalScope)
install
source · Clone the upstream repo
git clone https://github.com/HoangNguyen0403/agent-skills-standard
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/HoangNguyen0403/agent-skills-standard "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/android/android-concurrency" ~/.claude/skills/hoangnguyen0403-agent-skills-standard-android-concurrency && rm -rf "$T"
manifest:
skills/android/android-concurrency/SKILL.mdsource content
Android Concurrency Standards
Priority: P0
Implementation Guidelines
Structured Concurrency
- Scopes: Always use
(VM) orviewModelScope
(Activity/Fragment).lifecycleScope - Dispatchers: INJECT Dispatchers (
) for testability. not hardcodeDispatcherProvider
.Dispatchers.IO
Flow usage
- Cold Streams: Use
for data streams.Flow - Hot Streams: Use
(State) orStateFlow
(Events).SharedFlow - Collection: Use
(Compose) orcollectAsStateWithLifecycle()
(Views).repeatOnLifecycle
Anti-Patterns
- No GlobalScope: Use viewModelScope or lifecycleScope — never GlobalScope.
- No async/await by default: Prefer simple suspend functions; async only for parallel calls.