Claude Cache Guard — Security skill for Claude Code
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:
- Batch all image reads into a single message (1 image or 10 = same rewrite cost)
- Write findings to a notes file and never re-read an unchanged image
- Delegate vision checks to a subagent with a tiny isolated context, so the main session's cached prefix is never invalidated
- Keep large tool outputs (build logs, file dumps, base64) out of context
- 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
Related Skills
Cost Autopsy
Session token-burn autopsy (TCO v1). Reads the TIS telemetry log and reports per-session token spend (input /
Moatkit
Security toolkit for LLM apps and AI agents: blocks prompt injection, stops API keys and personal data leaking
Claude Warmline
Makes Claude Code's prompt-cache state visible: HOT/COLD in your statusline from Claude Code's own data, plus
AI Spend
Audit Claude Code token efficiency: MCP overhead, session patterns, skill cost, cache hit rate. Add --full for
Minga
Lean, security-first agent marketplace for Claude Code — a 3k-token core team (plan, build, verify, ship) plus
Context Audit
Audit how much input-token bloat the read-guard removes on this repo
Related Agents
Workhorse
Writer for well-specified, mechanical, token-heavy changes in one assigned worktree — applying a reviewed fix
LLM FinOps Architect
LLM FinOps Architect specializing in model-tier routing, cost-envelope governance, burn-rate monitoring, per-p
Lean Coder
Token-efficient coding agent for any project. Use for edits, refactors and bug fixes (multi-file or unfamiliar