This skill should be used when the user asks about a "caching strategy", "cache invalidation", "what to cache", "read-through vs write-through vs write-back", "cache eviction" (LRU/LFU/TTL), "Redis vs Memcached", "stale reads", or hits "thundering herd", "cache stampede", "cache penetration", or "hot key" problems, or is choosing a Redis `maxmemory` eviction policy (allkeys-lru, volatile-lru, noeviction) vs TTL expiry for sessions or other cached state. Use it whenever a design is read-heavy or a datastore is overloaded by reads, even if the user doesn't say "cache".
npx skills add https://github.com/proyecto26/system-design-skills --skill caching
Put a copy of hot data closer to the reader so most requests skip the slow path.
Caching is the highest-leverage move for read-heavy systems — and the easiest to
get subtly wrong, because a cache adds a second source of truth that can serve
stale or wrong data, and can *amplify* an outage when it misbehaves.
Reads dominate (a high read:write ratio from back-of-the-envelope); the same
data is read repeatedly; the datastore is the read bottleneck; or recomputation
is expensive. A cache buys read latency and offloads the origin.
Write-heavy or read-once data (low hit rate — pure overhead). Data that must be
exactly current with zero staleness (a cache is a stale copy by nature; when
strict freshness is required, go to the source or use consistency-coordination). Don't
add a cache before a number shows reads are the problem (YAGNI) — it's a new
failure mode and a second thing to operate.
back-of-the-envelope, 80/20.)Where to cache (often layered): client/browser → CDN edge (→ content-delivery)
→ application/in-process → distributed cache (Redis/Memcached) → database buffer
pool. This skill focuses on the application and distributed layers.
Read strategy
Use when reads are unpredictable; the default for most systems.
app code simple and caching policy centralized.
Write strategy
after writes must be fresh and slower writes are acceptable.
write-heavy/bursty paths that tolerate a small loss window.
written data is rarely re-read soon (avoids cache churn).
Eviction policy
TTL to bound staleness; FIFO rarely. Match the policy to the pattern.
| Option | What it solves | What it worsens | Change it when |
|---|---|---|---|
| Cache-aside | Simple, resilient (cache down ⇒ just slower) | First read per key is a miss; risk of stale after writes | Misses are too costly → read-through + warming |
| Read-through | Centralized, clean app code | Couples app to cache lib; cold-start misses | Custom per-key load logic is needed |
| Write-through | Fresh reads after write | Slower writes; writes cached data that may never be read | Writes dominate and aren't re-read → write-around/back |
| Write-back | Fast, absorbs write bursts | Data loss window on crash; complex | Durability of recent writes is required |
| Write-around | No churn from write-only data | Recently written keys miss on first read | That data IS read right after write → write-through |
| TTL eviction | Bounds staleness automatically | Mass expiry can stampede the origin | Add jitter / soft-TTL refresh |
A cache that misbehaves doesn't just stop helping — it can take down the origin.
thousands of concurrent misses hit the store at once. *Mitigate:* per-key locks
/ request coalescing (single-flight), early/probabilistic refresh, TTL jitter.
time (often malicious). *Mitigate:* cache the negative result (short TTL), or a
Bloom filter in front.
throughput. *Mitigate:* replicate the key across nodes, add a local/L1 tier, or
shard the value.
the origin sees full load. *Mitigate:* warm critical keys; ramp traffic.
invalidate on write, or write-through, or short TTL — pick per staleness budget.
Monitor: hit rate, p99 latency, eviction rate, key distribution (hot spots),
and origin QPS during cache restarts.
hot-set size (see *Clarify first*). If no number yet shows reads are the
bottleneck, stop — a cache is not needed yet (→ back-of-the-envelope).
(cache-aside is the default), a write strategy keyed to the staleness budget,
and an eviction policy matched to the access pattern.
per-key-family invalidation event. Decide negative-caching and single-flight up
front, not after the first incident.
(stampede, penetration, hot key, cold cache, stale-after-write) and confirm a
mitigation is in place for the ones the traffic profile can trigger.
target hit rate (90%+), and confirm the node count covers peak QPS (→ *Numbers
that matter*).
if the user named a cloud (see *Choosing a provider*).
Change it when…` table with one row per choice you made here (e.g. the
option, its store, its failure policy); the last column is a concrete trigger
(a number or observable signal). Then name what breaks first.
Do
Don't
...:v2) instead.A cache node serves ~100k–1M QPS, far above an RDBMS (~1k). Memory access is
~100 ns vs ms-scale disk — the reason caching wins. Size the cache to the hot set
(~20% of data ≈ 80% of reads). Target hit rates are usually 90%+; below that,
question whether the data is cacheable. → back-of-the-envelope.
A cache entry is a contract: a key (stable, namespaced, e.g.
user:123:profile), a value (serialized; watch size), and a TTL. Decide
the invalidation event per key family (on write? on TTL? on version bump?).
Versioned keys (...:v2) make invalidation a write of a new key instead of a
delete race.
Default to the generic recipe above (Redis or Memcached, self-hosted or managed).
If the user names a cloud, read references/providers/<provider>.md for the
managed-service mapping, limits, and provider-specific trade-offs. If no file
exists for that provider, the generic recipe is the answer.
To visualize the cache-aside read path (app → cache → miss → origin → populate)
or the stampede/fallback flow, use the in-plugin architecture-diagram skill —
cache nodes use the cache color, the origin its store color, and the miss path a
dashed arrow.
content-delivery — *pairs with* this as the edge layer above it; CDN/edge caching for static and media (that concept lives there).data-storage — *depends on* this as the origin a cache protects; its read replicas are an *alternative to* caching reads, and cache-node sharding mirrors its partitioning. (Consistent-hashing theory is *owned by* consistency-coordination.)consistency-coordination — *pairs with* this when staleness is unacceptable and read-your-writes or stronger guarantees are required.back-of-the-envelope — *feeds into* this skill: it supplies the read ratio and hot-set size that justify a cache.resilience-failure — *pairs with* this; rate limiting and circuit breakers (*owned* there) help contain the retry storms a misbehaving cache can trigger.system-design — *owned-concept lives in* the orchestrator: the reasoning loop, the trade-off method, and the ten failure modes.references/deep-dive.md — invalidation patterns, single-flight/coalescing, consistent hashing for cache sharding, Redis vs Memcached internals, local (L1) + distributed (L2) tiers. Read when designing the cache layer in detail.references/providers/{generic,aws,azure,gcp}.md — service mappings, limits, and pitfalls per environment.Build production-ready Node.js backend services with Express/Fastify, implementing middleware patterns, error handling, authentication, database integration, and API design best practices. Use when creating Node.js servers, REST APIs, GraphQL backends, or microservices architectures.
Build production-ready Node.js backend services with Express/Fastify, implementing middleware patterns, error handling, authentication, database integration, and API design best practices. Use when creating Node.js servers, REST APIs, GraphQL backends, or microservices architectures.
Use when building Laravel 10+ applications requiring Eloquent ORM, API resources, or queue systems. Invoke for Laravel models, Livewire components, Sanctum authentication, Horizon queues.
Firebase gives you a complete backend in minutes - auth, database, storage, functions, hosting. But the ease of setup hides real complexity. Security rules are your last line of defense, and they're often wrong. Firestore queries are limited, and you learn this after you've designed your data model. This skill covers Firebase Authentication, Firestore, Realtime Database, Cloud Functions, Cloud Storage, and Firebase Hosting. Key insight: Firebase is optimized for read-heavy, denormalized data. I
Build production-ready Node.js backend services with Express/Fastify, implementing middleware patterns, error handling, authentication, database integration, and API design best practices. Use when creating Node.js servers, REST APIs, GraphQL backends, or microservices architectures.
Use when building, configuring, or debugging enterprise Java applications with Spring Boot 3.x, microservices, or reactive programming. Invoke to implement WebFlux endpoints, optimize JPA queries and database performance, configure Spring Security with OAuth2/JWT, or resolve authentication issues and async processing challenges in cloud-native Spring applications.
This skill should be used when the user asks to "automate SQL injection testing," "enumerate database structure," "extract database credentials using sqlmap," "dump tables and columns from a vulnerable database," or "perform automated database penetration testing." It provides comprehensive guidance for using SQLMap to detect and exploit SQL injection vulnerabilities.
Generate a CVE catalog + Supabase impact analysis for a PostgreSQL security release. Use when reviewing a new upstream PG quarterly security release to decide what to ship and how to communicate. Inputs are the version ranges (e.g. REL_15_14..REL_15_18 + REL_17_6..REL_17_10); output is a draft catalog markdown ready to post on the breaking-change-analysis Linear ticket.
Take proyecto26/caching from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.