Xpersona
G

golang-samber-ro

CLAWHUB · Unverified

Reactive streams and event-driven programming in Golang using samber/ro — ReactiveX implementation with 150+ type-safe operators, cold/hot observables, 5 subject types (Publish, Behavior, Replay, Async, Unicast), declarative pipelines via Pipe, 40+ plugins (HTTP, cron, fsnotify, JSON, logging), automatic backpressure, error propagation, and Go context integration. Apply when using or adopting samber/ro, when the codebase imports github.com/samber/ro, or when building asynchronous event-driven pipelines, real-time data processing, streams, or reactive architectures in Go. Not for finite slice transforms (→ See `samber/cc-skills-golang@golang-samber-lo` skill). Skill: golang-samber-ro Owner: samber Summary: Reactive streams and event-driven programming in Golang using samber/ro — ReactiveX implementation with 150+ type-safe operators, cold/hot observables, 5 subject types (Publish, Behavior, Replay, Async, Unicast), declarative pipelines via Pipe, 40+ plugins (HTTP, cron, fsnotify, JSON, logging), automatic backpressure, error propagation, and Go context integration. Apply

62
Rank
84
Safety
1.3k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.3K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s173arkhs3131fq5jf769qq75583hdgt:golang-samber-ro
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-samber-golang-samber-ro/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

145,043 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: golang-samber-ro
description: "Reactive streams and event-driven programming in Golang using samber/ro — ReactiveX implementation with 150+ type-safe operators, cold/hot observables, 5 subject types (Publish, Behavior, Replay, Async, Unicast), declarative pipelines via Pipe, 40+ plugins (HTTP, cron, fsnotify, JSON, logging), automatic backpressure, error propagation, and Go context integration. Apply when using or adopting samber/ro, when the codebase imports github.com/samber/ro, or when building asynchronous event-driven pipelines, real-time data processing, streams, or reactive architectures in Go. Not for finite slice transforms (→ See `samber/cc-skills-golang@golang-samber-lo` skill)."
user-invocable: true
license: MIT
compatibility: Designed for Claude Code, Codex or similar harness, and for projects using Golang.
metadata:
  author: samber
  version: "1.2.0"
  openclaw:
    emoji: "👁"
    homepage: https://github.com/samber/cc-skills-golang
    requires:
      bins:
        - go
    install: []
    skill-library-version: "0.3.0"
allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent mcp__context7__resolve-library-id mcp__context7__query-docs AskUserQuestion Bash(godig:*) Bash(gopls:*) LSP mcp__gopls__*
paths:
  - "**/*.go"
---

**Persona:** You are a Go engineer who reaches for reactive streams when data flows asynchronously or infinitely. You use samber/ro to build declarative pipelines instead of manual goroutine/channel wiring, but you know when a simple slice + samber/lo is enough.

**Thinking mode:** Reason as thoroughly as possible when designing advanced reactive pipelines or choosing between cold/hot observables, subjects, and combining operators — wrong architecture leads to resource leaks or missed events. On Claude Code, use `ultrathink` to trigger extended thinking explicitly.

# samber/ro — Reactive Streams for Go

