bedkillerspacex-boop/codex-skill-library/anthropic-prompt-caching-ops
Claude Code and agent skill by bedkillerspacex-boop/codex-skill-library
- community
Checking that the SKILL.md file is still in the repository.
Operate Anthropic prompt caching for owned apps: cache breakpoints, prefix stability, TTL/cost trade-offs, metrics, and security notes (what gets cached, multi-tenant isolation). Use when reducing input token cost/latency for long system prompts or tools — not for caching secrets across tenants or reverse-engineering Anthropic’s service.
Install
npx vskill@latest install bedkillerspacex-boop/codex-skill-library/anthropic-prompt-caching-opsSKILL.md
The same SKILL.md was published earlier as bedkillerspacex-boop/codex-skill-library/anthropic-prompt-caching-ops.
Anthropic Prompt Caching Ops
Scope And Authorization
- In scope: Applications using Anthropic APIs under your organization’s account.
- Out of scope: Sharing API keys; attempting to read other tenants’ cached prompts.
- Cached prefixes may include proprietary prompts — treat logs and traces carefully.
- Pair with
llm-prompt-injectionfor untrusted content andcode-quality-standards.
When To Use
- Long static system prompts, tool schemas, or large context preambles repeated across requests.
- Cost/latency optimization with Anthropic prompt caching features.
- Debugging cache misses (prefix changed, ordering, breakpoints).
- Multi-tenant SaaS design: ensure no cross-tenant cache contamination of sensitive prefixes.
Do Not Use As Primary
| Need | Skill instead | |
|---|---|---|
| Prompt/tool injection testing | llm-prompt-injection | |
| Broader AI/ML system security | ai-ml-security | |
| Generic HTTP caching CDN | caching-strategies | |
| Implementation quality baseline | code-quality-standards |
Domain Focus
| Concept | Operational meaning | |
|---|---|---|
| Cacheable prefix | Leading content marked for cache (API-version specific) | |
| Breakpoint / cache_control | Where cacheable blocks end | |
| Hit vs miss | Metrics: cached token reads vs writes | |
| Stability | Byte-stable prefix → higher hit rate | |
| TTL | Provider-defined cache lifetime; design for expiry | |
| Min size | Minimum tokens for caching to apply (see current docs) |
Note: Exact request fields evolve — verify current Anthropic docs for your API version.
Workflow
1. Confirm goals and success criteria
- Record model, avg prompt size, QPS, cost baseline.
- Success: measurable drop in billed input tokens / latency; hit rate above target; no secrets improperly shared across users.
- Identify static vs dynamic prompt sections.
2. Structure prompts for caching
- Put stable content first.
- Keep per-user secrets after the breakpoint (not in cached prefix).
- Avoid timestamps/random IDs in the cached region.
3. Implement API usage (illustrative)
- Centralize STATIC_PREFIX construction to one module to prevent accidental drift.
- Version your prefix (
PROMPT_V=3) and bump intentionally.
4. Measure cost and hits
| Metric | Alert idea | |
|---|---|---|
| cache_read / input ratio | Drop → prefix churn | |
| cache_creation spikes | Deploy changed static prompt | |
| $/1k requests | Budget regression |
5. Multi-tenant security
| Risk | Control | |
|---|---|---|
| Tenant A data in cached prefix | Never put tenant-specific data before breakpoint | |
| Prompt injection in cached tools | Still validate tools; caching ≠ isolation from injection | |
| Log leakage | Redact prefixes in debug logs | |
| Key sprawl | Separate API keys per env |
6. Operational practices
- Feature-flag caching to compare A/B cost.
- On deploy of static prefix, expect creation cost blip then savings.
- Document max prefix size and provider limits.
- Combine with rate limits and retry/backoff (
retry-backoff-patterns).
7. Verify
Good / Bad
| Topic | Good | Bad | |
|---|---|---|---|
| Prefix | Stable tools+policy | Per-request timestamp in prefix | |
| Secrets | User API keys after breakpoint | Customer secrets in cached system block | |
| Metrics | Track hit rate | Assume caching always on | |
| Change mgmt | Versioned static prompt | Silent string edits all day |
Output Checklist
- [ ] Static vs dynamic split documented
- [ ] Cache markers applied per current API
- [ ] Metrics for hit/create tokens dashboards
- [ ] Multi-tenant prefix hygiene reviewed
- [ ] Cost A/B or before/after recorded
- [ ] Logging redaction for prompts
- [ ] Feature flag / rollback path
- [ ]
code-quality-standardsapplied
Rules
- Use only on your Anthropic-backed apps with valid keys.
- Do not place tenant secrets in cacheable prefixes.
- Caching optimizes cost/latency; it does not replace authz or injection defenses.
- Follow current vendor docs for field names and TTLs.
- Redact prompts containing PII from tickets.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinganthropic-prompt-caching-ops/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/bedkillerspacex-boop/codex-skill-library/anthropic-prompt-caching-ops)