cc-redis-safety

Enforces Redis safety rules covering SCAN usage, TTL policies, and pipeline batching.

1.0k|109|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/doccker/cc-use-exp --skill cc-redis-safety
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cc-redis-safety
Source: https://github.com/doccker/cc-use-exp/tree/main/.codex/skills/cc-redis-safety
Command: npx skills add https://github.com/doccker/cc-use-exp --skill cc-redis-safety

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Redis misuse in production code—such as blocking KEYS commands, missing TTLs, oversized values, and chatty per-item calls—causes outages, memory leaks, and latency spikes that are hard to debug after deployment.

Core Features & Use Cases

  • Blocking Command Prevention: Flags KEYS, FLUSHDB, and FLUSHALL usage and provides SCAN-based replacements in Go (go-redis), Java (Jedis), and Python (redis-py).
  • Big Key and TTL Guardrails: Enforces limits of 10KB per value and 5000 elements per collection, and requires TTL on every key to prevent memory leaks.
  • Pipeline Batching Guidance: Converts loops of single Redis calls into Pipeline batch operations to reduce network round trips.
  • Use Case: While writing a Go service that iterates over user session keys, the skill intercepts a KEYS user:* call and rewrites it as a cursor-based SCAN loop with a 24-hour TTL on each SET.

Quick Start

Review my Redis code for unsafe commands like KEYS or missing TTLs and rewrite them using SCAN and Pipeline patterns.

Frequently Asked Questions about cc-redis-safety

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I replace Redis KEYS with SCAN in production code?

Replace KEYS with cursor-based SCAN iteration: loop with rdb.Scan in Go, jedis.scan with ScanParams in Java, or scan_iter in redis-py. SCAN is non-blocking and processes keys in batches, avoiding the O(N) stall that KEYS causes on large datasets.

Why is the Redis KEYS command dangerous in production?

KEYS is an O(N) blocking operation that scans the entire keyspace, freezing Redis on large instances and causing request timeouts. SCAN iterates incrementally with a cursor, so the server stays responsive between batches.

What is considered a big key in Redis?

Under these rules, a single value should stay under 10KB and collection types (List, Set, Hash, ZSet) should hold no more than 5000 elements. Larger structures should be split into multiple keys to avoid slow serialization and blocking operations.

Does this Redis guidance work with Jedis and redis-py?

Yes, the rules apply across clients with concrete examples for go-redis, Jedis, and redis-py, plus ioredis coverage. Each client has an equivalent SCAN API and pipeline mechanism, so the same patterns transfer directly.

When should I use Redis Pipeline instead of individual commands?

Use Pipeline whenever issuing multiple Redis calls in a loop, such as fetching many keys by ID. Pipelining sends commands in one network round trip instead of one per call, significantly reducing latency for batch operations.