caching-strategy
Skill0 starsChanged 5 months agoMITView on GitHub
Adds caching that speeds reads without serving stale or wrong data. Use when a read is expensive and repeated, when adding or tuning a cache layer, or when debugging stale-data and invalidation bugs.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- Jinbae10/skillstheir own version, first seen Jul 7, 2026
- marcusgoll/Spec-Flowtheir own version, first seen Apr 23, 2026
- YepAPI/skillstheir own version, first seen Apr 12, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- marcusgoll/Spec-Flow★ 94same name
- YepAPI/skills★ 8same name
- Jinbae10/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository68 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/engineering-skills.mdcCursor rule
- marketing-routerSkill
- accessibilitySkill
- agent-guardrailsSkill
- agent-memorySkill
- agent-verificationSkill
- autonomous-loopsSkill
- browser-checksSkill
- context-curationSkill
- contract-testingSkill
- data-modelingSkill
- decision-docsSkill
- dependency-hygieneSkill
- design-handoffSkill
- e2e-testingSkill
- experimentationSkill
- fault-recoverySkill
- feature-flagsSkill
- finops-budgetSkill
- git-flowSkill
- hardeningSkill
- i18n-l10nSkill
- idea-shapingSkill
- incident-responseSkill
- incremental-deliverySkill
- interface-designSkill
- launch-campaignSkill
- launch-readinessSkill
- llm-feature-engineeringSkill
- long-running-agentsSkill
- community-engagementSkill
- content-marketingSkill
- email-nurtureSkill
- growth-strategySkill
- paid-adsSkill
- referral-loopSkill
- seo-growthSkill
- social-distributionSkill
- micro-interactionsSkill
- migration-pathSkill
- mobile-patternsSkill
- observabilitySkill
- orchestrated-deliverySkill
- parallel-subagentsSkill
- perf-budgetSkill
- pipeline-opsSkill
- product-briefSkill
- product-discoverySkill
- product-groomingSkill
- react-patternsSkill
- resilienceSkill
- review-gateSkill
- simplifySkill
- skill-creatorSkill
- skill-harvestSkill
- skill-routerSkill
- source-firstSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Don't reach for a cache first — confirm there's a measured read cost ([[perf-budget]]).
- Distinctive: line 29
Confirm it's worth caching: All three must be true: expensive read (measured), read-heavy access pattern, and explicitly acceptable …
- Very specific: line 43
Apply security rules for shared caches: No per-user or sensitive data in CDN/public cache without scoped keys and correct Cache-Control.
- Distinctive: line 49
When debugging stale data: identify the layer, inspect the key, trace every write path for invalidation, then reproduce with cache bypass.
- Distinctive: line 64
No defined invalidation strategy or missed write paths
- Distinctive: line 69
No hit-rate or miss-latency metrics.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Caching Strategy
A cache trades freshness and complexity for speed. Gains are real; invalidation bugs serve wrong data to users and are hard to reproduce. Cache deliberately — know what you're caching, for how long, and exactly how it becomes correct again.
The caching patterns reference has layer selection, invalidation models, key design, HTTP headers, stampede prevention, security, and the full checklist. Use this skill for decisions; use the reference while implementing.
When to Use
- A read is expensive (slow query, remote call, heavy computation) and happens repeatedly
- The same data is requested far more often than it changes
- Adding or tuning a cache layer (in-memory, Redis, HTTP/CDN, client data layer)
- Diagnosing stale data, thundering herd, or invalidation bugs
Don't reach for a cache first — confirm there's a measured read cost ([[perf-budget]]); often a better query or index ([[data-modeling]]) beats a cache. If the cache sits behind a network call, pair with [[resilience]] for timeouts and graceful degradation when the cache or origin fails.
Process
- Confirm it's worth caching. All three must be true: expensive read (measured), read-heavy access pattern, and explicitly acceptable staleness. Skip cheap reads, exactness-critical data, and huge rarely-reused working sets. See When to cache in the reference.
- Pick the narrowest layer that fits. Request memo → process memory → shared cache → HTTP/CDN → client — each adds scope and invalidation complexity. Don't stack layers without a reason. See the layer table in the reference.
- Choose invalidation before writing cache code. TTL, write-invalidate, versioned keys, event-driven purge, or stale-while-revalidate — pick one primary strategy and document what "correct again" means. No strategy = don't ship the cache.
- Design keys to include every dimension. Tenant, user, locale, params, version — a key that omits one serves wrong or leaked data. Namespace and hash large param sets. See Cache key design.
- Bound size and prevent stampedes. Eviction policy (LRU, TTL, max memory) so the cache can't grow without limit. Single-flight, TTL jitter, or SWR for hot keys so expiry doesn't crush the origin ([[resilience]]).
- Apply security rules for shared caches. No per-user or sensitive data in CDN/public cache without
scoped keys and correct
Cache-Control. Treat Redis entries as sensitive if they hold user data ([[hardening]]). - Instrument and verify. Hit rate, miss latency, evictions, stale serves. A low hit rate is cost without benefit — remove or fix keys/TTL ([[observability]]). Measure before/after on the hot path.
When debugging stale data: identify the layer, inspect the key, trace every write path for invalidation, then reproduce with cache bypass. See Debugging stale-data bugs in the reference.
Common Rationalizations
- "Add a cache, it'll be faster." — Without invalidation, users get stale or wrong data; debugging costs more than you saved.
- "TTL of an hour is fine." — Only if an hour of staleness is acceptable to the product; decide explicitly.
- "The key is just the id." — Missing tenant, locale, or version leaks or corrupts data across users.
- "Cache everything." — Cheap or rarely reused data adds complexity and memory for no measured gain.
- "We'll invalidate later." — Every write path you miss stays wrong until TTL; design invalidation first.
- "Redis is fast enough." — A stampede on miss turns Redis into a fuse to your database.
Red Flags
- Cache added before read cost was measured on the hot path
- No defined invalidation strategy or missed write paths
- Keys missing an input the cached value depends on
- Unbounded in-memory or Redis usage with no eviction
- Personalized responses cached as
publicor under a global key - Hot key expiry causing origin overload (no single-flight or jitter)
- No hit-rate or miss-latency metrics; stale bugs reported by users first
Verification
- Read is measured, read-heavy, expensive, and staleness tolerance is documented
- Layer matches scope; invalidation strategy is explicit and implemented on all write paths
- Keys include every dimension; size bounded; stampedes mitigated
- Shared/CDN cache respects security scoping and Cache-Control rules
- Hit rate and latency instrumented; before/after numbers justify the cache
- Reference checklist completed for the change
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

