cache-tune
/cache-tune
Przygotowuje agenta Claude Code do trafień w cache promptów przy powtarzalnych zadaniach, bez zmiany jego działania, z pomiarem przed i po.
- Autor
- undefined-ui ↗
- Repozytorium
- cache-tune ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 30.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 7
- Skrypty
- 3
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 30.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
- 3 skrypty w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.
Skrypty: scripts/audit.sh, scripts/bench.sh, templates/setup.example.sh
Co robi i kiedy
Przygotowuje agenta Claude Code do trafień w cache promptów przy powtarzalnych zadaniach, bez zmiany jego działania, z pomiarem przed i po.
Oryginalny opis (EN)
Make a Claude Code agent's prompt cache-friendly so repeated headless runs (claude -p jobs, CI review bots, scheduled agents, claude-code-action workflows) read the prompt cache instead of writing it again, without changing what the agent does. Audits CLAUDE.md, AGENTS.md, .claude/settings.json, MCP servers, skills, subagents and job scripts, proposes a plan, applies it only after the user confirms, shows the diff, and benchmarks before against after. Use when the user wants to cut the cost of a claude -p job, says cache writes dominate their bill, sees a low cache hit rate, or asks to make th
Jak działa
- Rules
- Workflow
Podgląd SKILL.md
--- name: cache-tune description: Make a Claude Code agent's prompt cache-friendly so repeated headless runs (claude -p jobs, CI review bots, scheduled agents, claude-code-action workflows) read the prompt cache instead of writing it again, without changing what the agent does. Audits CLAUDE.md, AGENTS.md, .claude/settings.json, MCP servers, skills, subagents and job scripts, proposes a plan, applies it only after the user confirms, shows the diff, and benchmarks before against after. Use when the user wants to cut the cost of a claude -p job, says cache writes dominate their bill, sees a low cache hit rate, or asks to make their agent setup cache-friendly. Do not use to tune an interactive session, to pick a cheaper model or effort level, or to change the agent's rules or task. --- # cache-tune Cuts the cost of repeated agent runs by changing how the prompt is assembled. `<skill-dir>` below is the base directory Claude Code shows when this skill loads. ## Rules - Change assembly only: where text sits, which tools load, the output format. Do not reword, add or drop rules. Do not remove a tool, MCP server, skill or subagent the job uses. Do not touch model, effort, max turns or permissions. - Read-only until the user approves the plan: no edits, no git changes, no installs. - Apply only what the user approved. If applying needs a change the plan does not list (a `cd`, a path fix, an extra flag), stop and ask first. - Every `claude` call costs money. Before a probe or a benchmark, say how many calls it makes and ask. ## Workflow ### 1. Audit Run `bash <skill-dir>/scripts/audit.sh <project-dir>`. It lists context files with sizes, settings, MCP config, skills, subagents, headless invocations, and lines with per-run values. Then read each job it found (shell script, CI workflow, Makefile target, cron entry) and write down its request in send order, as in [reference/prompt-layout.md](reference/prompt-layout.md): tools, system prompt, first user message. No job found: ask which command runs the agent. If there is none, say there is nothing to tune and stop. Optional, ask first: `bash <skill-dir>/scripts/bench.sh --probe <setup.sh>` makes one short haiku call and prints the tools, MCP servers and skills the job loads and the size of its fixed prefix. ### 2. Report One table: finding, `file:line`, why it costs, fix. Flag: - per-run values (dates, branch, SHA, PR or run IDs, timestamps, temp paths) inside stable text: CLAUDE.md, AGENTS.md, system prompt files, skill and agent files, the fixed part of the prompt template - bulky stable text (rules, notes, checklists) in CLAUDE.md, AGENTS.md or the prompt: it travels in the first user message and is written to cache again on every run - tools, MCP servers, claude.ai connectors, skills and subagents the job does not use - per-run data placed before stable text in the prompt template - a closing summary, or free-form output where a fixed format would do How to tell what the job uses: [reference/levers.md](reference/levers.md#decide-what-the-job-uses). ### 3. Plan, then stop Write the plan with the template in [reference/levers.md](reference/levers.md#plan-template): each change with its file, what moves where, why, and the risk; then what stays the same. Ask "Apply this plan?" and wait. If the user approves only some items, apply only those. ### 4. Apply - Stable block: move the job's rules and notes word for word into one file, for example `.claude/prompts/<job>.md`, and pass it with `--append-system-prompt-file`. Keep per-run values out of it. It must be byte-identical on every run: no dates, no generated text, LF line endings. - Tail: the prompt ends with the per-run data: task, then diff or inputs, then branch, date and IDs last. - Tools: `--tools` with only what the job uses, `--strict-mcp-config` (plus `--mcp-config` for servers the job needs), `--disable-slash-commands` when it needs no skills. Leave out `Task`/`Agent` when it starts no subagents. - Output: a fixed format with no closing summary, only if nothing downstream parses the old output, or the parser changes in the same plan. - If CLAUDE.md content moved into the stable block, stop the job from loading it twice: [reference/levers.md](reference/levers.md#claudemd-loaded-twice). ### 5. Show the diff `git diff` for every changed file and the full text of every new file. Point out any line that is not a pure move. ### 6. Benchmark Write `bench/before.sh` (the job as it was) and `bench/after.sh` (as it is now). Format and how to rebuild the old setup: [reference/benchmark.md](reference/benchmark.md); template: [templates/setup.example.sh](templates/setup.example.sh). Pick 2-5 real tasks, tell the user the call count (2 x tasks x runs), ask, then run it in the background: ```bash bash <skill-dir>/scripts/bench.sh -n 2 bench/before.sh bench/after.sh <task> [<task>...] ``` Report mean cost, duration, cache reads, cache writes and output tokens with the change in percent, and cost per task. Call a metric unproven when its before and after ranges overlap. Compare the saved answers (`*.answer.txt`): do both setups find the same issues? ### 7. Close State what changed and what the benchmark measured. Add one line: model and effort choice are often bigger levers (most of Cloudflare's savings came from them), but this skill does not change them.
Pliki w paczce (7)
- SKILL.md 5 KB
- reference/benchmark.md 3 KB
- reference/levers.md 7 KB
- reference/prompt-layout.md 4 KB
- scripts/audit.sh 6 KB
- scripts/bench.sh 14 KB
- templates/setup.example.sh 1 KB
Wersje
W bazie nie ma innych skilli o nazwie cache-tune.
Migawka bazy z 13.11.2026 · wersja paczki 9bc58387158b (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
- 100cache-diagnostics
Diagnozuje niski lub niewyjaśniony współczynnik trafień cache promptów Claude oraz wzrost kosztów w pętlach agentów i czatbotów. - 100cache-efficiency
Analizuje skuteczność cache promptów w Claude Code na podstawie dashboardu Agent Monitor: współczynnik trafień, koszt odczytu i zapisu oraz sesje o najsłabszym wykorzystaniu. - 100prompt-caching
Projektuje lub audytuje agenta tak, by cache promptów Claude nadal trafiał, także przy zmianach planu, modelu, narzędzi i kompakcji. - 100cache-report
Generuje raport skuteczności cache dla każdego agenta w bieżącej sesji Claude Code, z podziałem zużycia tokenów i wskazaniem subagentów, które marnują cache. - 100prompt-caching
Pokazuje, jak używać cache promptów w API Claude: punkty przerwania, czas życia 5 minut i 1 godzina, minimalne długości oraz mierzenie trafień. - 100cache
Włącza ochronę cache w Claude Code: blokuje użycie narzędzi, gdy cache promptów jest zimny lub kontekst zbliża się do kompakcji, przez polecenia /ar:cache.