netlify-caching

Configure CDN cache headers, cache tags, and on-demand purging for Netlify deployments.

Updated Jul 16, 2026
One-click install
npx skills add https://github.com/JamesMitofsky/tag-archive --skill netlify-caching-jamesmitofsky
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: netlify-caching
Source: https://github.com/JamesMitofsky/tag-archive/tree/main/.claude/skills/netlify-caching
Command: npx skills add https://github.com/JamesMitofsky/tag-archive --skill netlify-caching-jamesmitofsky

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @netlify/functions.

What problem does it solve? Dynamic responses on Netlify are not cached by default, and misconfigured cache headers silently fragment the CDN cache or get wiped on every deploy. This Skill provides the exact header patterns, purge APIs, and debugging steps needed to control Netlify's CDN caching correctly. ## Core Features & Use Cases - Cache Header Patterns: Ready-to-use Netlify-CDN-Cache-Control, Cache-Control, and durable cache configurations for functions and static assets, including stale-while-revalidate. - On-Demand Purge: Tag responses with Netlify-Cache-Tag and invalidate them via purgeCache(), including how to pass a personal access token when running outside the Netlify Functions runtime. - Cache Key Control: Use Netlify-Vary to key cache entries on specific query params, cookies, headers, country, or language, and prevent tracking parameters from fragmenting the cache. - Use Case: A product listing API served by a Netlify Function is slow under load. Add Netlify-CDN-Cache-Control: public, s-maxage=86400 with a Netlify-Cache-Tag: product header, then purge by tag whenever inventory changes. ## Quick Start Ask the assistant to add CDN caching with a purge tag to a Netlify Function response using the netlify-caching guidance.

Frequently Asked Questions about netlify-caching

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I cache a Netlify Function response on the CDN?

Set the Netlify-CDN-Cache-Control header on the response, for example 'public, s-maxage=3600, must-revalidate'. Dynamic responses are not cached by default, and only GET requests are ever cached by Netlify's CDN.

How do I purge the Netlify cache on demand?

Tag responses with the Netlify-Cache-Tag header, then call purgeCache({ tags: [...] }) from @netlify/functions. Outside the Netlify Functions runtime you must pass a personal access token and site ID explicitly.

Why is Netlify caching not working in local development?

netlify dev does not emulate the CDN cache, so headers pass through untouched and nothing is stored locally. Verify caching on a deployed URL or Deploy Preview by inspecting the Cache-Status response header.

Does Netlify cache POST request responses?

No. Netlify's CDN caches only GET requests regardless of cache headers. To make a response cacheable, expose it on a GET route with inputs in the URL or query string.

How do I keep a cached response across Netlify deploys?

Set a Netlify-Cache-ID header on the response. This excludes it from automatic deploy-based invalidation, and the ID doubles as a purge tag so you can clear it explicitly with purgeCache.

Why do query parameters fragment my Netlify cache?

The full query string is part of the cache key by default, so tracking params like utm_source create duplicate entries. Add Netlify-Vary: query=<names> listing only parameters that affect the response.