Menu

Post image 1
Post image 2
1 / 2
0

CLAUDE.md for Redis: 13 Rules That Stop AI From Writing Cache Anti-Patterns

DEV Community·Olivia Craft·28 days ago
#PRfGVlmt
Reading 0:00
15s threshold

You ask Claude to "add caching to the user profile endpoint," and 30 seconds later you ship something that looks fine in review: SET user_42 <json> — flat key, no namespace, collides the moment a second service shares the cluster. No TTL — the entry lives forever until maxmemory evicts your hottest keys. KEYS user_* in a cleanup job — single-threaded Redis stalls every other client for hundreds of ms. new Redis() inside the request handler — file descriptors leak and the box falls over at moderate load. The model didn't fail. It pattern-matched on blog posts where Redis is a toy with twelve keys and zero ops concerns. Production makes each one a real incident. A CLAUDE.md at the root of your repo fixes this. Claude Code reads it on every task. Cursor, Aider, and Copilot do the same. Below are four of the thirteen rules I drop into every Redis project — full set in the free gist linked at the end. Rule 1 — Namespace every key: app:env:entity:id[:attr] Why: Redis has no schema and no folders.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More