Go implementation of [ReactiveX](https://reactivex.io/). Generics-first, type-safe, composable pipelines for asynchronous data streams with automatic backpressure, error propagation, context integration, and resource cleanup. 150+ operators, 5 subject types, 40+ plugins.

**Official Resources:**

- [github.com/samber/ro](https://github.com/samber/ro)
- [ro.samber.dev](https://ro.samber.dev)
- [pkg.go.dev/github.com/samber/ro](https://pkg.go.dev/github.com/samber/ro)

This skill is not exhaustive. Please refer to library documentation and code examples for more information. For Go package docs, symbols, versions, importers, and known vulnerabilities, → See `samber/cc-skills-golang@golang-pkg-go-dev` skill (`godig`) — prefer it over Context7 for Go package facts. To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See `samber/cc-skills-golang@golang-gopls` skill (`gopls`). Context7 remains a fallback for docs not indexed on pkg.go.dev.

## Why samber/ro (Streams vs Slices)

Go channels + goroutines become unwieldy for complex async

_meta.json

{
  "ownerId": "kn72rhnkwjfeex9wr1n7y24qa983cjn3",
  "slug": "golang-samber-ro",
  "version": "1.2.0",
  "publishedAt": 1787437787319
}

references/operators-guide.md

# Operators Guide

samber/ro provides 150+ operators organized by category. All operators are generic functions that take and return `Observable[T]`, designed for chaining via `Pipe`.

## Pipeline Construction

```go
// Typed pipes (Pipe1 through Pipe25) — compile-time type safety
result := ro.Pipe2(source, op1, op2)
result := ro.Pipe3(source, op1, op2, op3)

// Untyped pipe — uses any, loses type checking
result := ro.Pipe(source, op1, op2, op3)

// Reusable operator composition (curried)
transform := ro.PipeOp2(op1, op2) // returns func(Observable[A]) Observable[C]
result := transform(source)

// Synchronous collection
values, err := ro.Collect(observable)
```

## Creation Operators

Create observables from various sources. Typically the first argument to `Pipe`.

| Operator | Signature | Purpose |
| --- | --- | --- |
| `Just` | `Just[T](values ...T) Observable[T]` | Emit specific values then complete |
| `Of` | `Of[T](values ...T) Observable[T]` | Alias for Just |
| `FromSlice` | `FromSlice[T](items []T) Observable[T]` | Create from existing slice |
| `FromChannel` | `FromChannel[T](ch <-chan T) Observable[T]` | Wrap Go channel as observable |
| `Range` | `Range(start, end int) Observable[int]` | Emit integer sequence |
| `RangeWithStep` | `RangeWithStep(start, end, step int) Observable[int]` | Integer sequence with custom step |
| `RangeWithInterval` | `RangeWithInterval(start, end int, d time.Duration) Observable[int]` | Integers with delay between each |
| `RangeWithStepAndInterval` | `RangeWithStepAndInterval(start, end, step int, d time.Duration) Observable[int]` | Step + interval combined |
| `Interval` | `Interval(d time.Duration) Observable[int64]` | Emit sequential integers at intervals (infinite) |
| `IntervalWithInitial` | `IntervalWithInitial(initial, d time.Duration) Observable[int64]` | Interval with initial delay |
| `Timer` | `Timer(d time.Duration) Observable[int64]` | Single emission after delay |
| `Repeat` | `Repeat[T](item T, count int64) Observable[T]` | Repeat item N times |
| `RepeatWithInterval` | `RepeatWithInterval[T](item T, count int64, d time.Duration) Observable[T]` | Repeat with delay |
| `Defer` | `Defer[T](factory func() Observable[T]) Observable[T]` | Lazily create observable on subscription |
| `Future` | `Future[T](factory func() (T, error)) Observable[T]` | Single async value from function |
| `Start` | `Start(cb func() (any, error)) Observable[any]` | Execute callback and emit result |
| `Empty` | `Empty[T]() Observable[T]` | Complete immediately, no values |
| `Never` | `Never[T]() Observable[T]` | Never emit or complete |
| `Throw` | `Throw[T](err error) Observable[T]` | Immediately error |

```go
// Custom observable with direct control
obs := ro.NewObservable[int](func(ctx context.Context, observer ro.Observer[int]) error {
    observer.Next(1)
    observer.Next(2)
    observer.Complete()
    return nil
})
```

## Transformation Operators

Transform each value in the stream.

| Operator | Purpose |
| 

references/patterns.md

# Reactive Patterns

Real-world patterns for building production reactive pipelines with samber/ro.

## Pattern 1: Remote Call with Retry and Timeout

Wrap a remote call (HTTP, gRPC, database) with automatic retry, exponential backoff, timeout, and fallback.

```go
result := ro.Pipe3(
    fetchUser(userID),  // ro.Observable[User] — wraps your remote call
    ro.Timeout[User](5*time.Second),
    ro.RetryWithConfig[User](ro.RetryConfig{
        Max:               3,
        Delay:             500 * time.Millisecond,
        BackoffMultiplier: 2.0,
        MaxDelay:          5 * time.Second,
    }),
    ro.Catch[User](func(err error) ro.Observable[User] {
        log.Printf("remote call failed after retries: %v, using cache", err)
        return getCachedUser(userID)
    }),
)

user, err := ro.Collect(result)
```

**Why ro over plain calls:** declarative retry + timeout + fallback in 10 lines vs manual for-loops with sleep, context, and error tracking.

## Pattern 2: Continuous Event Stream (Hot Observable)

Share a single long-lived connection (WebSocket, SSE, message queue) across multiple consumers.

```go
// Cold observable wrapping any event stream source
eventStream := ro.NewObservable[TickerEvent](func(ctx context.Context, obs ro.Observer[TickerEvent]) error {
    // connect to your stream source (WebSocket, NATS, Kafka, etc.)
    for {
        event, err := streamSource.Read(ctx)
        if err != nil {
            return err
        }
        obs.Next(event)
    }
})

// Share: one connection, multiple consumers
shared := ro.Pipe1(eventStream, ro.Share[TickerEvent]())

// Consumer 1: update UI
shared.Subscribe(ro.OnNext(func(e TickerEvent) {
    updateDashboard(e)
}))

// Consumer 2: record metrics
shared.Subscribe(ro.OnNext(func(e TickerEvent) {
    metrics.RecordTick(e.Symbol, e.Price)
}))

// Consumer 3: alert on threshold
ro.Pipe1(shared, ro.Filter(func(e TickerEvent) bool {
    return e.Price > alertThreshold
})).Subscribe(ro.OnNext(sendAlert))
```

The `rohttp` plugin provides WebSocket and HTTP streaming observables (see [Plugin Ecosystem](./plugin-ecosystem.md)).

## Pattern 3: Fan-In from Multiple Sources

Merge events from multiple independent sources, batch, and process.

```go
combined := ro.Pipe2(
    ro.Merge(
        apiStream,
        pushStream,
        cronScheduleStream,
    ),
    ro.Distinct[Event](),
    ro.BufferWithTimeOrCount[Event](100, 5*time.Second),
    ro.Map(func(batch []Event) ProcessResult {
        return processBatch(batch)
    }),
)
```

**When to use Merge vs Concat vs Zip:**

| Operator | Behavior | Use when |
| --- | --- | --- |
| `Merge` | Interleave: emit from any source as it arrives | Independent streams, order doesn't matter |
| `Concat` | Sequential: finish first source, then start second | Ordered processing, fallback chains |
| `Zip` | Pair: wait for one value from each source | Correlated data (user + settings, request + response) |
| `CombineLatest` | Latest: re-emit combined whenever any so

references/plugin-ecosystem.md

# Plugin Ecosystem

samber/ro ships 40+ plugins that extend the core library with domain-specific operators. Plugins are separate Go modules — install only what you need.

```bash
go get github.com/samber/ro/plugins/<category>/<name>
```

## Data Manipulation

| Plugin | Import | Purpose |
| --- | --- | --- |
| Bytes | `plugins/bytes` | Byte slice operations on streams |
| Strings | `plugins/strings` | String transformations (split, trim, join) |
| Sort | `plugins/sort` | Sorting operators for ordered streams |
| Strconv | `plugins/strconv` | Type conversion (string <-> numeric) |
| Iter | `plugins/iter` | Go 1.23+ iterator interop |
| SIMD (experimental) | `plugins/exp/simd` | SIMD-accelerated numeric transforms |

## Encoding and Serialization

| Plugin | Import                    | Purpose                          |
| ------ | ------------------------- | -------------------------------- |
| JSON   | `plugins/encoding/json`   | Marshal/unmarshal JSON in stream |
| CSV    | `plugins/encoding/csv`    | Parse/generate CSV rows          |
| Base64 | `plugins/encoding/base64` | Encode/decode Base64             |
| Gob    | `plugins/encoding/gob`    | Go binary encoding               |

```go
import rojson "github.com/samber/ro/plugins/encoding/json"

// Parse JSON stream: []byte -> MyStruct
parsed := ro.Pipe1(rawBytes, rojson.Unmarshal[MyStruct]())
```

## Scheduling

| Plugin | Import         | Purpose                               |
| ------ | -------------- | ------------------------------------- |
| Cron   | `plugins/cron` | Emit on cron expressions or intervals |
| ICS    | `plugins/ics`  | Parse iCal files into event streams   |

```go
import rocron "github.com/samber/ro/plugins/cron"

// Emit every day at midnight
daily := rocron.Schedule("0 0 * * *")
```

## Network and I/O

| Plugin   | Import             | Purpose                                  |
| -------- | ------------------ | ---------------------------------------- |
| HTTP     | `plugins/http`     | HTTP request operators (GET, POST, etc.) |
| I/O      | `plugins/io`       | File and stream reading/writing          |
| FSNotify | `plugins/fsnotify` | File system change events                |

```go
import rofsnotify "github.com/samber/ro/plugins/fsnotify"

// Watch directory for changes
events := rofsnotify.Watch("/var/log/app/")
ro.Pipe1(events, ro.Filter(func(e fsnotify.Event) bool {
    return e.Op == fsnotify.Write
})).Subscribe(ro.OnNext(func(e fsnotify.Event) {
    log.Println("Modified:", e.Name)
}))
```

## Observability and Logging

| Plugin  | Import                          | Purpose                         |
| ------- | ------------------------------- | ------------------------------- |
| Log     | `plugins/observability/log`     | stdlib `log` integration        |
| Zap     | `plugins/observability/zap`     | Uber Zap structured logging     |
| Logrus  | `plugins/observability/logrus`  | Logrus logging                  |
| Slog    | `plugins/observability/slog`    | G

Sponsored

Ads related to golang-samber-ro and adjacent AI workflows.