prompt-caching · davila7 — Claude Code skill: prompt and response caching
This skill covers prompt-prefix, response, and CAG caching for LLM workflows. Use it when repeated prompts or reusable answers make caching worth planning.
npx claude-code-templates@latest --skill ai-research/prompt-cachingWhat prompt-caching does
The skill maps out three caching targets: repeated prompt prefixes, complete LLM responses, and documents placed in a prompt through the CAG pattern. It also covers KV caching, semantic-similarity matches, and invalidation rules for stale entries.
For Claude, it describes native prompt caching; for repeated or closely related queries, it covers response caching. The material also addresses prompt structure, cache misses, and the extra latency they can introduce. High temperature makes response caching a poor fit, while missing invalidation means stored answers can become wrong over time.
What it helps with
- choose a caching level for an LLM workflow
- keep repeated prompt prefixes in cache
- reuse answers for identical requests
- preload documents with the CAG pattern
- invalidate stale cached responses
Example prompts for the agent
- Choose a caching strategy for a prompt with a repeated prefix in Claude.
- Compare response caching with CAG for documents reused across many requests.
- Review this design for cache invalidation and miss handling.
How to install prompt-caching
1claude-code-templates
npx claude-code-templates@latest --skill ai-research/prompt-caching2Skills CLI (Vercel)
npx skills add davila7/claude-code-templates --skill prompt-caching -a claude-code3Manually: put the files in place
~/.claude/skills/prompt-caching/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/prompt-caching/
Manually: put the files in place
.agents/skills/prompt-caching/SKILL.mdFor all projects use ~/.agents/skills/
Manually: put the files in place
.cursor/skills/prompt-caching/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install davila7/claude-code-templates prompt-caching2Manually: put the files in place
.github/skills/prompt-caching/SKILL.mdPlatform CLI
gemini skills install https://github.com/davila7/claude-code-templates --path cli-tool/components/skills/ai-research/prompt-cachingManually: put the files in place
.devin/skills/prompt-caching/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about prompt-caching
How do I install prompt-caching in Claude Code?
Run npx claude-code-templates@latest --skill ai-research/prompt-caching.
What does prompt-caching do?
It helps plan caching for prompt prefixes, LLM responses, and documents used through CAG. It also covers KV caching and invalidation.
Why can prompt caching fail to deliver cache hits?
Changing the prompt prefix can prevent a match. Response caching is also a weaker fit when temperature is high.
Similar skills
All skills for AI and ML →prompt-caching by other authors comes first.