0x0funky

Claude Cache Guard — Security skill for Claude Code

Security community

Claude Code skill that stops prompt-cache thrash: -88% token burn in image-heavy agent sessions, with an audit script that shows exactly which calls nuked your cache.

How to install Claude Cache Guard

This entry records only its repository, not the path inside it, so there is no exact command to give. Open 0x0funky/claude-cache-guard and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Cache Guard does

Claude Code skill that stops prompt-cache thrash: -88% token burn in image-heavy agent sessions, with an audit script that shows exactly which calls nuked your cache.

Alternatives in Security

  • ThinkWatch — Self-hosted AI API and MCP gateway for organizations: SSO and RBAC, per-user identity for MCP tool calls, PII 817 ★
  • Agent Skills Guard — 一款提供Agent Skills安全扫描和可视化管理的桌面应用 A desktop application that provides security scanning and visual management fo 389 ★
  • SEO Audit Skill — English · 中文 可复用的单页面 SEO 审计 Agent Skill 235 ★

README

claude-cache-guard

A Claude Code skill that stops **prompt-cache thrash** — the hidden cost pattern where reading one screenshot inside a long conversation rewrites the entire conversation history at **12.5× the cache-read price**.

Measured results

Real image-heavy production workload, same project / model / day, comparable work batches, before vs after applying the rules:

Metric Before After Δ
Images read in main context 40 (across 22 turns) 1
Cache writes (billed at 1.25×) 18.0M tok 0.74M tok −96%
Output tokens (work produced) 139k 164k +18%
Quota-weighted consumption 27.6M eq-tok 3.4M eq-tok −88%
Estimated cost $276.80 $33.65 −88%
Consumption per unit of output 199 20.5 ≈10× efficiency

Same model, same image resolution, same output quality. (Honest caveat: a real-workload before/after, not a variable-controlled A/B; the "after" also starts from a fresh context — which is itself one of the rules, R6.)

What it does

When Claude is about to read images/screenshots in a session with history — visual QA, render checks, UI verification, diagram review — the skill loads rules that make it:

  1. Batch all image reads into a single message (1 image or 10 = same rewrite cost)
  2. Write findings to a notes file and never re-read an unchanged image
  3. Delegate vision checks to a subagent with a tiny isolated context, so the main session's cached prefix is never invalidated
  4. Keep large tool outputs (build logs, file dumps, base64) out of context
  5. Avoid TTL-expiry wakes and mid-session model/tool changes that nuke the cache

Plus a read-only **audit script** that ranks your recent sessions by estimated cost and flags exactly which calls thrashed the cache and why.

Install

# macOS / Linux
git clone https://github.com/0x0funky/claude-cache-guard ~/.claude/skills/cache-guard
# Windows (PowerShell)
git clone http