android-coroutines
CommunityAndroid coroutines with lifecycle-safe patterns.
System Documentation
What problem does it solve?
Android apps often suffer from unsafe coroutine usage, lifecycle leaks, and unstructured concurrency. This skill provides authoritative rules and patterns to write robust, lifecycle-aware Kotlin Coroutines for Android, ensuring structured concurrency and modern best practices.
Core Features & Use Cases
- Structured concurrency enforcement across ViewModel, Repository, and Worker boundaries to prevent leaks.
- Lifecycle integration with viewModelScope, lifecycleScope, and repeatOnLifecycle for safe flow collection.
- Reactive streams support with Flow, StateFlow, SharedFlow, and callbackFlow for responsive UIs.
- Error handling, cancellation, and testing patterns (CoroutineExceptionHandler, TestDispatcher, runTest) to improve reliability.
- Guidance to avoid hard-coding Dispatchers and to maintain main-safety across layers.
Quick Start
Refactor a sample Android feature to inject a CoroutineDispatcher and expose UI state via StateFlow in a ViewModel. Demonstrate lifecycle-safe collection using repeatOnLifecycle and viewModelScope for long-running tasks.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: android-coroutines Download link: https://github.com/thinhtt264/Snaplet-App/archive/main.zip#android-coroutines Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.