redis-streams-rails

redis-streams-rails is a skill for Claude Code, Codex from sandeepmvl/rails-skills. It costs 102 tokens per session (2,030 once invoked), scanned A, original, MIT.

Guidance for using Redis Streams, a Redis data structure that keeps an ordered, replayable record of messages, in Rails applications. It covers adding messages, consumer groups, acknowledgements, pending messages, retention limits, and when Kafka may be a better fit.

In plain words
What is it for?
Use it to design or review Rails event pipelines, configure Redis Streams consumers, acknowledge and reclaim work, cap retention, and decide when to move to Kafka.
Why use it?
It helps teams add durable message processing using Redis they already operate, while avoiding common problems such as unbounded storage or abandoned messages.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to design or review Rails event pipelines, configure Redis Streams consumers, acknowledge and reclaim work, cap retention, and decide when to move to Kafka.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sandeepmvl/rails-skills/45-redis-streams-rails
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add sandeepmvl/rails-skills --skill 45-redis-streams-rails
Clone the repo
git clone --depth 1 https://github.com/sandeepmvl/rails-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for redis-streams-rails

README.md
[![agentmods](https://agentmods.dev/badge/skills/sandeepmvl/rails-skills/45-redis-streams-rails/github.svg)](https://agentmods.dev/skills/sandeepmvl/rails-skills/45-redis-streams-rails)
Your own site
<a href="https://agentmods.dev/skills/sandeepmvl/rails-skills/45-redis-streams-rails"><img src="https://agentmods.dev/badge/skills/sandeepmvl/rails-skills/45-redis-streams-rails/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for redis-streams-rails

Your own site · 80×15
<a href="https://agentmods.dev/skills/sandeepmvl/rails-skills/45-redis-streams-rails"><img src="https://agentmods.dev/badge/skills/sandeepmvl/rails-skills/45-redis-streams-rails.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 102 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,030 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00102 $0.02030
Opus 5 $0.00051 $0.01015
Sonnet 5 $0.00020 $0.00406
Haiku 4.5 $0.00010 $0.00203

Measured 12d ago against content hash 4a0e946cba24, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

redis-streams-rails scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/45-redis-streams-rails/SKILL.md · 248 lines

How it starts

The opening of the file, as written. The whole thing — 248 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Redis Streams

Redis Streams is the "I already have Redis, give me Kafka-ish semantics without a new operational dependency" option. Good up to medium throughput, single-region, and short retention. Outgrows the pattern at high throughput / long retention — that's Kafka territory.

The opinion

Use Redis Streams when you already run Redis (you almost certainly do) and you need pub/sub-with-history + consumer groups, but don't yet justify Kafka's operational cost. Cap streams with MAXLEN. Use consumer groups with manual acknowledgement. Periodically claim entries idle for > N minutes (PEL handling). Plan to migrate to Kafka if throughput exceeds ~10k events/sec sustained or you need cross-region replication.

Why Redis Streams over plain pub/sub

Feature Redis pub/sub Redis Streams
Persistence None (drop on publish if no subscriber) Disk + AOF
Replay None Yes (read from any offset)
Consumer groups No Yes
Acknowledgement No Yes (XACK)
Pending tracking No Yes (XPENDING)
Memory growth None Bounded with MAXLEN

If you need anything beyond fire-and-forget broadcasts: Streams, not pub/sub.

Setup

# Gemfile
gem "redis", "~> 5.0"
gem "connection_pool"  # for thread-safe sharing
# config/initializers/redis.rb
REDIS_STREAMS = ConnectionPool.new(size: 10, timeout: 5) do
  Redis.new(url: ENV.fetch("REDIS_STREAMS_URL"))
end

Pattern 1: Producing (XADD)

class EventPublisher
  STREAM = "orders.events"
  MAX_LEN = 1_000_000  # approximate cap

  def self.publish(event_type:, payload:)
    REDIS_STREAMS.with do |redis|
      redis.xadd(
        STREAM,
        {
          event_type: event_type,
          payload: payload.to_json,
          published_at: Time.current.iso8601
        },
        maxlen: MAX_LEN,
        approximate: true  # ~ trim — Redis trims when convenient, much faster
      )
    end
  end
end

EventPublisher.publish(
  event_type: "order.placed",
  payload: { order_id: 42, account_id: 7, total_cents: 12_500 }
)

Read the full file on GitHub · 248 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 248 lines · 102 tokens per session scan A 4a0e946cba24

Subscribe to this mod's changes

redis-streams-rails is a skill published in the GitHub repository sandeepmvl/rails-skills (21 stars, last pushed 3mo ago), licensed MIT. It adds 102 tokens to every session and 2,030 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

using-redis-token-buckets

Use when adding a bucket-like rate limit backed by Redis: a per-caller budget with burst capacity and continuous refill, a refund path for requests that did no work, or a limit whose Retry-After must be a real wait rather than a window edge. posthog/tokenbucket.py provides an atomic Lua token bucket (consume, refund…

PostHog/posthog-foss · 148 tokens

spring-boot-cache

Provides patterns for implementing Spring Boot caching: configures Redis/Caffeine/EhCache providers with TTL and eviction policies, applies @Cacheable/@CacheEvict/@CachePut annotations, validates cache hit/miss behavior, and exposes metrics via Actuator. Use when adding caching to Spring Boot services, configuring…

giuseppe-trisciuoglio/developer-kit · 79 tokens

using-redis-token-buckets

Use when adding a bucket-like rate limit backed by Redis: a per-caller budget with burst capacity and continuous refill, a refund path for requests that did no work, or a limit whose Retry-After must be a real wait rather than a window edge. posthog/tokenbucket.py provides an atomic Lua token bucket (consume, refund…

PostHog/posthog · 148 tokens

spring-data-redis

Use when implementing caching, session storage, rate limiting, or any Redis integration. Covers cache-aside pattern, key naming, TTL strategy, and serialization config.

rrezartprebreza/spring-boot-skills · 37 tokens

background-job-orchestrator

Expert in background job processing with Bull/BullMQ (Redis), Celery, and cloud queues. Implements retries, scheduling, priority queues, and worker management. Use for async task processing, email campaigns, report generation, batch operations. Activate on "background job", "async task", "queue", "worker", "BullMQ"…

curiositech/some_claude_skills · 95 tokens

nw-sd-patterns

Core distributed systems patterns - load balancing, caching, sharding, consistent hashing, message queues, rate limiting, CDN, Bloom filters, ID generation, replication, conflict resolution, CAP theorem.

nWave-ai/nWave · 43 tokens