SKILL Instructions

Android Kotlin Coroutines

Structured concurrency patterns for Android

claude
cursor
chatgpt
#android
#kotlin
#coroutines
#flow

About

Guidance for writing safe, cancellable async code on Android with Kotlin coroutines and Flow. Covers scopes, dispatchers, exception handling, and lifecycle awareness.

Metadata (SKILL.md frontmatter)

name
android-kotlin-coroutines
version
1.0.0

Instructions

Kotlin Coroutines on Android

  • Use viewModelScope in ViewModels, lifecycleScope in Activities/Fragments.
  • Never use GlobalScope.
  • Switch dispatchers with withContext(Dispatchers.IO) for IO; keep UI on Main.
  • Expose data with StateFlow / SharedFlow, not LiveData, in new code.
  • Collect flows with repeatOnLifecycle(Lifecycle.State.STARTED).