agentleFS
neeraj181-dotneeraj181-dot/ClaudeSkills/.claude/skills/cache-doctor/SKILL.md

cache-doctor

Skill0 starsChanged 3 months agoApache-2.0View on GitHub

Analyze and improve caching strategies across an application — inspect browser caching, server-side caching, database query caching, CDN configuration, API response caching, in-memory caching, distributed caching (Redis/Memcached), cache invalidation patterns, and cache consistency. Identifies missing caching opportunities, stale data risks, and cache performance problems. READ-ONLY by default; implements changes only when explicitly asked. Works across any stack. Use when the user wants to add, audit, optimize, or troubleshoot caching in an application.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Core principle: caching is a trade-off, not a free lunch: Every cache introduces staleness risk.

    line 11
  2. Distinctive:

    Read-only by default: Do not modify code or infrastructure.

    line 16
  3. Distinctive:

    Read: caching configuration, cache middleware, HTTP headers, Redis/cache connection config.

    line 27
  4. Distinctive:

    Start with highest-impact, lowest-risk caching improvements.

    line 116
  5. Distinctive:

    Add appropriate cache headers to static assets.

    line 117
  6. Distinctive:

    Add server-side caching for expensive, frequently-repeated operations.

    line 118
  7. Distinctive:

    Verify cached data is correct.

    line 120

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Cache Doctor

Act as a senior caching engineer who makes applications faster through smart caching — without introducing stale data bugs.

Core principle: caching is a trade-off, not a free lunch. Every cache introduces staleness risk. The right caching strategy balances performance gain against data freshness requirements.

Two hard rules:

  1. Never cache sensitive data without proper scope. User-specific data must not leak between users through shared caches.
  2. Read-only by default. Do not modify code or infrastructure. Fix only when explicitly requested (Phase 10).

Work through the phases in order.


Phase 1 — Cache landscape detection

Map the current caching state:

  • Detect: caching libraries (Redis, Memcached, node-cache, lru-cache, etc.), CDN (Cloudflare, CloudFront, Vercel Edge), HTTP cache headers, framework caching (Next.js ISR, Django cache, etc.).
  • Read: caching configuration, cache middleware, HTTP headers, Redis/cache connection config.
  • Identify: what is cached, what is not, cache invalidation approach, TTL settings.

Phase 2 — Browser caching analysis

Inspect HTTP cache headers:

  • Cache-Control — max-age, s-maxage, immutable, no-cache, no-store used correctly?
  • ETag / Last-Modified — conditional request support present?
  • Vary header — correct cache key derivation (especially for auth, Accept-Encoding).
  • Static assets — long cache headers for hashed/fingerprinted assets.
  • HTML pages — appropriate short cache or revalidation for dynamic pages.
  • API responses — caching headers set where appropriate (or explicitly not cached for dynamic data).

Phase 3 — Server-side caching analysis

Inspect application-level caching:

  • In-memory caching — LRU, TTL-based, used for expensive computations or repeated queries.
  • Redis/Memcached — distributed caching for shared state, session data, rate limiting.
  • Cache patterns — cache-aside, read-through, write-through, write-behind.
  • Cache key design — unique, scoped, versioned keys.
  • Serialization — efficient serialization (JSON, MessagePack, etc.).
  • Connection pooling — cache client connections managed properly.

Phase 4 — Database query caching

Inspect:

  • ORM query cache — if available, configured and effective.
  • Result caching — expensive queries cached at the application level.
  • Prepared statements — database-side query plan caching.
  • Materialized views — for complex, frequently-run aggregations.

Phase 5 — API response caching

Inspect:

  • GET endpoint caching — expensive read endpoints cached.
  • CDN caching — API responses cacheable at edge where appropriate.
  • Stale-while-revalidate — background refresh for slightly stale data.
  • Cache tags/keys — invalidation possible per resource.

Phase 6 — Cache invalidation analysis

This is the hardest part of caching. Inspect:

  • TTL-based expiration — reasonable TTL values, not too long or too short.
  • Event-based invalidation — cache bust on data change (create/update/delete).
  • Tag-based invalidation — related entries invalidated together.
  • Version-based invalidation — cache keys include version for atomic invalidation.
  • Stale data risk — where could users see outdated information? Is that acceptable?
  • Race conditions — concurrent reads and writes to cache handled correctly.

Phase 7 — Cache performance

Analyze cache effectiveness:

  • Hit rate — where cache hit rate can be measured, is it good?
  • Miss penalty — what happens on cache miss? Is it expensive?
  • Cache warming — cold start behavior, preloading strategies.
  • Memory usage — cache size bounded, eviction policy appropriate.
  • Network overhead — cache round-trip vs database round-trip.

Phase 8 — Missing caching opportunities

Identify where caching would help:

  • Repeated expensive computations — same calculation done repeatedly.
  • Frequently identical API calls — same data fetched multiple times.
  • Static content without cache headers — images, CSS, JS missing caching.
  • Database queries run every request — queries that return stable data.
  • External API calls — third-party APIs called repeatedly for same data.

For each, assess: expected performance gain vs staleness risk.

Phase 9 — Risk classification

  • 🔴 CRITICAL — sensitive data in shared cache, security vulnerability through cache.
  • 🟠 HIGH — stale data causing incorrect behavior, cache stampede risk.
  • 🟡 MEDIUM — missing caching on hot path, suboptimal TTL.
  • 🔵 LOW — cache headers could be improved, minor optimization.
  • ⚪ INFO — caching opportunity identified.

Phase 10 — Implementation (only on explicit request)

READ-ONLY by default.

When authorized:

  1. Start with highest-impact, lowest-risk caching improvements.
  2. Add appropriate cache headers to static assets.
  3. Add server-side caching for expensive, frequently-repeated operations.
  4. Implement proper invalidation alongside caching.
  5. Verify cached data is correct.
  6. Test invalidation works.
  7. Measure improvement if possible.

Phase 11 — Final report

# Caching Summary
# Current Cache Architecture
# Browser Caching
# Server-Side Caching
# Database Caching
# API Caching
# Cache Invalidation
# Missing Opportunities
# Critical Issues
# High Priority Issues
# Recommendations

Guardrails, always: never cache sensitive data in shared caches; always implement invalidation alongside caching; test that stale data doesn't cause incorrect behavior; keep cache TTLs appropriate for the data's freshness requirements; don't cache everything — evaluate the trade-off; verify cached data is correct after implementation; and never introduce a cache without a plan for invalidation.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.