Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

http-caching

/http-caching

Pomaga poprawnie stosować cache HTTP z etagami, max-age i stale-while-revalidate, gdy odpowiedzi nie mają nagłówków cache, wdrożenie podało nieaktualne treści lub ruch rewalidacji jest duży.

Repozytorium
AI-SKILLS ↗
Licencja
MIT
Ostatnia zmiana repozytorium
05.09.2026

Ocena i bezpieczeństwo

90/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść25 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 05.09.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Pomaga poprawnie stosować cache HTTP z etagami, max-age i stale-while-revalidate, gdy odpowiedzi nie mają nagłówków cache, wdrożenie podało nieaktualne treści lub ruch rewalidacji jest duży.

Oryginalny opis (EN)

Use HTTP caching correctly with etags, max-age, and stale-while-revalidate so clients and proxies reuse responses without serving stale data. Use when responses lack cache headers, a bad deploy served stale content, or revalidation traffic is heavy.

Jak działa

  1. Method
  2. Checks
  3. Boundaries
Sekcje z nagłówków SKILL.md, w oryginale · 53 linii, 399 słów
Podgląd SKILL.md
---
name: http-caching
description: Use HTTP caching correctly with etags, max-age, and stale-while-revalidate so clients and proxies reuse responses without serving stale data. Use when responses lack cache headers, a bad deploy served stale content, or revalidation traffic is heavy.
---

# HTTP caching

HTTP already has a caching protocol; most bugs come from using half of it.
An endpoint with no `Cache-Control` gets cached by heuristic in ways you did
not choose, and an endpoint with `no-cache` everywhere throws away free
reuse. The job is to state freshness and validation explicitly so every
layer between server and user agrees on when a response is still good.

## Method

1. **Classify each response by who may store it.** Public and shareable gets
   `Cache-Control: public`; per-user gets `private`; secrets and one-shot
   tokens get `no-store`. Do not confuse `no-cache` (store, but revalidate
   before use) with `no-store` (never write it down). The wrong one leaks or
   wastes.
2. **Set `max-age` to the real tolerance for staleness.** Ask how many
   seconds a wrong answer is acceptable, and use that number. Fingerprinted
   assets take a year; a pricing feed takes 30 seconds. Add `s-maxage` when
   shared caches should hold it longer than browsers.
3. **Attach a validator so revalidation is cheap.** Emit a strong `ETag`
   (content hash) or `Last-Modified`. When the client sends
   `If-None-Match`, compare and return `304 Not Modified` with no body. A
   304 costs headers, not payload, and skips regeneration.
4. **Serve stale on purpose with `stale-while-revalidate`.** Pair it with
   `max-age` so the cache returns the slightly-old copy instantly and
   refetches in the background: `max-age=60, stale-while-revalidate=300`.
   Add `stale-if-error` to keep serving during an origin outage.
5. **Make ETags cheap and correct.** Hash the rendered body or a version
   plus key, not the wall clock. Never gzip after computing the ETag on the
   uncompressed body without marking `Vary: Accept-Encoding`, or two encodings
   collide on one tag.
6. **Verify with the actual request cycle.** `curl -sI` the endpoint, then
   replay with `-H 'If-None-Match: "<tag>"'` and confirm a 304. Check that a
   deploy which changes content also changes the ETag or the fingerprint.

## Checks

- Does every endpoint declare `Cache-Control` intentionally, with no route
  falling back to server defaults?
- Does a repeat request with `If-None-Match` return 304 and an empty body?
- Are `private`/`no-store` set on every authenticated or secret-bearing
  response, verified with a logged-in `curl -I`?
- Does changing the response body change its validator?

## Boundaries

This is response-header semantics for correctness and reuse. Edge topology,
purging, and origin shielding belong to cdn-strategy; application-level
memoization and object caches are performance-optimization territory.
Browser back-forward cache quirks defer to the target browser's documented
behavior.

Wersje

W bazie nie ma innych skilli o nazwie http-caching.

Migawka bazy z 13.11.2026 · wersja paczki 2023fc182138 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 90frontend-browser-caching
    Konfiguruje cache przeglądarki: nagłówki Cache-Control, service worker z wzorcem stale-while-revalidate, wersjonowane adresy i tryb offline.
  • 100caching-strategies
    Opisuje wzorce cache w aplikacjach: Redis, cache w pamięci, cache HTTP, CDN, unieważnianie, cache-aside, write-through i stale-while-revalidate.
  • 100caching-patterns
    Wdraża w Rails cache HTTP z ETagami, fragment caching, Russian doll caching i konfigurację Solid Cache, przy optymalizacji wydajności lub dodawaniu warstw cache.
  • 100nestjs-caching
    Wdraża wielopoziomowe cache, wzorce unieważniania i ochronę przed stampede w NestJS z Redis, cache-manager i stale-while-revalidate.
  • 100content-sdk-app-router-cache-components-and-osr
    Konfiguruje ponowne generowanie stron na żądanie w aplikacji Content SDK po publikacji, z kontraktem /api/revalidate i tagami cache.
  • 100phy-http-cache-audit
    Analizuje nagłówki cache HTTP dla dowolnego adresu URL lub lokalnego serwera: Cache-Control, ETag, Last-Modified, Vary, status cache CDN oraz możliwości stale-while-revalidate.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.