← ClaudeAtlas

migrate-rxjava-to-coroutineslisted

RxJava to coroutines and Flow migration: type and operator mappings, threading, UI state instead of view callbacks, interop adapters, test migration. Use when converting Singles, Observables, Flowables, Subjects, Disposables, subscribeOn/observeOn chains or RxJava tests, or when Rx and coroutine code must interoperate mid-migration.
pablitoarango/android-skills · ★ 3 · AI & Automation · score 74
Install: claude install-skill pablitoarango/android-skills
# RxJava to Kotlin Coroutines Migration Sources of truth: [Coroutines best practices](https://developer.android.com/kotlin/coroutines/coroutines-best-practices), [Kotlin flows on Android](https://developer.android.com/kotlin/flow), [StateFlow and SharedFlow](https://developer.android.com/kotlin/flow/stateflow-and-sharedflow), [UI layer](https://developer.android.com/topic/architecture/ui-layer), [Asynchronous Flow](https://kotlinlang.org/docs/coroutines-flow.html), [kotlinx.coroutines.flow API](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/), [kotlinx-coroutines-rx3](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-rx3/). These sources define the target patterns; check each Rx operator's semantics in the RxJava docs before replacing it. The migrated code must follow `android-coroutines`, `android-data-layer` and `android-viewmodel`. ## 1. Migration order Migrate **incrementally**, from the data layer up: 1. **Data sources and repositories**: change return types to `suspend` / `Flow`. 2. **Use cases**, if any. 3. **ViewModels / presenters**: replace subscriptions with coroutines in `viewModelScope` producing `StateFlow` UI state. 4. **UI**: collect with `repeatOnLifecycle` or `collectAsStateWithLifecycle()`. 5. **Tests** for each migrated class. 6. Remove RxJava dependencies once nothing uses them. Use interop adapters (section 7) at the boundary while both styles coexist. ## 2. Choosing the target type De