skills/council/tuner/caching-strategy/SKILL.md
Use when designing or auditing a caching architecture. Covers multi-layer cache hierarchy, key schema, TTL policies, invalidation flows, and warming strategies. Do not use for runtime performance profiling (use performance-audit) or capacity planning (use load-modeling).
npx skillsauth add dtsong/my-claude-setup caching-strategyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Design a multi-layer caching architecture that minimizes latency and server load while maintaining data freshness. Produces a cache hierarchy diagram, key schema, TTL policy table, and invalidation flow for each cacheable resource.
No user-provided values are used in commands or file paths. All inputs are treated as read-only analysis targets.
Inventory all resources served by the application:
For each resource, document the read:write ratio and acceptable staleness window.
Define what is cached at each layer, from closest to the user outward:
Document which layer is the primary cache for each resource type.
Design consistent, collision-free cache keys:
page:blog:slug:v2:locale:en)page:blog:*)Assign time-to-live values based on staleness tolerance:
Document TTL as both max-age and s-maxage where CDN behavior differs from browser.
Define how stale cache entries are removed or refreshed:
Map each resource to its invalidation method. Document the mutation-to-purge flow.
Design graceful degradation for cache misses:
stale-while-revalidate? Define the stale window.Cache-Control header construction for each resource classPlan for empty caches after deployments, CDN purges, or scaling events:
Compaction resilience: If context was lost during a long session, re-read the Inputs section to reconstruct what system is being analyzed, check the Progress Checklist for completed steps, then resume from the earliest incomplete step.
# Caching Strategy: [Application Name]
## Cache Hierarchy
[User] → Browser Cache → CDN/Edge → App Cache → DB Query Cache → [Database]
| Layer | Resources Cached | TTL Range | Invalidation |
|-------|-----------------|-----------|-------------|
| Browser | ... | ... | ... |
| CDN/Edge | ... | ... | ... |
| Application | ... | ... | ... |
| DB Query | ... | ... | ... |
## Cache Key Reference
| Resource Type | Key Pattern | Variants | Example |
|--------------|-------------|----------|---------|
| ... | ... | ... | ... |
## TTL Policy Table
| Resource | Browser max-age | CDN s-maxage | stale-while-revalidate | Rationale |
|----------|----------------|-------------|----------------------|-----------|
| ... | ... | ... | ... | ... |
## Invalidation Flows
### [Resource Type]
1. Mutation occurs in [source]
2. [Event/webhook] triggers cache purge
3. [Layer] invalidates entries matching [pattern]
4. Next request triggers revalidation
## Cache Warming Plan
| Resource | Method | Trigger | Priority |
|----------|--------|---------|----------|
| ... | ... | ... | ... |
## Cache-Control Headers
| Route Pattern | Cache-Control Value |
|--------------|-------------------|
| ... | ... |
development
Use when planning implementation steps, deciding commit format, or structuring development approach. Provides brainstorm-plan-implement flow with conventional commits. Triggers on 'how should I approach this', 'commit format'.
development
Security audit checklist for web applications. Use when reviewing, auditing, or hardening a web app's security posture. Covers rate limiting, auth headers, IP blocking, CORS, security middleware, input validation, file upload limits, ORM usage, and password hashing. Triggers on requests like "review security", "harden this app", "security audit", "check for vulnerabilities", or when building/reviewing API endpoints.
development
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
development
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.