prompt-caching
Optimizes LLM performance using prompt, response, and semantic caching patterns.
Install
mkdir -p .claude/skills/prompt-caching && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/888" && unzip -o skill.zip -d .claude/skills/prompt-caching && rm skill.zipInstalls to .claude/skills/prompt-caching
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Caching strategies for LLM prompts including Anthropic prompt caching, response caching, and CAG (Cache Augmented Generation) Use when: prompt caching, cache prompt, response cache, cag, cache augmented.Key capabilities
- →Implements prefix caching for repetitive prompt segments
- →Categorizes cache targets by semantic similarity vs exact match
- →Manages invalidation logic for volatile prompt data
- →Architects Cache Augmented Generation (CAG) pipelines
- →Monitors cache hit rates to identify performance bottlenecks
How it works
Maintains an indexing layer between the user input and the LLM API to serve prefix blocks or cached responses directly.
Inputs & outputs
When to use prompt-caching
- →Cache expensive LLM prompts
- →Reduce API latency for repetitive queries
- →Implement semantic cache for RAG systems
About this skill
Prompt Caching
You're a caching specialist who has reduced LLM costs by 90% through strategic caching. You've implemented systems that cache at multiple levels: prompt prefixes, full responses, and semantic similarity matches.
You understand that LLM caching is different from traditional caching—prompts have prefixes that can be cached, responses vary with temperature, and semantic similarity often matters more than exact match.
Your core principles:
- Cache at the right level—prefix, response, or both
- K
Capabilities
- prompt-cache
- response-cache
- kv-cache
- cag-patterns
- cache-invalidation
Patterns
Anthropic Prompt Caching
Use Claude's native prompt caching for repeated prefixes
Response Caching
Cache full LLM responses for identical or similar queries
Cache Augmented Generation (CAG)
Pre-cache documents in prompt instead of RAG retrieval
Anti-Patterns
❌ Caching with High Temperature
❌ No Cache Invalidation
❌ Caching Everything
⚠️ Sharp Edges
| Issue | Severity | Solution |
|---|---|---|
| Cache miss causes latency spike with additional overhead | high | // Optimize for cache misses, not just hits |
| Cached responses become incorrect over time | high | // Implement proper cache invalidation |
| Prompt caching doesn't work due to prefix changes | medium | // Structure prompts for optimal caching |
Related Skills
Works well with: context-window-management, rag-implementation, conversation-memory
When not to use it
- →Applications with extremely high variance in prompt structure
- →Low-frequency tasks where caching overhead exceeds API latency
Limitations
- →High temperature settings invalidate cached results
- →Risk of serving stale data if invalidation logic is flawed
How it compares
Treats prompt engineering as a stateful optimization problem, focusing on cache-miss reduction and prefix structure.
Compared to similar skills
prompt-caching side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| prompt-caching (this skill) | 14 | 6mo | No flags | Intermediate |
| dspy | 4 | 7mo | Review | Intermediate |
| critic-judge-design | 0 | 4mo | No flags | Advanced |
| prompt-engineering | 0 | 3mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by davila7
View all by davila7 →You might also like
dspy
davila7
Build complex AI systems with declarative programming, optimize prompts automatically, create modular RAG systems and agents with DSPy - Stanford NLP's framework for systematic LM programming
critic-judge-design
Victoriakaey
Use when designing any LLM-as-Judge, Critic, or Evaluator node. Covers input structure, output schema, chain-of-thought ordering, single-pass vs multi-stage tradeoffs, and known failure modes. Prevents the most common design mistakes that cause Critic nodes to be unreliable.
prompt-engineering
iletai
Use when "writing prompts", "prompt optimization", "few-shot learning", "chain of thought", or asking about "RAG systems", "agent workflows", "LLM integration", "prompt templates
senior-prompt-engineer
CidLucas
World-class prompt engineering skill for LLM optimization, prompt patterns, structured outputs, and AI product development. Expertise in Claude, GPT-4, prompt design patterns, few-shot learning, chain-of-thought, and AI evaluation. Includes RAG optimization, agent design, and LLM system architecture
skill-creator
anthropics
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
langchain
zechenzhangAGI
Framework for building LLM-powered applications with agents, chains, and RAG. Supports multiple providers (OpenAI, Anthropic, Google), 500+ integrations, ReAct agents, tool calling, memory management, and vector store retrieval. Use for building chatbots, question-answering systems, autonomous agents, or RAG applications. Best for rapid prototyping and production deployments.