agentleFS
a365ngaya365ngay/CogniRouter/skills/senior-redis/SKILL.md

senior-redis

Skill2 starsChanged 6 days agoMITView on GitHub

Use when designing, reviewing, debugging, or tuning Redis or Valkey usage, including caching strategies and invalidation, TTLs, data structures, distributed locks, rate limiting, pub/sub and streams, queues (BullMQ, Sidekiq, Celery), memory and eviction, persistence, clustering, or security.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use Redis deliberately: right data structure, explicit TTLs and invalidation, bounded memory, and behavior that degrades safely when Redis …

    line 10
  2. Very specific:

    Never use KEYS or blocking full scans in production code.

    line 22
  3. Distinctive:

    Treat Redis as a cache unless persistence is configured and accepted.

    line 24
  4. Very specific:

    Test cache hit, miss, invalidation, and Redis-down behavior.

    line 29

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Senior Redis

Role

Use Redis deliberately: right data structure, explicit TTLs and invalidation, bounded memory, and behavior that degrades safely when Redis is slow or unavailable.

Before Editing

  1. Inspect Redis/Valkey version, deployment (standalone, Sentinel, Cluster, managed), client library, key naming conventions, eviction policy, persistence settings, and existing use (cache, sessions, queues, locks, rate limits).
  2. Identify the source of truth for cached data and every write path that must invalidate it.

Implementation Rules

  • Namespace keys consistently (app:entity:id) and set a TTL on every cache key; add jitter to avoid synchronized expiry.
  • Choose a cache pattern explicitly (cache-aside, write-through) and define invalidation on every write path. Protect hot keys from stampedes (locking, early refresh, request coalescing).
  • Pick structures by access pattern: hashes for objects, sorted sets for rankings and time windows, streams for durable event processing. Avoid huge keys and unbounded lists or sets.
  • Never use KEYS or blocking full scans in production code; use SCAN with limits. Use pipelining or Lua/functions for multi-step atomic operations.
  • Implement locks with SET key value NX PX ttl and token-checked release; know their limits and do not use Redis locks as the only guard for money or critical invariants.
  • Treat Redis as a cache unless persistence is configured and accepted; the application must tolerate misses, timeouts, and failover. Set client timeouts.
  • Require auth/ACLs and TLS, never expose Redis publicly, and do not store secrets or personal data without need and expiry.

Testing and Verification

Test cache hit, miss, invalidation, and Redis-down behavior. Check memory with INFO memory and MEMORY USAGE for new key types, and confirm queue jobs are idempotent and retried as intended.

Review Checklist

  • Does every key have a TTL and a clear invalidation path?
  • Is memory bounded and are large or hot keys avoided?
  • Does the application stay correct when Redis is unavailable?
  • Are atomicity and locking semantics correct for the use case?

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.