Android Rxjava To Coroutines Migration
CommunitykrutikJain
Migrate Android RxJava code to Kotlin coroutines and Flow with safe lifecycle-aware replacements.
Overview
- Repository
- krutikJain/android-agent-skills
- Publisher
- krutikJain
- Stars
- 14
- Forks
- 5
- Bundled files
- 7
- License
- MIT
- Updated
- Mar 25, 2026
Installation
tmp=$(mktemp -d)
git clone --depth 1 https://github.com/krutikJain/android-agent-skills.git "$tmp"
mkdir -p ~/.claude/skills
cp -R "$tmp/skills/android-rxjava-to-coroutines-migration" ~/.claude/skills/android-rxjava-to-coroutines-migration
rm -rf "$tmp"tmp=$(mktemp -d)
git clone --depth 1 https://github.com/krutikJain/android-agent-skills.git "$tmp"
mkdir -p ~/.codex/skills
cp -R "$tmp/skills/android-rxjava-to-coroutines-migration" ~/.codex/skills/android-rxjava-to-coroutines-migration
rm -rf "$tmp"Install the Android Rxjava To Coroutines Migration agent skill from https://github.com/krutikJain/android-agent-skills/tree/main/skills/android-rxjava-to-coroutines-migration into this project's skills folder.Instructions
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
Bundled files
FAQ
What does Android Rxjava To Coroutines Migration do?
Migrate Android RxJava code to Kotlin coroutines and Flow with safe lifecycle-aware replacements.
Who made Android Rxjava To Coroutines Migration?
krutikJain (a community member) publishes it in the krutikJain/android-agent-skills repository on GitHub.
Is Android Rxjava To Coroutines Migration free?
Yes. Android Rxjava To Coroutines Migration is open source, published by krutikJain under the MIT license.
What comes with Android Rxjava To Coroutines Migration?
Its instructions and 7 files the agent reads only when a task needs them, such as references, examples or scripts.
Which agents can use Android Rxjava To Coroutines Migration?
Any coding agent that reads SKILL.md files, including Claude Code, Codex, Cursor, GitHub Copilot and Gemini CLI. The agent loads the skill when a task matches its description.
What are agent skills?
An agent skill is a folder with a SKILL.md file: instructions that teach a coding agent how to do one kind of task, and optionally files it can read while it works. The agent keeps only the skill's name and description in mind and reads the rest when a task calls for it.
How are agent skills different from MCP servers?
An MCP server gives an agent new tools to call, code that runs somewhere and returns results. A skill gives it knowledge: how to approach a task with the tools it already has. Many agents use both.
How can my agent test my Android app?
Robomori lets coding agents create, start and control Android emulators and devices from one command, so they can install your app, take screenshots and check dark mode, font sizes and languages.