Agent Prompt Caching Best Practices

Keep prompt cache hit rate high in long-running agents by following the patterns Claude Code's team uses — lay out static-then-dynamic, push updates into messages instead of editing the system prompt, never change models or tools mid-session, model state transitions as tools (Plan Mode), defer tool loading instead of removing tools, and implement compaction as cache-safe forking. Treat cache breaks as incidents.

uygnoey Updated

File contents

uygnoey/skills-from-claude-blog/tree/main/2026.04.30_lessons-from-building-claude-code-prompt-caching-is-everything/skills/agent-prompt-caching-best-practices commit 63e6422606

Frequently asked questions

npx skillmds@latest add uygnoey/agent-prompt-caching-best-practices