agentsclimarketplace

Rxswift

Skill kimkyuchul/RxSwift-Skill/rxswift

Use when writing, reviewing, or debugging RxSwift / RxCocoa / RxRelay code in iOS projects. Covers Observables, Subjects, Relays, Schedulers, operators, Traits (Single/Maybe/Completable/Driver/Signal), UIKit bindings, MVVM Input/Output and ReactorKit architectures, memory management with DisposeBag, testing with RxTest, and Swift Concurrency interop.From its SKILL.md

Install
npx -y skills add kimkyuchul/RxSwift-Skill --skill rxswift

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

10.6 KB, ~2.7k tokens by cl100k_base, as published. Nobody here has run it

RxSwift Skill

Expert guidance on RxSwift 6.x and its companion libraries RxCocoa and RxRelay for iOS development.

Targets real-world work: designing streams that don't leak, picking the correct flatMap variant, binding UIKit safely on the main thread, structuring testable ViewModels, and bridging into async/await when needed — without dumping the entire RxSwift documentation into context.

When to use this skill

Activate when you see any of:

  • Imports: import RxSwift, import RxCocoa, import RxRelay, import RxTest, import RxBlocking, import ReactorKit
  • Symbols: Observable<, DisposeBag, BehaviorRelay, PublishSubject, Driver<, Signal<, .rx., bind(to:), drive(, disposed(by:), Reactor, Action, Mutation, State
  • Dependency files: Podfile mentioning RxSwift/RxCocoa/RxRelay; Package.swift with ReactiveX/RxSwift; Cartfile with ReactiveX/RxSwift
  • User asks: "why does this stream fire twice", "memory leak in my subscription", "how do I test this ViewModel", "should I use Subject or Relay", "convert this Observable to async/await"

Skip if

  • Pure Combine (import Combine, AnyPublisher, @Published) — different framework with different operator names. Don't translate Rx idioms blindly.
  • SwiftUI-only project with no Rx — the user wants idiomatic SwiftUI, not Rx bridges.
  • async/await only, no Rx — defer to a Swift Concurrency skill if available. Only engage swift-concurrency-interop.md when both worlds coexist.
  • RxJava / RxJS questions — same family, different language semantics. Do not assume API parity.

Core capabilities

  • Design Observable streams with the correct hot/cold semantics and share strategy
  • Pick the right Subject vs Relay vs Trait and the right operator for the job (especially the flatMap family and debounce vs throttle)
  • Manage subscriptions without leaks using DisposeBag and weak captures
  • Build UIKit bindings with Driver/Signal that are guaranteed main-thread and error-free
  • Structure and test ViewModels with MVVM Input/Output or ReactorKit, using RxTest/RxBlocking

Progressive disclosure

This file stays small on purpose. Do not paste large reference content here. Use the Decision Tree below to load only the references/*.md files relevant to the current task. Each reference is self-contained and ≤ 2.5k words.

If you're unsure where to start, read references/_index.md for a navigable problem router.


Workflow Decision Tree

Match the user's question/code to the scenario, then load the listed reference(s). Most tasks need 1–2 references; complex reviews may need 3–4.

Stream design and lifecycle

ScenarioRead
Creating an Observable from scratch (create, just, from, deferred, …)observables.md
Stream fires twice / once per subscriber when only one was expectedobservables.md (Cold vs Hot, share variants)
Need to multicast: which share/share(replay:scope:)/publish to pickobservables.md (Multicasting)
Stream completes unexpectedly after one errorerror-handling.md (terminal events) + anti-patterns.md (silent termination)

State, events, and writable sources

ScenarioRead
Need a writable source the ViewModel can push intosubjects-and-relays.md
Choosing PublishSubject vs BehaviorSubject vs Replay vs Asyncsubjects-and-relays.md
Choosing Subject vs Relay (when do I want errors/completion?)subjects-and-relays.md (decision table)
Want to expose state to View but not let it write backsubjects-and-relays.md + traits.md (Driver)

Operators

ScenarioRead
Picking between map, flatMap, flatMapLatest, flatMapFirstoperators.md (flatMap family decision matrix)
Search box: debounce vs throttleoperators.md (debounce vs throttle table)
Combining streams: combineLatest vs withLatestFrom vs zipoperators.md (Combining)
Error recovery operators (catch, retry, materialize)operators.md (Error) + error-handling.md
Building a custom operatoroperators.md (advanced section)

Return types and UI streams

ScenarioRead
What return type for a one-shot network call (Single, Maybe, Completable)?traits.md
Output stream for a UIKit view (Driver vs Signal vs BehaviorRelay)traits.md + rxcocoa-bindings.md
Converting Observable → Trait or vice versatraits.md

Threading

ScenarioRead
UI updated on background thread / "Main Thread Checker" warningschedulers.md + rxcocoa-bindings.md (Driver/Signal guarantees)
subscribe(on:) vs observe(on:) placement questionschedulers.md
Heavy work blocking UI scrollschedulers.md (Concurrent vs Serial)

Memory and disposal

ScenarioRead
Suspected retain cycle / leak in a subscriptiondisposal-and-memory.md
DisposeBag in a UITableViewCell (cell reuse)disposal-and-memory.md (per-cell pattern)
Forgot disposed(by:) / subscription disappearsdisposal-and-memory.md
Nested subscribe inside subscribedisposal-and-memory.md + anti-patterns.md + operators.md (flatMap family)

UIKit bindings (RxCocoa)

ScenarioRead
Bind any control to/from a stream (bind(to:), drive(_:), emit(to:))rxcocoa-bindings.md
ControlProperty vs ControlEventrxcocoa-bindings.md
UITableView / UICollectionView with rx.itemsrxcocoa-bindings.md
Custom Binder for a non-RxCocoa propertyrxcocoa-bindings.md
NotificationCenter.rx, URLSession.rx, KVOrxcocoa-bindings.md

Architecture

ScenarioRead
Structuring a ViewModel (Input/Output struct or Reactor?)architecture.md
Implementing the Reactor protocol (Action/Mutation/State)architecture.md (ReactorKit section)
@Pulse for one-shot UI events from a Reactorarchitecture.md
Choosing between MVVM I/O and ReactorKit for a new screenarchitecture.md (selection guide)

Swift Concurrency interop

ScenarioRead
for try await x in observable.values — caveats?swift-concurrency-interop.md
try await single.value — when does it deadlock?swift-concurrency-interop.md
Wrap an async function as Single/Observableswift-concurrency-interop.md
Convert AsyncStreamObservableswift-concurrency-interop.md
Cancellation: Task cancel vs Disposable.dispose()swift-concurrency-interop.md (cancellation interplay)

Error handling

ScenarioRead
Network call should retry with backofferror-handling.md (retry(when:))
Stream dies after one error — keep it aliveerror-handling.md (materialize/dematerialize or catchAndReturn)
Designing an error-less output for the UIerror-handling.md + traits.md (Driver)

Testing

ScenarioRead
Test a debounced / throttled streamtesting.md (TestScheduler virtual time)
Test a Driver/Signal outputtesting.md
Test a Reactortesting.md (Reactor stub) + architecture.md
Quick blocking assertion on a Singletesting.md (RxBlocking)

Code review and smell check

ScenarioRead
"Review this Rx code for smells"anti-patterns.md (always) + the most relevant topic file
Best-practice / convention checkanti-patterns.md + disposal-and-memory.md

Vocabulary

ScenarioRead
Unfamiliar term ("what is a Binder / multicasting / pulse / VirtualTime?")glossary.md

Quick verification checklist

Before giving advice, take ≤ 30 seconds to ground yourself in the project's reality:

  1. RxSwift version — RxSwift 6 renamed catchErrorcatch (the latter is also a Swift keyword and needs backticks in some contexts), catchErrorJustReturncatchAndReturn, and added bind(with:onNext:) for safe self-capturing binds. Check Package.resolved / Podfile.lock if uncertain. Default assumption: 6.x.
  2. Dependency surface — grep Podfile, Package.swift, Cartfile for RxSwift, RxCocoa, RxRelay, RxTest, RxBlocking, ReactorKit. Don't recommend RxRelay APIs if RxRelay isn't a dependency.
  3. Swift version — RxSwift 6.x supports Swift 5.x and Swift 6 (with strict concurrency caveats). If the project enables strict concurrency (-strict-concurrency=complete or Swift 6 mode), expect Sendable warnings around closures captured in subscribe/bind. See swift-concurrency-interop.md.
  4. Architecture in use — search for protocol ViewModelType, struct Input, struct Output, or : Reactor/: View (ReactorKit). Match advice to the existing pattern; don't impose a different one.
  5. Disposal pattern — confirm the codebase uses a top-level let disposeBag = DisposeBag() per VC/cell, not ad-hoc local bags that go out of scope.

If any of these signals contradict the user's code, surface the contradiction before answering.


How to answer

  • Lead with the answer, then cite the operator/API by name with file path if it lives in the codebase.
  • Show Bad → Good when correcting code. The Rx mental model is unforgiving; a snippet beats a paragraph.
  • Prefer composition over nested subscribe. If a fix requires a nested subscribe, you almost certainly need flatMap/flatMapLatest instead — see operators.md.
  • Always weak-capture self in subscribe/bind closures unless using bind(with:onNext:) or subscribe(with:onNext:). See disposal-and-memory.md.
  • Don't silently change architecture. If the screen is MVVM I/O, don't refactor it into ReactorKit unprompted.

Sources

When in doubt, the upstream repos are authoritative:

  • RxSwift / RxCocoa / RxRelay / RxTest / RxBlockinghttps://github.com/ReactiveX/RxSwift (baseline: 6.10.x). The Documentation/ folder contains canonical specs for Schedulers, Subjects, Traits, Hot vs Cold, Unit Tests, and Swift Concurrency interop.
  • ReactorKithttps://github.com/ReactorKit/ReactorKit (Action / Mutation / State, View protocol, @Pulse, stub-based testing).

What ships with it: 14 files

134.9 KB alongside SKILL.md

Keep looking

Skills are one crate of 326,401. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.