Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Caching Http?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/adityaaatiwari-caching-http)
---
description: Configure HTTP and CDN caching accurately using Cache-Control, ETag, Vary, immutable assets, and safe invalidation
profile: standard
tags: http, caching, performance, web
---
# HTTP caching
Use when setting response headers, CDN cache rules, or conditional requests on APIs and web assets.
## Directives and headers
- Serve content-hashed static assets with `Cache-Control: public, max-age=31536000, immutable` and HTML/entry documents with `no-cache` or short `s-maxage` + `stale-while-revalidate`.
- Mark personalized or authenticated JSON responses `Cache-Control: private, no-store` (or `private, max-age=...`) so shared CDNs never leak user data across callers.
- Set accurate `Vary` headers (e.g., `Accept-Encoding`, `Origin`) without keying on high-cardinality headers like raw `User-Agent` or `Cookie`.
## Validation and purging
- Emit strong `ETag` or `Last-Modified` validators on read-heavy endpoints and honor `If-None-Match` with `304 Not Modified`.
- Use surrogate keys (`Cache-Tag`) or versioned cache prefixes for instant invalidation when mutations happen.
## Verify
Inspect raw `curl -I` response headers, test `If-None-Match` -> `304`, and confirm authenticated responses are never stored publicly.