Index of every page on this site: llms.txt
All skills
Run it yourself

Designs, audits and implements caching for a specific website or app across every layer, including HTTP/browser headers (Cache-Control, ETag, Vary), service workers, CDNs and edge (Cloudflare, Vercel, Netlify, Fastly, CloudFront, Akamai), nginx/Varnish, in-process and Redis/Valkey/Memcached caches, database and ORM caches, framework caching (Next.js use cache/ISR, Nuxt, SvelteKit, Astro, Rails, Django, Laravel, Spring, ASP.NET), CMS, REST/GraphQL APIs, mobile clients, LLM prompt and semantic caching, and CI build caches. Detects the stack, classifies every route, and writes a validated caching plan covering invalidation, stampede protection, cache security and verification. Use when the user mentions caching, stale content, purging, CDN or Redis setup, or when pages are slow, TTFB is high, or origin, database or hosting costs are too high, even if they never say "cache". Not for clearing local package-manager caches or explaining CPU caches.

  • 81 files
  • 630.9 KB
  • MIT
  • Updated 4 weeks ago
  • GitHub
Use this Skill: https://skilld.dev/gh/onlymoein/master-cache-skill/caching-strategy

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencescmsshopify-hydrogen.md

≈1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Shopify (Hydrogen and Liquid themes)

Last reviewed: 2026-10-27 · Applies to: Hydrogen on React Router 7 / Oxygen; Storefront API; Liquid Online Store themes

When to read this

When the storefront is Shopify: a Hydrogen app (custom React storefront on Oxygen or another host) or a Liquid theme.

How to detect

package.json with @shopify/hydrogen, @shopify/remix-oxygen/@shopify/hydrogen-react, @shopify/cli; server.ts/app/entry.server.tsx with createStorefrontClient; .shopify/ or oxygen deploy config. Liquid themes: layout/theme.liquid, sections/, templates/*.json, config/settings_schema.json.

Default recipe (Hydrogen)

import { CacheLong, CacheShort, CacheNone, CacheCustom } from '@shopify/hydrogen'

// Product data: long cache with SWR (subrequest cache, not the browser)
const { product } = await context.storefront.query(PRODUCT_QUERY, {
  variables: { handle },
  cache: CacheLong(),               // max-age=3600, stale-while-revalidate=82800
})

// Inventory-sensitive data
const { product: stock } = await context.storefront.query(STOCK_QUERY, {
  variables: { handle },
  cache: CacheShort(),              // short max-age + SWR
})

// Cart, customer account: never cached
const cart = await context.cart.get()              // uses CacheNone internally

// Third-party API with the same cache
const reviews = await context.withCache.fetch(`https://reviews.example.com/p/${handle}`, {},
  { cacheKey: ['reviews', handle], cacheStrategy: CacheCustom({ maxAge: 300, staleWhileRevalidate: 3600 }),
    shouldCacheResponse: (body) => !body?.errors })

Document responses: set Cache-Control in route headers() exports (React Router conventions, references/frameworks/react-router-remix.md) — public only for anonymous pages; private, no-store for account, cart and checkout.

Rules and gotchas

  1. Hydrogen cache strategies apply to sub-requests (Storefront API, withCache), not to the HTML response. The HTML document's caching is set separately via headers.
  2. CacheNone() for anything with buyer identity (cart, customer, B2B company location pricing) and for queries with buyerIdentity/country/language context unless the cache key includes them.
  3. Markets, currencies and languages change product prices: queries using @inContext(country:, language:) produce different results; caching them under one key mixes prices.
  4. Don't use CacheLong for inventory or price-sensitive flash sales; use CacheShort or webhook-driven invalidation of your own caches.
  5. Customer Account API and checkout are never cached.
  6. The sub-request cache's behavior on non-Oxygen hosts depends on the cache implementation you pass to createStorefrontClient (cache); verify on your host.

Liquid themes

The Online Store platform cache for Liquid themes isn't configurable by merchants (unverified detail); you control asset fingerprinting (asset_url adds versions) and what JavaScript fetches client-side. Keep personalized bits (cart drawer counts, customer name) in client-side fetches (/cart.js, section rendering API) instead of trying to cache-bust pages.

Version notes

  • Hydrogen moved from Remix to React Router 7 (2025). Cache strategy helpers unchanged.
<details><summary>Old patterns</summary>
  • Hydrogen v1 (React Server Components) CacheMinutes/CacheHours helpers.
  • @shopify/remix-oxygen loaders on Remix v2.
</details>

Verify

curl -s -o /dev/null -D - https://shop.example.com/products/x | grep -iE 'cache-control|age|oxygen|x-cache'
curl -s -o /dev/null -D - https://shop.example.com/cart | grep -i cache-control   # private/no-store

Sources

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 46a6ee6. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 weeks ago.

Activeupdated 4 weeks ago
metadata
{
  "version": "1.1.1",
  "last-reviewed": "2026-10-28"
}
Other metadata
compatibility
Live header probes need network access and user-supplied URLs; every other step runs offline with the Python 3 standard library.

README badge

README badge for onlymoein/master-cache-skill