# prompt-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.

- skill · `type=skill` · Claude Code · 89 installs
- Author: davila7
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/skills/ai-research/prompt-caching
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/prompt-caching

## What it 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.

## Install

### Claude Code (native platform)

1. **claude-code-templates**
```bash
npx claude-code-templates@latest --skill ai-research/prompt-caching
```

2. **Skills CLI (Vercel)**
```bash
npx skills add davila7/claude-code-templates --skill prompt-caching -a claude-code
```

3. **Manually: put the files in place**
- File: `~/.claude/skills/prompt-caching/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/prompt-caching/

### Codex

**Manually: put the files in place**
- File: `.agents/skills/prompt-caching/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

**Manually: put the files in place**
- File: `.cursor/skills/prompt-caching/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install davila7/claude-code-templates prompt-caching
```

2. **Manually: put the files in place**
- File: `.github/skills/prompt-caching/SKILL.md`

### Gemini CLI

**Platform CLI**
```bash
gemini skills install https://github.com/davila7/claude-code-templates --path cli-tool/components/skills/ai-research/prompt-caching
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/prompt-caching/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/skills/ai-research/prompt-caching

## When to use it
- 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
- 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.

## Similar
- [skill-creator](https://affpapa.org/en/nevibecode/skills/skill-creator.md) — skill · 414180 installs
- [writing-for-agents](https://affpapa.org/en/nevibecode/skills/writing-for-agents.md) — skill · 466719 installs
- [media-use](https://affpapa.org/en/nevibecode/skills/media-use.md) — skill · 1100000 installs
- [mcp-builder](https://affpapa.org/en/nevibecode/skills/mcp-builder.md) — skill · 130949 installs
- [subagent-driven-development](https://affpapa.org/en/nevibecode/skills/subagent-driven-development.md) — skill · 237746 installs
- [orchestration](https://affpapa.org/en/nevibecode/skills/orchestration.md) — skill · 350300 installs

## Other versions with the same name
- [prompt-caching · sickn33](https://affpapa.org/en/nevibecode/skills/sickn33-prompt-caching.md) — 867 installs

From the same set: [davila7/claude-code-templates](https://affpapa.org/en/nevibecode/by/davila7/claude-code-templates.md) — 495 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
