caching-strategy
Design caching layers — HTTP caching, CDN, application memory caches, invalidation patterns, and cache-coherence reasoning.
Skill by xanstomper
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/xanstomper-caching-strategy
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design, data
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/caching-strategy
What's inside
- Skill name
caching-strategy- Description
- Design caching layers — HTTP caching, CDN, application memory caches, invalidation patterns, and cache-coherence reasoning. Use when adding caching to fix performance, debugging stale-data bugs, or designing cache keys/TTLs.
- License
- MIT
- Instructions
- 35 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Caching Strategy Procedure
There are only two hard problems in computer science, and this skill is about both of them. The discipline: know what invalidates your data, encode it in keys/TTLs, and measure the hit rate.
## 1. Classify the data before caching it
- Immutable/append-only (compiled assets, historical records): cache forever (immutable + content-hash keys). This is the free win.
- Read-heavy, tolerate staleness (catalogs, profiles, config): TTL 30s-15min + explicit purge on write.
- Must-be-fresh (balances, inventory, permissions): don't cache, or cache with write-through invalidation and short TTL — and measure whether the cache actually helps before keeping it.
## 2. Key design (the #1 cache bug source)
- Keys include EVERYTHING that changes the response: identity, params, locale, tenant, feature flags. A missing key dimension = data leaks across users (the classic authz bug).
- Key normalization: sort params, strip defaults, canonicalize case. Key collisions are silent correctness bugs.
- Vary-with-care: `Vary` header / cache scopes must match the actual request variability, not a superset (kills hit rate) or subset (kills correctness).
## 3. Layer-by-layer defaults
- HTTP: static assets -> `Cache-Control: public, max-age=31536000, immutable` + hashed filenames. HTML/API -> `no-store` for personalized, `max-age=0, must-revalidate` + ETag for shared. Never `Expires` alone.
- CDN: respect origin headers; purge API for deploy-triggered invalidation; stale-while-revalidate for latency-critical pages (stale content beats error pages).
- Application memory (LRU per process): only for hot small objects (config, feature flags); bounded size MANDATORY (unbounded maps are the leak); TTL short (the coherence radius is one process).
- Shared store (Redis/Memcached): for cross-process state; watch for hot keys (single key = single shard = your bottleneck; shard by suffix or use local + pub-sub refresh).
## 4. Invalidation patterns
- Event-driven purge beats TTL-guessing: on write, publish an invalidation event (or use versioned keys — bump the version, old entries age out).
- Versioned keys are the general solution: `user:{id}:profile:v{profileVersion}` — writes bump the version, invalidation becomes O(1), stale reads impossible.
- Stampede protection: single-flight (per-key in-process mutex) or probabilistic early expiry (`XLA`-style). A thundering herd after TTL expiry is a self-inflicted DDoS.
## 5. Measure or delete
- Hit rate per key class, p50/p99 with and without cache, backend load reduction. A cache with <20% hit rate on a cheap backend is pure liability.
- Stale-bug triage: trace the data's write path — which layer still holds the old value? (browser, CDN, app LRU, Redis, DB replica). Each layer needs its own invalidation story; "cleared the cache" that skipped a layer recreates the bug in hours.
## Pitfalls
- Caching errors/negative results without a short TTL: an outage response cached for 15 minutes extends the outage by 15 minutes.
- Cache-aside with write-through-to-DB on read path: the classic race (read miss -> stale write-back). Prefer versioned keys.
- Personalized data cached at a shared layer without identity in the key: an immediate security incident, not a perf bug.From xanstomper/mochi, MIT.
More from xanstomper/mochi
- 0.587score
accessibility-audit
xanstomper
Audit and fix accessibility (a11y) — WCAG 2.2 AA compliance, screen-reader flows, keyboard navigation, and ARIA correctness for web apps.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-backwards-compatibility
xanstomper
Change APIs without breaking existing clients — deprecation windows, additive changes, and safe removal.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-design
xanstomper
Design public APIs and CLIs — naming, ergonomics, versioning, error surfaces, and backward-compat discipline.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-integration
xanstomper
Integrate third-party APIs correctly — auth patterns, retry/backoff, pagination, rate limits, idempotency, and contract testing.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-security-hardening
xanstomper
Secure web APIs and backends — authz enforcement, injection prevention, rate limiting, secret handling, and the OWASP-class checks that block real attacks.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-versioning
xanstomper
Evolve APIs without breaking clients — additive change first, deprecation windows, compatibility shims, and migration paths.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
async-concurrency
xanstomper
Design correct async and concurrent code — bounded parallelism, backpressure, cancellation, and deadlock avoidance.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
auth-implementations
xanstomper
Implement authentication correctly — session/JWT/OAuth/SSC flows, password handling, MFA, and the failure modes that become breaches.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
benchmark-methodology
xanstomper
Honest benchmarking with TTFF/TTFI/PSS probes — cold start, token throughput, prompt-to-first-token.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
browser-automation
xanstomper
Automate real browsers for testing and scraping — Playwright-first flows, selector strategy, waiting discipline, and anti-flake patterns.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
chaos-engineering
xanstomper
Prove a system survives failure by injecting it deliberately — game days, fault injection, and steady-state hypotheses.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
checkpoint-semantics
xanstomper
Git-backed checkpoints and rollback composition — naming, nesting, conflicts, when to auto-commit.
SkillAFreshness: A★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 2
- Open issues
- 6
- Last commit (this folder)
- Oct 12, 2026 (16 days ago)
- Last release
- Oct 23, 2026 (5 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/xanstomper/mochi
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from xanstomper
- 0.587score
api-backwards-compatibility
xanstomper
Change APIs without breaking existing clients — deprecation windows, additive changes, and safe removal.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-design
xanstomper
Design public APIs and CLIs — naming, ergonomics, versioning, error surfaces, and backward-compat discipline.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-integration
xanstomper
Integrate third-party APIs correctly — auth patterns, retry/backoff, pagination, rate limits, idempotency, and contract testing.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-security-hardening
xanstomper
Secure web APIs and backends — authz enforcement, injection prevention, rate limiting, secret handling, and the OWASP-class checks that block real attacks.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-versioning
xanstomper
Evolve APIs without breaking clients — additive change first, deprecation windows, compatibility shims, and migration paths.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
accessibility-audit
xanstomper
Audit and fix accessibility (a11y) — WCAG 2.2 AA compliance, screen-reader flows, keyboard navigation, and ARIA correctness for web apps.
SkillAFreshness: A★ 1Claude Code +9
Cite this page
caching-strategy skill. Agent Mart. https://agentmart.dev/skills/xanstomper-caching-strategy (last updated 2026-10-24)