Caching strategy

From berkcangumusisik/claude-code-practices · View interactive version

Caching strategy is an AI agent skill from the GitHub repository berkcangumusisik/claude-code-practices. Adds caching to expensive operations - Redis, in-memory, HTTP cache headers

How to use this skill

Skill file

Caching Strategy

Target: $1 (or analyze top bottlenecks if not specified)

  1. Identify cacheable operations:
grep -rn "db\.\|prisma\.\|fetch\|axios" ${1:-src/} --include="*.ts" | grep -v "test\|spec" | head -20

What's cacheable?

What's NOT cacheable?

  1. Choose caching layer by use case:
  1. Implement with proper cache keys:
const cacheKey = `user:${userId}:profile`
const cached = await redis.get(cacheKey)
if (cached) return JSON.parse(cached)

const result = await db.user.findUnique(...)
await redis.set(cacheKey, JSON.stringify(result), 'EX', 300) // 5min TTL
  1. Add cache invalidation on mutations.
  1. Show estimated performance improvement.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.