
Netlify Caching
Teaches Claude how to configure caching on Netlify's CDN, covering both static assets and dynamic responses from functions. You'll want this when you're setting cache headers, implementing stale-while-revalidate patterns, or using on-demand purge with cache tags. The skill distinguishes between the three cache control headers (Netlify-CDN-Cache-Control, CDN-Cache-Control, and Cache-Control) and explains when each applies. It also covers durable cache for serverless functions, cache key variation with Netlify-Vary, and framework-specific behavior for Next.js ISR, Astro, Remix, and Nuxt. Honestly, the most useful part is the table showing which headers get stripped at which layer, since that's easy to get wrong.
- skills.sh installs
- 3.3K
- GitHub stars
- 51
- last updated
- Aug 21, 2026
Install
$ npx -y skills add netlify/context-and-tools --skill netlify-caching --agent claude-codeInstalls into .claude/skills of the current project.
Files
Netlify caching
Cache-control header to reach for
Dynamic responses (Functions, Edge Functions, proxies) are NOT cached by default. You must opt in. Set Netlify-CDN-Cache-Control on the response:
import type { Context } from "@netlify/functions";
export default async (req: Request, context: Context) => {
return new Response("Hello world", {
headers: {
'Netlify-CDN-Cache-Control': 'public, durable, max-age=60, stale-while-revalidate=120'
}
});
};
Header choice (most specific wins; CDN-Cache-Control/Cache-Control always pass downstream):
Netlify-CDN-Cache-Controlapplies to the Netlify CDN only. Reach for this.CDN-Cache-Controlapplies to all CDNs that support it.Cache-Controlapplies to any CDN or the browser.
Legacy path to avoid: On-demand Builders do not support these headers or Netlify-Vary. They use a TTL pattern and key on URL path only. Don't reach for ODBs in new code.
Footguns (read first)
Sponsors
Details
- Repository
- github.com/netlify/context-and-tools
- Categories
- Documentation, Cloud & Infrastructure
- First seen
- Jun 3, 2026