Use when creating, updating, reviewing, or debugging caching, cache keys, TTL, invalidation, Redis, in-memory cache, CDN cache, performance, stale data, or cache-related bugs.
Use when creating, updating, reviewing, or debugging caching, cache keys, TTL, invalidation, Redis, in-memory cache, CDN cache, performance, stale data, or cache-related bugs.
Caching
Use this skill for safe caching that improves performance without breaking correctness.
Rules
Follow the project’s existing caching pattern.
Do not add a new cache provider or caching library unless already used or explicitly requested.
Cache only data that is safe and useful to cache.
Define TTL, invalidation, or both.
Prefer correctness over speed.
Cache failures should not break the main flow unless cache is the source of truth.
Do not cache passwords, secrets, raw tokens, payment details, or highly sensitive data.
Do not leak data between users, organizations, or tenants through shared cache keys.
Preserve existing logging, error, and test patterns.
Avoid unrelated refactors.
Inspect First
Before changing cache behavior, check existing patterns for:
cache provider/helper
cache key naming
TTL conventions
invalidation strategy
user/org/tenant scoping
fallback behavior
logging
tests
Implementation Checklist
Identify the source of truth.
Decide what should be cached.
Reuse existing cache helpers.
Design deterministic cache keys.
Include user, organization, tenant, locale, filters, pagination, or feature flags when they affect results.