# Rxjava To Coroutines Migration

Guide and execute the migration of asynchronous code from RxJava to Kotlin Coroutines...

- Repository: https://github.com/new-silvermoon/awesome-android-agent-skills (998 stars)
- Category: Mobile
- License: Apache-2.0
- Last updated: 2026-07-27
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add new-silvermoon/awesome-android-agent-skills --skill rxjava-to-coroutines-migration -g -a claude-code -y`
Codex: `npx skills add new-silvermoon/awesome-android-agent-skills --skill rxjava-to-coroutines-migration -g -a codex -y`
Cursor: `npx skills add new-silvermoon/awesome-android-agent-skills --skill rxjava-to-coroutines-migration -g -a cursor -y`
Gemini CLI: `npx skills add new-silvermoon/awesome-android-agent-skills --skill rxjava-to-coroutines-migration -g -a gemini-cli -y`

## Description

Guide and execute the migration of asynchronous code from RxJava to Kotlin Coroutines and Flow. Use this skill when a user asks to convert RxJava (Observables, Singles, Completables, Subjects) to Coroutines (suspend functions, Flows, StateFlows).

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# RxJava to Kotlin Coroutines Migration Skill

A specialized skill designed to safely and idiomatically refactor Android or Kotlin codebases from RxJava to Kotlin Coroutines and Flow.

## Migration Mapping Guide

When migrating RxJava components to Kotlin Coroutines, use the following standard mappings:

### 1. Base Types
- **`Single<T>`** -> `suspend fun ...(): T`
  - A single asynchronous value.
- **`Maybe<T>`** -> `suspend fun ...(): T?`
  - A single asynchronous value that might not exist.
- **`Completable`** -> `suspend fun ...()`
  - An asynchronous operation that completes without a value.
- **`Observable<T>`** -> `Flow<T>`
  - A cold stream of values.
- **`Flowable<T>`** -> `Flow<T>`
  - Coroutines Flow natively handles backpressure.

### 2. Subjects to Hot Flows
- **`PublishSubject<T>`** -> `MutableSharedFlow<T>`
  - Broadcasts events to multiple subscribers. Use `MutableSharedFlow(extraBufferCapacity = ...)` if buffering is needed.
- **`BehaviorSubject<T>`** -> `MutableStateFlow<T>`
  - Holds state and emits the current/latest value to new subscribers. Requires an initial value.
- **`ReplaySubject<T>`** -> `MutableSharedFlow<T>(replay = N)`
  - Replays the last N emitted values to new subscribers.

### 3. Schedulers to Dispatchers
- **`Schedulers.io()`** -> `Dispatchers.IO`
- **`Schedulers.computation()`** -> `Dispatchers.Default`
- **`AndroidSchedulers.mainThread()`** -> `Dispatchers.Main`
- *Context Switching*: `subscribeOn` and `observeOn` are typically replaced by `withContext(Dispatcher)` or `flowOn(Dispatcher)` for Flows.

The rest: https://github.com/new-silvermoon/awesome-android-agent-skills/blob/HEAD/.github/skills/migration/rxjava-to-coroutines-migration/SKILL.md
