mcpField
P
prompt-caching

prompt-caching

github.com/davila7Development33.0k436 installsUpdated today
Repository

About prompt-caching

A skill covering caching strategies for LLM prompts and responses, including prefix caching, semantic matches, and Cache Augmented Generation. It also outlines cache invalidation concerns and patterns for choosing what to cache.

Key features

  1. 01Prompt-prefix caching guidance
  2. 02Full-response caching for exact or similar queries
  3. 03KV-cache and CAG patterns
  4. 04Cache invalidation considerations
  5. 05Caching anti-patterns and edge cases

Use cases

  1. 01Reduce repeated LLM work with cached responses
  2. 02Choose between prefix and response caching
  3. 03Pre-cache documents for Cache Augmented Generation

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/davila7/claude-code-templates --skill prompt-caching

After installing, type/prompt-cachingin Claude Code to confirm it loaded.

Details

From the project README

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:

  1. Cache at the right level—prefix, response, or both
  2. 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

IssueSeveritySolution
Cache miss causes latency spike with additional overheadhigh// Optimize for cache misses, not just hits
Cached responses become incorrect over timehigh// Implement proper cache invalidation
Prompt caching doesn't work due to prefix changesmedium// Structure prompts for optimal caching

Related Skills

Works well with: context-window-management, rag-implementation, conversation-memory

Comments

Markdown supported