android-rxjava-to-coroutines-migration
Skill14 starsChanged 8 months agoMITView on GitHub
Migrate Android RxJava code to Kotlin coroutines and Flow with safe lifecycle-aware replacements.
In this repository68 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/android-architecture-clean.mdcCursor rule
- .cursor/rules/android-ci-cd-release-playstore.mdcCursor rule
- .cursor/rules/android-coil-compose.mdcCursor rule
- .cursor/rules/android-compose-accessibility.mdcCursor rule
- .cursor/rules/android-compose-foundations.mdcCursor rule
- .cursor/rules/android-compose-performance.mdcCursor rule
- .cursor/rules/android-compose-state-effects.mdcCursor rule
- .cursor/rules/android-compose-xml-interoperability.mdcCursor rule
- .cursor/rules/android-coroutines-flow.mdcCursor rule
- .cursor/rules/android-di-hilt.mdcCursor rule
- .cursor/rules/android-emulator-automation.mdcCursor rule
- .cursor/rules/android-gradle-build-logic.mdcCursor rule
- .cursor/rules/android-gradle-build-performance.mdcCursor rule
- .cursor/rules/android-kotlin-core.mdcCursor rule
- .cursor/rules/android-local-persistence-datastore.mdcCursor rule
- .cursor/rules/android-material3-design-system.mdcCursor rule
- .cursor/rules/android-media-files-sharing.mdcCursor rule
- .cursor/rules/android-mobile-frontend-design.mdcCursor rule
- .cursor/rules/android-modernization-upgrade.mdcCursor rule
- .cursor/rules/android-modularization.mdcCursor rule
- .cursor/rules/android-navigation-deeplinks.mdcCursor rule
- .cursor/rules/android-networking-retrofit-okhttp.mdcCursor rule
- .cursor/rules/android-performance-observability.mdcCursor rule
- .cursor/rules/android-permissions-activity-results.mdcCursor rule
- .cursor/rules/android-room-database.mdcCursor rule
- .cursor/rules/android-rxjava-to-coroutines-migration.mdcCursor rule
- .cursor/rules/android-security-best-practices.mdcCursor rule
- .cursor/rules/android-serialization-offline-sync.mdcCursor rule
- .cursor/rules/android-state-management.mdcCursor rule
- .cursor/rules/android-testing-ui.mdcCursor rule
- .cursor/rules/android-testing-unit.mdcCursor rule
- .cursor/rules/android-ui-states-validation.mdcCursor rule
- .cursor/rules/android-viewsystem-foundations.mdcCursor rule
- .cursor/rules/android-workmanager-notifications.mdcCursor rule
- android-architecture-cleanSkill
- android-ci-cd-release-playstoreSkill
- android-coil-composeSkill
- android-compose-accessibilitySkill
- android-compose-foundationsSkill
- android-compose-performanceSkill
- android-compose-state-effectsSkill
- android-compose-xml-interoperabilitySkill
- android-coroutines-flowSkill
- android-di-hiltSkill
- android-emulator-automationSkill
- android-gradle-build-logicSkill
- android-gradle-build-performanceSkill
- android-kotlin-coreSkill
- android-local-persistence-datastoreSkill
- android-material3-design-systemSkill
- android-media-files-sharingSkill
- android-mobile-frontend-designSkill
- android-modernization-upgradeSkill
- android-modularizationSkill
- android-navigation-deeplinksSkill
- android-networking-retrofit-okhttpSkill
- android-performance-observabilitySkill
- android-permissions-activity-resultsSkill
- android-room-databaseSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Use this skill when the request is about: rxjava to coroutines android, observable to flow android, replace composite disposable android.
- Very specific: line 20
Read references/patterns.md for the type-mapping matrix and operator red-flag checklist.
- Very specific: line 21
Read references/scenarios.md for staged migration and inventory-first workflows.
- Distinctive: line 31
Leave a checklist for ambiguous operators or custom bridges instead of pretending every chain can be auto-converted safely.
- Very specific: line 34
Prefer suspend functions for one-shot work and Flow for streams.
- Very specific: line 36
Call out operator semantics that need human review, especially flatMap, switchMap, replay, and threading assumptions.
- Distinctive: line 38
Treat migration as behavior-preserving refactor work, not a chance to redesign unrelated business logic.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Android RxJava To Coroutines Migration
When To Use
- Use this skill when the request is about: rxjava to coroutines android, observable to flow android, replace composite disposable android.
- Primary outcome: Migrate Android RxJava code to Kotlin coroutines and Flow with safe lifecycle-aware replacements.
- Reach for this skill when the codebase still exposes
Single,Observable, schedulers, or disposables and the goal is to move tosuspend,Flow,StateFlow, orSharedFlow. - Read
references/patterns.mdfor the type-mapping matrix and operator red-flag checklist. - Read
references/scenarios.mdfor staged migration and inventory-first workflows. - Handoff skills when the scope expands:
android-modernization-upgradeandroid-coroutines-flow
Workflow
- Scan the codebase for RxJava imports, base types, subjects, and scheduler usage before changing any API surface.
- Classify each usage as one-shot work, stream work, hot state, hot events, callback bridging, or backpressure-sensitive work.
- Replace repository and domain APIs first, then move UI-layer subscriptions to lifecycle-aware collection.
- Rewrite scheduler and disposable management as dispatcher, scope, structured-concurrency ownership, and lifecycle-aware collection such as
repeatOnLifecycle. - Leave a checklist for ambiguous operators or custom bridges instead of pretending every chain can be auto-converted safely.
Guardrails
- Prefer
suspendfunctions for one-shot work andFlowfor streams; do not force everything intoFlow. - Preserve lifecycle ownership when replacing
CompositeDisposableand manual subscription chains. - Call out operator semantics that need human review, especially
flatMap,switchMap, replay, and threading assumptions. - Preserve hot-state and replay semantics explicitly with
StateFlow,SharedFlow,shareIn, orstateIninstead of assuming coldFlowis equivalent. - Treat migration as behavior-preserving refactor work, not a chance to redesign unrelated business logic.
Anti-Patterns
- Converting every Rx type to
Floweven when asuspendfunction is the better match. - Dropping replay, buffering, or hot-stream semantics during subject migration.
- Leaving
observeOnandsubscribeOnassumptions undocumented after moving to dispatchers. - Rewriting repository, ViewModel, and UI layers all at once with no staged verification.
Review Focus
- Type mapping:
Single,Maybe,Completable,Observable,Flowable, and Subjects. - Hot vs cold semantics, replay behavior, and backpressure expectations.
- Dispatcher ownership,
viewModelScope, and lifecycle collection. - Testing fallout for coroutine timing, cancellation, and stream assertions.
Examples
Happy path
- Scenario: Scan a legacy RxJava sample and generate a migration checklist for repositories, ViewModels, and UI subscriptions.
- Command:
bash skills/android-rxjava-to-coroutines-migration/scripts/run_examples.sh
Edge case
- Scenario: Inventory subjects, disposables, and scheduler usage before converting state or one-off events.
- Command:
python3 skills/android-rxjava-to-coroutines-migration/scripts/scan_rxjava_usage.py examples/fixtures/rxjava-legacy-sample --json
Failure recovery
- Scenario: Produce a deterministic checklist when parts of the chain still need manual operator review.
- Command:
python3 skills/android-rxjava-to-coroutines-migration/scripts/generate_migration_checklist.py examples/fixtures/rxjava-legacy-sample
Done Checklist
- RxJava types and operators were inventoried before code changes were proposed.
- One-shot APIs, streams, hot state, and hot events are mapped to the right coroutine primitives.
- Lifecycle ownership and dispatcher assumptions are explicit.
- Ambiguous operators or bridging cases are recorded as manual follow-up work.
Official References
- https://developer.android.com/kotlin/coroutines
- https://developer.android.com/kotlin/flow
- https://developer.android.com/kotlin/coroutines/coroutines-best-practices
- https://developer.android.com/topic/libraries/architecture/coroutines
- https://developer.android.com/kotlin/flow/stateflow-and-sharedflow
- https://kotlinlang.org/docs/flow.html
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

