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

prompt-caching

/prompt-caching

Obniża koszt i opóźnienie wywołań LLM przez cache'owanie stałych prefiksów promptów i takie układanie promptów, żeby cache trafiał.

Repozytorium
AI-SKILLS ↗
Licencja
MIT
Ostatnia zmiana repozytorium
05.09.2026

Ocena i bezpieczeństwo

100/ 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ść35 / 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

Obniża koszt i opóźnienie wywołań LLM przez cache'owanie stałych prefiksów promptów i takie układanie promptów, żeby cache trafiał.

Oryginalny opis (EN)

Cut LLM cost and latency by caching stable prompt prefixes, structuring prompts so the cache actually hits. Use when the same system prompt, tools, or examples repeat across calls and cost or time-to-first-token matters.

Jak działa

  1. Method
  2. Boundaries
Sekcje z nagłówków SKILL.md, w oryginale · 50 linii, 416 słów
Podgląd SKILL.md
---
name: prompt-caching
description: Cut LLM cost and latency by caching stable prompt prefixes, structuring prompts so the cache actually hits. Use when the same system prompt, tools, or examples repeat across calls and cost or time-to-first-token matters.
---

# Prompt caching

Providers can cache a stable prefix of the prompt and skip recomputing it,
cutting input cost sharply and shrinking time-to-first-token. The win is
real but conditional: it only applies to the exact repeated prefix, so
prompts must be structured to keep that prefix stable.

## Method

1. **Put the stable content first, the variable content last.** System
   prompt, tool definitions, and few-shot examples at the top (they
   rarely change); the user's turn and per-request data at the bottom.
   The cache matches from the start, so a single early change (a
   timestamp, a shuffled example) invalidates everything after it (see
   context-engineering's stable-prefix rule).
2. **Freeze the prefix byte-for-byte.** Caching keys on exact content:
   avoid injecting the current time, request IDs, randomized example
   order, or reformatted whitespace into the cached region. What varies
   per call belongs after the cache boundary, not woven through it.
3. **Know your provider's mechanism and thresholds.** Providers differ on
   whether caching is automatic or explicitly marked, the minimum
   cacheable size, the cache lifetime (often minutes), and the discount.
   Read the current contract for your platform rather than assuming (your
   provider's documentation is the authority).
4. **Design multi-turn and agent loops to reuse the prefix.** In a
   conversation or an agent loop (see agentic-loops), the growing history
   after the fixed prefix still lets the prefix hit; keep the system
   layer stable across turns so every call reuses it. Frequent
   system-prompt edits forfeit the cache on every turn.
5. **Verify hit rates, do not assume them.** Instrument cached-token
   counts in telemetry (see llm-observability); a prompt you believe is
   cached but is not (a stray variable in the prefix) pays full price
   silently. Measure before and after structuring for caching.
6. **Fold caching into the cost model.** Cached input is much cheaper than
   fresh input but not free, and output tokens are unaffected: caching
   attacks the input and latency side, and combines with model tiering,
   prompt diet, and batching (see llm-cost-latency for the full toolkit).

## Boundaries

- Caching reduces cost and latency; it changes nothing about output
  quality or correctness, and must never be a reason to bloat the stable
  prefix with content the task does not need (see context-engineering).
- Cache lifetimes are short: bursty repeated traffic benefits most;
  widely-spaced calls may never hit, so do not over-engineer for it.
- Semantic caching (returning a stored answer for a similar question) is
  a different technique with its own freshness and correctness risks; do
  not conflate it with prefix caching (see llm-cost-latency).

Wersje

RepozytoriumWynikLicencja
Ta strona · Amey-Thakur/AI-SKILLS100MIT
cestercian/claude-playbook-skills100MIT
latestaiagents/agent-skills100MIT
cobusgreyling/agent-skills100Apache-2.0
rootcastleco/rei-skills90MIT
davila7/claude-code-templates90MIT
archive228/loopkit90MIT

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

Pobrania w ostatnich 30 dniach: 3 · ranking

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

Podobne skille

  • 100llm-cost-latency
    Obniża koszt i opóźnienia LLM przez cache, dobór poziomu modelu, skracanie promptów, batching i strumieniowanie w interfejsie.
  • 100prompt-caching-patterns
    Pomaga wdrożyć cache'owanie w aplikacjach LLM: cache semantyczny, cache odpowiedzi i strategie ograniczające koszty powtarzanych promptów.
  • 100llm-caching-strategies
    Dobiera strategie cache dla aplikacji LLM: buforowanie promptów i prefiksów u dostawcy, semantyczny cache odpowiedzi, progi podobieństwa, bramki zakresu i unieważnianie, by obniżyć koszt i opóźnienia.
  • 100cost-latency-optimization-prompt-caching
    Obniża koszty tokenów LLM i opóźnienia dzięki buforowaniu promptów u dostawcy, kaskadom modeli i interfejsom wsadowym.
  • 100llm-cost-optimization
    Obniża koszt funkcji opartej na LLM: cache promptów, redukcja kontekstu, routing modeli, batching, limity wyjścia i znajdowanie, gdzie naprawdę idą tokeny.
  • 100prompt-caching-strategy
    Optymalizuje współczynnik trafień cache promptów: analizuje strukturę promptu, wskazuje treści nadające się i nienadające się do cache'owania i proponuje przebudowę dla OpenAI, Anthropic i innych dostawców.

Uwagi i zgłoszenia

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