A Claude Code skill that audits your setup against the 6 prompt caching rules from Anthropic's engineering team. Returns a scored report with specific fixes.
Prompt caching is what makes Claude Code affordable at scale. A high cache hit rate reduces costs and latency dramatically — but it's surprisingly easy to break without knowing it.
The Anthropic team runs alerts on cache hit rates and treats drops as incidents. This skill brings the same discipline to your personal setup.
| Rule | What breaks it |
|---|---|
| 1. Ordering | Dynamic data (timestamps, git status) in the system prompt |
| 2. Message injection | Editing the system prompt mid-session instead of using <system-reminder> tags |
| 3. Tool stability | Adding/removing tools mid-conversation |
| 4. Model switching | Switching models in the same conversation thread |
| 5. Dynamic content size | Injecting thousands of tokens of dynamic data per session |
| 6. Fork safety | Compaction/subagent calls that don't share the parent's prefix |
mkdir -p ~/.claude/skills/cache-audit
curl -o ~/.claude/skills/cache-audit/SKILL.md https://raw.githubusercontent.com/ussumant/cache-audit/main/cache-audit/SKILL.mdmkdir -p .claude/skills/cache-audit
curl -o .claude/skills/cache-audit/SKILL.md https://raw.githubusercontent.com/ussumant/cache-audit/main/cache-audit/SKILL.mdThen restart your Claude Code session for the skill to register.
/cache-audit
or say: "audit my caching" / "check my cache setup"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PROMPT CACHE AUDIT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Score: 5/6
✅ Rule 1 — Ordering: PASS
✅ Rule 2 — Message injection: PASS
✅ Rule 3 — Tool stability: PASS
✅ Rule 4 — Model switching: PASS
⚠️ Rule 5 — Dynamic content size: WARNING
→ Git status is 40k chars. Recommend trimming.
✅ Rule 6 — Fork safety: PASS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TOP FIX
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Git status injects 40k chars per session. Update .gitignore
to stop listing untracked noise files.
Based on Thariq Shihipar's thread "Lessons from Building Claude Code: Prompt Caching Is Everything".
Key insight: prompt caching works by prefix matching. Any change to the prefix — tool order, system prompt edit, model switch — invalidates everything after it. Design your entire harness around keeping the prefix stable.
- Claude Code installed
- No other dependencies — single markdown file
MIT