rxjava-migration

Migrates RxJava code to Kotlin coroutines and flows with explicit type and operator mappings.

Updated Jul 1, 2026
One-click install
npx skills add https://github.com/w0lzard/Wolzard-s-Marketplace --skill rxjava-migration-w0lzard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rxjava-migration
Source: https://github.com/w0lzard/Wolzard-s-Marketplace/tree/main/plugins/personal-skills/skills/rxjava-migration
Command: npx skills add https://github.com/w0lzard/Wolzard-s-Marketplace --skill rxjava-migration-w0lzard

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Migrating RxJava code to Kotlin coroutines and flows is error-prone: type mappings are ambiguous, retry semantics differ subtly, and hot streams lose behavior when converted naively. This Skill provides a structured, incremental migration process that classifies complexity first and forces explicit decisions on ambiguous mappings. ## Core Features & Use Cases - Complexity Assessment: Classifies RxJava chains as Simple or Complex before writing any code, so tricky cases (retryWhen, Flowable backpressure, shared Subjects) get a strategy and user confirmation instead of blind conversion. - Type, Scheduler, and Operator Mapping: Maps Single/Maybe/Completable/Observable/Flowable to suspend functions and Flow, schedulers to dispatchers, and includes a full operator reference table in migration-map.md. - Incremental Interop: Uses kotlinx-coroutines-rx3 bridges (await, asFlow, asObservable) at layer boundaries so migration proceeds leaf-first, layer by layer, with commits after each layer. - Use Case: A developer asks to migrate a repository class using BehaviorSubject and retryWhen. The Skill flags both as Complex, asks whether StateFlow or SharedFlow(replay=1) fits, and rewrites the retry policy using Flow's retryWhen with correct cause/attempt semantics. ## Quick Start Ask the assistant to migrate a specific RxJava class or chain to Kotlin coroutines and flows, and confirm the return types of any APIs it calls.

Frequently Asked Questions about rxjava-migration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate RxJava to Kotlin coroutines and Flow?

Migrate incrementally: convert leaf nodes like API clients first using kotlinx-coroutines-rx3 bridges (await, asFlow), then move upward through repository, use case, and ViewModel layers. Map Single to suspend functions, Observable to Flow, and commit after each layer.

What is the Flow equivalent of RxJava Single, Maybe, and Completable?

Single maps to a suspend function returning T, Maybe maps to a suspend function returning T? (null when empty), and Completable maps to a suspend function returning Unit. Observable and Flowable both map to Flow, with Flowable requiring explicit backpressure handling.

Should BehaviorSubject become StateFlow or SharedFlow?

Use MutableStateFlow when the stream always has an initial value and you need .value access. Use MutableSharedFlow(replay = 1) when the stream may start empty and no .value property is needed. The decision depends on your semantics, so confirm before converting.

Why does Flow retry not work like RxJava retryWhen?

Flow's retry(n) predicate receives the Throwable cause, not an attempt index, so treating it as a counter fails to compile. For stateful policies like exponential backoff, use retryWhen { cause, attempt -> } where attempt is the 0-based retry index.

Can I mix RxJava and coroutines during migration?

Yes, but only at layer boundaries using the kotlinx-coroutines-rx3 (or rx2) interop library. Do not mix both paradigms within the same function body, and remove the interop bridges once each layer is fully migrated.

What happens to subscribeOn and observeOn when migrating to Flow?

subscribeOn maps to flowOn(dispatcher), which affects only upstream operators. observeOn(AndroidSchedulers.mainThread()) has no direct equivalent; collection on the main dispatcher becomes the caller's responsibility, typically via viewModelScope in the ViewModel.