redis-patterns

redis-patterns is a skill for Claude Code from medy-gribkov/arcana. It costs 32 tokens per session (3,335 once invoked), scanned A, original, Apache-2.0.

Guidance for using Redis, an in-memory data store commonly used for caching, sessions, rate limits, messaging, and coordination between services. It covers production patterns with TypeScript and Go examples.

In plain words
What is it for?
Designing caches, session storage, rate limiting, distributed locks, publish/subscribe messaging, Redis Streams workflows, and memory-conscious Redis integrations.
Why use it?
It helps avoid problems such as stale or unbounded cache entries, cache stampedes, unsafe distributed locks, and inefficient memory use. The examples show how to apply expiration times and coordination patterns.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: positional $N argument.

Good fit Designing caches, session storage, rate limiting, distributed locks, publish/subscribe messaging, Redis Streams workflows, and memory-conscious Redis integrations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/medy-gribkov/arcana/redis-patterns
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 medy-gribkov/arcana --skill redis-patterns
Clone the repo
git clone --depth 1 https://github.com/medy-gribkov/arcana

Made for: Claude Code.

Its marketplace also offers this one on its own, as the plugin redis-patterns/plugin install redis-patterns after adding the marketplace above.

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-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/medy-gribkov/arcana/redis-patterns/github.svg)](https://agentmods.dev/skills/medy-gribkov/arcana/redis-patterns)
Your own site
<a href="https://agentmods.dev/skills/medy-gribkov/arcana/redis-patterns"><img src="https://agentmods.dev/badge/skills/medy-gribkov/arcana/redis-patterns/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-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/medy-gribkov/arcana/redis-patterns"><img src="https://agentmods.dev/badge/skills/medy-gribkov/arcana/redis-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,335 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.00032 $0.03335
Opus 5 $0.00016 $0.01667
Sonnet 5 $0.00006 $0.00667
Haiku 4.5 $0.00003 $0.00333

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

Security

Grade A, and why

redis-patterns 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 8d 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/redis-patterns/SKILL.md · 466 lines

How it starts

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

Redis Patterns

Production patterns for Redis covering caching, session management, rate limiting, distributed systems, and performance optimization.

Cache-Aside Pattern

BAD: No TTL, cache stampede vulnerability

// ioredis
import Redis from 'ioredis';
const redis = new Redis();

async function getUser(id: string) {
  const cached = await redis.get(`user:${id}`);
  if (cached) return JSON.parse(cached);

  const user = await db.query('SELECT * FROM users WHERE id = $1', [id]);
  await redis.set(`user:${id}`, JSON.stringify(user)); // No TTL!
  return user;
}

GOOD: TTL + stampede protection with locking

async function getUser(id: string) {
  const key = `user:${id}`;
  const cached = await redis.get(key);
  if (cached) return JSON.parse(cached);

  // Acquire lock to prevent stampede
  const lockKey = `lock:${key}`;
  const acquired = await redis.set(lockKey, '1', 'NX', 'EX', 10);

  if (!acquired) {
    // Wait and retry if another process is loading
    await new Promise(resolve => setTimeout(resolve, 100));
    return getUser(id);
  }

  try {
    const user = await db.query('SELECT * FROM users WHERE id = $1', [id]);
    await redis.setex(key, 3600, JSON.stringify(user)); // 1 hour TTL
    return user;
  } finally {
    await redis.del(lockKey);
  }
}

Write-Through Cache

BAD: Cache and DB out of sync

// go-redis
import "github.com/redis/go-redis/v9"

func updateUser(ctx context.Context, rdb *redis.Client, user User) error {
    data, _ := json.Marshal(user)
    rdb.Set(ctx, fmt.Sprintf("user:%s", user.ID), data, 0)
    return db.Exec("UPDATE users SET name = $1 WHERE id = $2", user.Name, user.ID)
    // If DB fails, cache is dirty!
}

GOOD: Write DB first, then invalidate cache

func updateUser(ctx context.Context, rdb *redis.Client, user User) error {
    // Write to DB first
    if err := db.Exec("UPDATE users SET name = $1 WHERE id = $2", user.Name, user.ID); err != nil {
        return err
    }

    // Invalidate cache, don't care if this fails
    key := fmt.Sprintf("user:%s", user.ID)
    rdb.Del(ctx, key)
    return nil
}

Read the full file on GitHub · 466 lines

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. 8d ago First seen · 466 lines · 32 tokens per session scan A dcf527ef4d30

Subscribe to this mod's changes

redis-patterns is a skill published in the GitHub repository medy-gribkov/arcana (1 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 32 tokens to every session and 3,335 once invoked, about $0.0002 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-31.