netlify avatar

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-code

Installs 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-Control applies to the Netlify CDN only. Reach for this.
  • CDN-Cache-Control applies to all CDNs that support it.
  • Cache-Control applies 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

More from netlify/context-and-tools

All 14
1ailabs-393 avatarresearch-paper-writerailabs-393/ai-labs-claude-skillsCreates formal academic research papers following IEEE/ACM formatting standards with proper structure, citations, and scholarly writing style. Use when the user3.3Kskills.sh installs
2netlify avatarnetlify-blobsnetlify/context-and-toolsGuide for using Netlify Blobs for file and asset storage — images, documents, uploads, exports, cached binary artifacts. Covers getStore(), CRUD operations, met3.3Kskills.sh installs
3netlify avatarnetlify-image-cdnnetlify/context-and-toolsGuide for using Netlify Image CDN for image optimization and transformation. Use when serving optimized images, creating responsive image markup, setting up use3.3Kskills.sh installs
4apollographql avatarapollo-mcp-serverapollographql/skillsGuide for using Apollo MCP Server to connect AI agents with GraphQL APIs. Use this skill when: (1) setting up or configuring Apollo MCP Server, (2) defining MCP3.3Kskills.sh installs
5astral-sh avatartyastral-sh/claude-code-pluginsGuide for using ty, the extremely fast Python type checker and language server. Use this when type checking Python code or setting up type checking in Python pr3.3Kskills.sh installs
6anthropics avataraudit-supportanthropics/knowledge-work-pluginsSupport SOX 404 compliance with control testing methodology, sample selection, and documentation standards. Use when generating testing workpapers, selecting au3.3Kskills.sh installs