redis-patterns

redis-patterns is a skill for Claude Code, Codex from pekral/cursor-rules. It costs 43 tokens per session (1,996 once invoked), scanned A, original, MIT.

A set of patterns for using Redis, a fast data store often used for caching, rate limits, queues, and coordination, in Laravel applications.

In plain words
What is it for?
Use it when adding Laravel caching, rate limiting, distributed locks, queue debouncing, pub/sub, sessions, or Redis-backed queues, including key and expiry design.
Why use it?
It helps avoid common problems such as unlimited cache growth, duplicate work, request bursts, and unsafe shared operations.

Skill for Claude CodeCodex

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

Good fit Use it when adding Laravel caching, rate limiting, distributed locks, queue debouncing, pub/sub, sessions, or Redis-backed queues, including key and expiry design.

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

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/pekral/cursor-rules/redis-patterns/github.svg)](https://agentmods.dev/skills/pekral/cursor-rules/redis-patterns)
Your own site
<a href="https://agentmods.dev/skills/pekral/cursor-rules/redis-patterns"><img src="https://agentmods.dev/badge/skills/pekral/cursor-rules/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/pekral/cursor-rules/redis-patterns"><img src="https://agentmods.dev/badge/skills/pekral/cursor-rules/redis-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,996 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.00043 $0.01996
Opus 5.5 $0.00017 $0.00798
Sonnet 5.5 $0.00009 $0.00399
Haiku 4.5 $0.00004 $0.00200

Measured 1mo ago against content hash dea966a87131, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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 · 194 lines

How it starts

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

Redis Patterns

Constraints

  • Apply @rules/laravel/laravel.mdc — use the framework's facades (Cache, RateLimiter, Redis), not a raw client.
  • Apply @rules/laravel/queue-debouncing.mdc for queue/job coalescing concerns when Redis backs the queue.
  • Cross-link @rules/sql/optimalize.mdc (DB-level caching) — Redis caching sits in front of the query tuning that rule owns; cache the result, do not paper over an unindexed query.
  • final classes, declare(strict_types=1), Pest tests (use the array cache driver in tests unless asserting Redis-specific behavior).
  • Always set a TTL. Keys without expiry accumulate and cause memory pressure.

Use when

  • Adding caching, rate limiting, distributed coordination, or pub/sub to a Laravel app.
  • Choosing a cache strategy, protecting a cold cache from stampede, or designing key/TTL conventions.
  • Configuring Redis as the session, cache, or queue store.

Use Laravel facades throughout. Reach for raw Redis::command(...) only for structures the Cache abstraction does not expose (sorted sets, streams).

Caching Strategies

Cache-Aside (default for read-heavy data)

$product = Cache::remember("product:{$id}", now()->addMinutes(10), fn () =>
    Product::findOrFail($id),
);

remember() is read-through cache-aside: returns the cached value or runs the closure, stores it, and returns it. Use rememberForever() only with an explicit invalidation path.

Write-Through (consistency required)

$product->update($data);
Cache::put("product:{$product->id}", $product->fresh(), now()->addMinutes(10));
// Or simply invalidate so the next read repopulates:
Cache::forget("product:{$product->id}");

Invalidate (forget) rather than rewrite when the cached shape may differ from the model.

Cache Tags (grouped invalidation)

Cache::tags(['products', "category:{$categoryId}"])
    ->remember("product:{$id}", now()->addMinutes(10), fn () => Product::findOrFail($id));

Cache::tags(["category:{$categoryId}"])->flush(); // drop the whole group at once

Read the full file on GitHub · 194 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. 1mo ago First seen · 194 lines · 43 tokens per session scan A dea966a87131

Subscribe to this mod's changes

redis-patterns is a skill published in the GitHub repository pekral/cursor-rules (11 stars, last pushed 19d ago), licensed MIT. It adds 43 tokens to every session and 1,996 once invoked, about $0.0002 per session on Opus 5.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.

Related

Other skills, from other repositories

laravel-database-optimization

Laravel database optimization patterns. Use when writing Eloquent queries, creating migrations, configuring caching, debugging slow queries, or optimizing database performance. Triggers on tasks involving N+1 queries, indexing, Redis caching, pagination, or database transactions.

AsyrafHussin/agent-skills · 55 tokens

laravel-eloquent

Eloquent and query-layer engineering rules for Laravel — eliminating N+1, choosing a pagination strategy, short atomic transactions, casts and scopes on the model, where raw SQL is allowed, and how migrations declare the schema those queries depend on. Use when writing or reviewing Eloquent models, migrations, query…

Foysal50x/skills · 93 tokens

laravel-async

Asynchronous and caching rules for Laravel — idempotent queued jobs with retries and backoff, domain events for side effects, queue separation and failure handling, deterministic cache keys with event-driven invalidation, and scheduled tasks that queue rather than block. Use when writing or reviewing jobs, events…

Foysal50x/skills · 86 tokens

Laravel Eloquent N+1 and Query Efficiency Review

Detects N+1 query patterns (relation access inside loops without eager loading), full-table get()/all() loads, and unsafe chunk()/cursor() usage in Laravel Eloquent code.

s977043/river-review · 48 tokens

Laravel Migration Safety Review

Reviews Laravel migrations for destructive operations, change() dropping modifiers, locking index creation on large tables (PostgreSQL), and asymmetric down().

s977043/river-review · 32 tokens

laravel-brain

Analyze a Laravel application for complexity hotspots, security surface, and database access patterns using laravel-brain. Activate when: the user asks what needs work, what should be improved, what to work on next, where to focus, what is the most complex code, what are the security issues, audit the codebase…

laramint/laravel-brain · 118 tokens