diff --git a/README.md b/README.md
index cf66b62..a68de25 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ Download it and try it out for free! **https://piebald.ai/**
> [!important]
> **NEW (January 23, 2026): We've added all of Claude Code's ~40 system reminders to this list—see [System Reminders](#system-reminders).**
-This repository contains an up-to-date list of all Claude Code's various system prompts and their associated token counts as of **[Claude Code v2.1.81](https://www.npmjs.com/package/@anthropic-ai/claude-code/v/2.1.81) (March 20th, 2026).** It also contains a [**CHANGELOG.md**](./CHANGELOG.md) for the system prompts across 131 versions since v2.0.14. From the team behind [
**Piebald.**](https://piebald.ai/)
+This repository contains an up-to-date list of all Claude Code's various system prompts and their associated token counts as of **[Claude Code v2.1.83](https://www.npmjs.com/package/@anthropic-ai/claude-code/v/2.1.83) (March 24th, 2026).** It also contains a [**CHANGELOG.md**](./CHANGELOG.md) for the system prompts across 132 versions since v2.0.14. From the team behind [
**Piebald.**](https://piebald.ai/)
**This repository is updated within minutes of each Claude Code release. See the [changelog](./CHANGELOG.md), and follow [@PiebaldAI](https://x.com/PiebaldAI) on X for a summary of the system prompt changes in each release.**
@@ -105,7 +105,7 @@ Sub-agents and utilities.
- [Agent Prompt: Common suffix (response format)](./system-prompts/agent-prompt-common-suffix-response-format.md) (**188** tks) - Appends response format instructions to agent prompts, switching between concise sub-agent reporting and detailed standalone writeups based on a caller flag.
- [Agent Prompt: Conversation summarization](./system-prompts/agent-prompt-conversation-summarization.md) (**956** tks) - System prompt for creating detailed conversation summaries.
- [Agent Prompt: Determine which memory files to attach](./system-prompts/agent-prompt-determine-which-memory-files-to-attach.md) (**218** tks) - Agent for determining which memory files to attach for the main agent.
-- [Agent Prompt: Dream memory consolidation](./system-prompts/agent-prompt-dream-memory-consolidation.md) (**706** tks) - Instructs an agent to perform a multi-phase memory consolidation pass — orienting on existing memories, gathering recent signal from logs and transcripts, merging updates into topic files, and pruning the index.
+- [Agent Prompt: Dream memory consolidation](./system-prompts/agent-prompt-dream-memory-consolidation.md) (**727** tks) - Instructs an agent to perform a multi-phase memory consolidation pass — orienting on existing memories, gathering recent signal from logs and transcripts, merging updates into topic files, and pruning the index.
- [Agent Prompt: Hook condition evaluator](./system-prompts/agent-prompt-hook-condition-evaluator.md) (**78** tks) - System prompt for evaluating hook conditions in Claude Code.
- [Agent Prompt: Prompt Suggestion Generator v2](./system-prompts/agent-prompt-prompt-suggestion-generator-v2.md) (**296** tks) - V2 instructions for generating prompt suggestions for Claude Code.
- [Agent Prompt: Quick PR creation](./system-prompts/agent-prompt-quick-pr-creation.md) (**806** tks) - Streamlined prompt for creating a commit and pull request with pre-populated context.
@@ -127,16 +127,16 @@ The content of various template files embedded in Claude Code.
- [Data: Agent SDK patterns — Python](./system-prompts/data-agent-sdk-patterns-python.md) (**2656** tks) - Python Agent SDK patterns including custom tools, hooks, subagents, MCP integration, and session resumption.
- [Data: Agent SDK patterns — TypeScript](./system-prompts/data-agent-sdk-patterns-typescript.md) (**1529** tks) - TypeScript Agent SDK patterns including basic agents, hooks, subagents, and MCP integration.
-- [Data: Agent SDK reference — Python](./system-prompts/data-agent-sdk-reference-python.md) (**3450** tks) - Python Agent SDK reference including installation, quick start, custom tools via MCP, and hooks.
-- [Data: Agent SDK reference — TypeScript](./system-prompts/data-agent-sdk-reference-typescript.md) (**3209** tks) - TypeScript Agent SDK reference including installation, quick start, custom tools, and hooks.
-- [Data: Claude API reference — C#](./system-prompts/data-claude-api-reference-c.md) (**4703** tks) - C# SDK reference including installation, client initialization, basic requests, streaming, and tool use.
-- [Data: Claude API reference — Go](./system-prompts/data-claude-api-reference-go.md) (**4341** tks) - Go SDK reference.
-- [Data: Claude API reference — Java](./system-prompts/data-claude-api-reference-java.md) (**4770** tks) - Java SDK reference including installation, client initialization, basic requests, streaming, and beta tool use.
-- [Data: Claude API reference — PHP](./system-prompts/data-claude-api-reference-php.md) (**2381** tks) - PHP SDK reference.
-- [Data: Claude API reference — Python](./system-prompts/data-claude-api-reference-python.md) (**3518** tks) - Python SDK reference including installation, client initialization, basic requests, thinking, and multi-turn conversation.
-- [Data: Claude API reference — Ruby](./system-prompts/data-claude-api-reference-ruby.md) (**696** tks) - Ruby SDK reference including installation, client initialization, basic requests, streaming, and beta tool runner.
-- [Data: Claude API reference — TypeScript](./system-prompts/data-claude-api-reference-typescript.md) (**2837** tks) - TypeScript SDK reference including installation, client initialization, basic requests, thinking, and multi-turn conversation.
-- [Data: Claude API reference — cURL](./system-prompts/data-claude-api-reference-curl.md) (**1996** tks) - Raw API reference for Claude API for use with cURL or else Raw HTTP.
+- [Data: Agent SDK reference — Python](./system-prompts/data-agent-sdk-reference-python.md) (**3299** tks) - Python Agent SDK reference including installation, quick start, custom tools via MCP, and hooks.
+- [Data: Agent SDK reference — TypeScript](./system-prompts/data-agent-sdk-reference-typescript.md) (**2943** tks) - TypeScript Agent SDK reference including installation, quick start, custom tools, and hooks.
+- [Data: Claude API reference — C#](./system-prompts/data-claude-api-reference-c.md) (**4341** tks) - C# SDK reference including installation, client initialization, basic requests, streaming, and tool use.
+- [Data: Claude API reference — Go](./system-prompts/data-claude-api-reference-go.md) (**4294** tks) - Go SDK reference.
+- [Data: Claude API reference — Java](./system-prompts/data-claude-api-reference-java.md) (**4506** tks) - Java SDK reference including installation, client initialization, basic requests, streaming, and beta tool use.
+- [Data: Claude API reference — PHP](./system-prompts/data-claude-api-reference-php.md) (**3486** tks) - PHP SDK reference.
+- [Data: Claude API reference — Python](./system-prompts/data-claude-api-reference-python.md) (**3549** tks) - Python SDK reference including installation, client initialization, basic requests, thinking, and multi-turn conversation.
+- [Data: Claude API reference — Ruby](./system-prompts/data-claude-api-reference-ruby.md) (**923** tks) - Ruby SDK reference including installation, client initialization, basic requests, streaming, and beta tool runner.
+- [Data: Claude API reference — TypeScript](./system-prompts/data-claude-api-reference-typescript.md) (**2881** tks) - TypeScript SDK reference including installation, client initialization, basic requests, thinking, and multi-turn conversation.
+- [Data: Claude API reference — cURL](./system-prompts/data-claude-api-reference-curl.md) (**2174** tks) - Raw API reference for Claude API for use with cURL or else Raw HTTP.
- [Data: Claude model catalog](./system-prompts/data-claude-model-catalog.md) (**2295** tks) - Catalog of current and legacy Claude models with exact model IDs, aliases, context windows, and pricing.
- [Data: Files API reference — Python](./system-prompts/data-files-api-reference-python.md) (**1334** tks) - Python Files API reference including file upload, listing, deletion, and usage in messages.
- [Data: Files API reference — TypeScript](./system-prompts/data-files-api-reference-typescript.md) (**797** tks) - TypeScript Files API reference including file upload, listing, deletion, and usage in messages.
@@ -145,10 +145,11 @@ The content of various template files embedded in Claude Code.
- [Data: HTTP error codes reference](./system-prompts/data-http-error-codes-reference.md) (**1922** tks) - Reference for HTTP error codes returned by the Claude API with common causes and handling strategies.
- [Data: Live documentation sources](./system-prompts/data-live-documentation-sources.md) (**2336** tks) - WebFetch URLs for fetching current Claude API and Agent SDK documentation from official sources.
- [Data: Message Batches API reference — Python](./system-prompts/data-message-batches-api-reference-python.md) (**1544** tks) - Python Batches API reference including batch creation, status polling, and result retrieval at 50% cost.
+- [Data: Prompt Caching — Design & Optimization](./system-prompts/data-prompt-caching-design-optimization.md) (**1880** tks) - Document on how to design prompt-building code for effective caching, including placement patterns and anti-patterns.
- [Data: Session memory template](./system-prompts/data-session-memory-template.md) (**292** tks) - Template structure for session memory `summary.md` files.
- [Data: Streaming reference — Python](./system-prompts/data-streaming-reference-python.md) (**1528** tks) - Python streaming reference including sync/async streaming and handling different content types.
- [Data: Streaming reference — TypeScript](./system-prompts/data-streaming-reference-typescript.md) (**1703** tks) - TypeScript streaming reference including basic streaming and handling different content types.
-- [Data: Tool use concepts](./system-prompts/data-tool-use-concepts.md) (**3939** tks) - Conceptual foundations of tool use with the Claude API including tool definitions, tool choice, and best practices.
+- [Data: Tool use concepts](./system-prompts/data-tool-use-concepts.md) (**3721** tks) - Conceptual foundations of tool use with the Claude API including tool definitions, tool choice, and best practices.
- [Data: Tool use reference — Python](./system-prompts/data-tool-use-reference-python.md) (**5106** tks) - Python tool use reference including tool runner, manual agentic loop, code execution, and structured outputs.
- [Data: Tool use reference — TypeScript](./system-prompts/data-tool-use-reference-typescript.md) (**5033** tks) - TypeScript tool use reference including tool runner, manual agentic loop, code execution, and structured outputs.
@@ -156,6 +157,7 @@ The content of various template files embedded in Claude Code.
Parts of the main system prompt.
+- [System Prompt: Advisor tool instructions](./system-prompts/system-prompt-advisor-tool-instructions.md) (**415** tks) - Instructions for using the Advisor tool.
- [System Prompt: Agent Summary Generation](./system-prompts/system-prompt-agent-summary-generation.md) (**178** tks) - System prompt used for "Agent Summary" generation.
- [System Prompt: Agent memory instructions](./system-prompts/system-prompt-agent-memory-instructions.md) (**337** tks) - Instructions for including memory update guidance in agent system prompts.
- [System Prompt: Agent thread notes](./system-prompts/system-prompt-agent-thread-notes.md) (**216** tks) - Behavioral guidelines for agent threads covering absolute paths, response formatting, emoji avoidance, and tool call punctuation.
@@ -256,20 +258,20 @@ Text for large system reminders.
- [System Reminder: Plan mode is active (subagent)](./system-prompts/system-reminder-plan-mode-is-active-subagent.md) (**307** tks) - Simplified plan mode system reminder for sub agents.
- [System Reminder: Plan mode re-entry](./system-prompts/system-reminder-plan-mode-re-entry.md) (**236** tks) - System reminder sent when the user enters Plan mode after having previously exited it either via shift+tab or by approving Claude's plan.
- [System Reminder: Session continuation](./system-prompts/system-reminder-session-continuation.md) (**37** tks) - Notification that session continues from another machine.
-- [System Reminder: Task status](./system-prompts/system-reminder-task-status.md) (**18** tks) - Task status with TaskOutput tool reference.
- [System Reminder: Task tools reminder](./system-prompts/system-reminder-task-tools-reminder.md) (**123** tks) - Reminder to use task tracking tools.
- [System Reminder: Team Coordination](./system-prompts/system-reminder-team-coordination.md) (**250** tks) - System reminder for team coordination.
- [System Reminder: Team Shutdown](./system-prompts/system-reminder-team-shutdown.md) (**136** tks) - System reminder for team shutdown.
- [System Reminder: TodoWrite reminder](./system-prompts/system-reminder-todowrite-reminder.md) (**98** tks) - Reminder to use TodoWrite tool for task tracking.
- [System Reminder: Token usage](./system-prompts/system-reminder-token-usage.md) (**39** tks) - Current token usage statistics.
- [System Reminder: USD budget](./system-prompts/system-reminder-usd-budget.md) (**42** tks) - Current USD budget statistics.
+- [System Reminder: Ultraplan mode](./system-prompts/system-reminder-ultraplan-mode.md) (**342** tks) - System reminder for using Ultraplan mode to create a detailed implementation plan with multi-agent exploration and critique.
- [System Reminder: Verify plan reminder](./system-prompts/system-reminder-verify-plan-reminder.md) (**47** tks) - Reminder to verify completed plan.
### Builtin Tool Descriptions
- [Tool Description: AskUserQuestion](./system-prompts/tool-description-askuserquestion.md) (**287** tks) - Tool description for asking user questions.
- [Tool Description: Computer](./system-prompts/tool-description-computer.md) (**161** tks) - Main description for the Chrome browser computer automation tool.
-- [Tool Description: CronCreate](./system-prompts/tool-description-croncreate.md) (**754** tks) - Describes the CronCreate tool for enqueuing one-shot or recurring cron-based jobs with jitter and off-minute scheduling guidance.
+- [Tool Description: CronCreate](./system-prompts/tool-description-croncreate.md) (**948** tks) - Describes the CronCreate tool for enqueuing one-shot or recurring cron-based jobs with jitter and off-minute scheduling guidance.
- [Tool Description: Edit](./system-prompts/tool-description-edit.md) (**246** tks) - Tool for performing exact string replacements in files.
- [Tool Description: EnterPlanMode](./system-prompts/tool-description-enterplanmode.md) (**878** tks) - Tool description for entering plan mode to explore and design implementation approaches.
- [Tool Description: EnterWorktree](./system-prompts/tool-description-enterworktree.md) (**359** tks) - Tool description for the EnterWorktree tool.
@@ -280,7 +282,7 @@ Text for large system reminders.
- [Tool Description: LSP](./system-prompts/tool-description-lsp.md) (**255** tks) - Description for the LSP tool.
- [Tool Description: NotebookEdit](./system-prompts/tool-description-notebookedit.md) (**121** tks) - Tool description for editing Jupyter notebook cells.
- [Tool Description: ReadFile](./system-prompts/tool-description-readfile.md) (**440** tks) - Tool description for reading files.
-- [Tool Description: SendMessageTool](./system-prompts/tool-description-sendmessagetool.md) (**1205** tks) - Agent teams version of SendMessageTool.
+- [Tool Description: SendMessageTool](./system-prompts/tool-description-sendmessagetool.md) (**362** tks) - Agent teams version of SendMessageTool.
- [Tool Description: Skill](./system-prompts/tool-description-skill.md) (**326** tks) - Tool description for executing skills in the main conversation.
- [Tool Description: Sleep](./system-prompts/tool-description-sleep.md) (**154** tks) - Tool for waiting/sleeping with early wake capability on user input.
- [Tool Description: TaskCreate](./system-prompts/tool-description-taskcreate.md) (**528** tks) - Tool description for TaskCreate tool.
@@ -352,11 +354,13 @@ Built-in skill prompts for specialized tasks.
- [Skill: /init CLAUDE.md and skill setup (new version)](./system-prompts/skill-init-claudemd-and-skill-setup-new-version.md) (**4618** tks) - A comprehensive onboarding flow for setting up CLAUDE.md and related skills/hooks in the current repository, including codebase exploration, user interviews, and iterative proposal refinement.
- [Skill: /loop slash command](./system-prompts/skill-loop-slash-command.md) (**1040** tks) - Parses user input into an interval and prompt, converts the interval to a cron expression, and schedules a recurring task.
- [Skill: /stuck slash command](./system-prompts/skill-stuck-slash-command.md) (**964** tks) - Diagnozse frozen or slow Claude Code sessions.
-- [Skill: Build with Claude API (reference guide)](./system-prompts/skill-build-with-claude-api-reference-guide.md) (**410** tks) - Template for presenting language-specific reference documentation with quick task navigation.
-- [Skill: Build with Claude API](./system-prompts/skill-build-with-claude-api.md) (**5379** tks) - Main routing guide for building LLM-powered applications with Claude, including language detection, surface selection, and architecture overview.
+- [Skill: Build with Claude API (reference guide)](./system-prompts/skill-build-with-claude-api-reference-guide.md) (**468** tks) - Template for presenting language-specific reference documentation with quick task navigation.
+- [Skill: Build with Claude API](./system-prompts/skill-build-with-claude-api.md) (**5420** tks) - Main routing guide for building LLM-powered applications with Claude, including language detection, surface selection, and architecture overview.
- [Skill: Create verifier skills](./system-prompts/skill-create-verifier-skills.md) (**2625** tks) - Prompt for creating verifier skills for the Verify agent to automatically verify code changes.
- [Skill: Debugging](./system-prompts/skill-debugging.md) (**412** tks) - Instructions for debugging an issue that the user is encountering in the Claude Code session.
- [Skill: Simplify](./system-prompts/skill-simplify.md) (**877** tks) - Instructions for simplifying code.
- [Skill: Update Claude Code Config](./system-prompts/skill-update-claude-code-config.md) (**1255** tks) - Skill for modifying Claude Code configuration file (settings.json).
-- [Skill: Verification specialist](./system-prompts/skill-verification-specialist.md) (**2472** tks) - Skill for verifying that code changes work correctly.
+- [Skill: Verify CLI changes (example for Verify skill)](./system-prompts/skill-verify-cli-changes-example-for-verify-skill.md) (**565** tks) - Example workflow for verifying a CLI change, as part of the Verify skill.
+- [Skill: Verify server/API changes (example for Verify skill)](./system-prompts/skill-verify-serverapi-changes-example-for-verify-skill.md) (**612** tks) - Example workflow for verifying a server/API change, as part of the Verify skill.
+- [Skill: Verify skill](./system-prompts/skill-verify-skill.md) (**4888** tks) - Skill for opinionated verification workflow for validating code changes.
- [Skill: update-config (7-step verification flow)](./system-prompts/skill-update-config-7-step-verification-flow.md) (**1160** tks) - A skill that guides Claude through a 7-step process to construct and verify hooks for Claude Code, ensuring they work correctly in the user's specific project environment.
diff --git a/system-prompts/agent-prompt-dream-memory-consolidation.md b/system-prompts/agent-prompt-dream-memory-consolidation.md
index 019a297..0115a99 100644
--- a/system-prompts/agent-prompt-dream-memory-consolidation.md
+++ b/system-prompts/agent-prompt-dream-memory-consolidation.md
@@ -1,7 +1,7 @@
# Agent SDK — Python
@@ -220,6 +220,16 @@ async for message in query(
session_id = message.data.get("session_id") # Capture for resuming later
```
+`AssistantMessage` includes per-turn `usage` data (a dict matching the Anthropic API usage shape) for tracking costs:
+
+```python
+from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage
+
+async for message in query(prompt="...", options=ClaudeAgentOptions()):
+ if isinstance(message, AssistantMessage) and message.usage:
+ print(f"Input: {message.usage['input_tokens']}, Output: {message.usage['output_tokens']}")
+```
+
Typed task message subclasses are available for better type safety when handling subagent task events:
- `TaskStartedMessage` — emitted when a subagent task is registered
- `TaskProgressMessage` — real-time progress updates with cumulative usage metrics
diff --git a/system-prompts/data-agent-sdk-reference-typescript.md b/system-prompts/data-agent-sdk-reference-typescript.md
index 170745a..2e00c06 100644
--- a/system-prompts/data-agent-sdk-reference-typescript.md
+++ b/system-prompts/data-agent-sdk-reference-typescript.md
@@ -1,7 +1,7 @@
# Agent SDK — TypeScript
@@ -192,6 +192,7 @@ for await (const message of query({
description: "Expert code reviewer for quality and security reviews.",
prompt: "Analyze code quality and suggest improvements.",
tools: ["Read", "Glob", "Grep"],
+ // Optional: skills, mcpServers for subagent customization
},
},
},
diff --git a/system-prompts/data-claude-api-reference-c.md b/system-prompts/data-claude-api-reference-c.md
index cddc01e..cf799ef 100644
--- a/system-prompts/data-claude-api-reference-c.md
+++ b/system-prompts/data-claude-api-reference-c.md
@@ -1,7 +1,7 @@
# Claude API — C#
@@ -220,7 +220,7 @@ List followUpMessages =
## Context Editing / Compaction (Beta)
-**Beta-namespace prefix is inconsistent** (source-verified against `src/Anthropic/Models/Beta/Messages/*.cs` @ 12.8.0). No prefix: `MessageCreateParams`, `MessageCountTokensParams`, `Role`. **Everything else has the `Beta` prefix**: `BetaMessageParam`, `BetaMessage`, `BetaContentBlock`, `BetaToolUseBlock`, all block param types. The unprefixed `Role` WILL collide with `Anthropic.Models.Messages.Role` if you import both namespaces (CS0104). Safest: import only Beta; if mixing, alias the beta `Role`:
+**Beta-namespace prefix is inconsistent** (source-verified against `src/Anthropic/Models/Beta/Messages/*.cs` @ 12.9.0). No prefix: `MessageCreateParams`, `MessageCountTokensParams`, `Role`. **Everything else has the `Beta` prefix**: `BetaMessageParam`, `BetaMessage`, `BetaContentBlock`, `BetaToolUseBlock`, all block param types. The unprefixed `Role` WILL collide with `Anthropic.Models.Messages.Role` if you import both namespaces (CS0104). Safest: import only Beta; if mixing, alias the beta `Role`:
```csharp
using Anthropic.Models.Beta.Messages;
@@ -304,7 +304,7 @@ Values: `Effort.Low`, `Effort.Medium`, `Effort.High`, `Effort.Max`. Combine with
## Prompt Caching
-`System` takes `MessageCreateParamsSystem?` — a union of `string` or `List`. There is no `SystemTextBlockParam`; use plain `TextBlockParam`. The implicit conversion needs the concrete `List` type (array literals won't convert).
+`System` takes `MessageCreateParamsSystem?` — a union of `string` or `List`. There is no `SystemTextBlockParam`; use plain `TextBlockParam`. The implicit conversion needs the concrete `List` type (array literals won't convert). For placement patterns and the silent-invalidator audit checklist, see `shared/prompt-caching.md`.
```csharp
System = new List {
@@ -317,6 +317,8 @@ System = new List {
Optional `Ttl` on `CacheControlEphemeral`: `new() { Ttl = Ttl.Ttl1h }` or `Ttl.Ttl5m`. `CacheControl` also exists on `Tool.CacheControl` and top-level `MessageCreateParams.CacheControl`.
+Verify hits via `response.Usage.CacheCreationInputTokens` / `response.Usage.CacheReadInputTokens`.
+
---
## Token Counting
diff --git a/system-prompts/data-claude-api-reference-curl.md b/system-prompts/data-claude-api-reference-curl.md
index 4ccfbf8..3e5e0e9 100644
--- a/system-prompts/data-claude-api-reference-curl.md
+++ b/system-prompts/data-claude-api-reference-curl.md
@@ -1,7 +1,7 @@
# Claude API — cURL / Raw HTTP
@@ -162,6 +162,29 @@ curl https://api.anthropic.com/v1/messages \
---
+## Prompt Caching
+
+Put `cache_control` on the last block of the stable prefix. See `shared/prompt-caching.md` for placement patterns and the silent-invalidator audit checklist.
+
+```bash
+curl https://api.anthropic.com/v1/messages \
+ -H "Content-Type: application/json" \
+ -H "x-api-key: $ANTHROPIC_API_KEY" \
+ -H "anthropic-version: 2023-06-01" \
+ -d '{
+ "model": "{{OPUS_ID}}",
+ "max_tokens": 16000,
+ "system": [
+ {"type": "text", "text": "", "cache_control": {"type": "ephemeral"}}
+ ],
+ "messages": [{"role": "user", "content": "Summarize the key points"}]
+ }'
+```
+
+For 1-hour TTL: `"cache_control": {"type": "ephemeral", "ttl": "1h"}`. Top-level `"cache_control"` on the request body auto-places on the last cacheable block. Verify hits via the response `usage.cache_creation_input_tokens` / `usage.cache_read_input_tokens` fields.
+
+---
+
## Extended Thinking
> **Opus 4.6 and Sonnet 4.6:** Use adaptive thinking. `budget_tokens` is deprecated on both Opus 4.6 and Sonnet 4.6.
diff --git a/system-prompts/data-claude-api-reference-go.md b/system-prompts/data-claude-api-reference-go.md
index 7c2b6e4..02d5f7d 100644
--- a/system-prompts/data-claude-api-reference-go.md
+++ b/system-prompts/data-claude-api-reference-go.md
@@ -1,7 +1,7 @@
# Claude API — Go
@@ -320,6 +320,23 @@ To disable: `anthropic.ThinkingConfigParamUnion{OfDisabled: &anthropic.ThinkingC
---
+## Prompt Caching
+
+`System` is `[]TextBlockParam`; set `CacheControl` on the last block to cache tools + system together. For placement patterns and the silent-invalidator audit checklist, see `shared/prompt-caching.md`.
+
+```go
+System: []anthropic.TextBlockParam{{
+ Text: longSystemPrompt,
+ CacheControl: anthropic.NewCacheControlEphemeralParam(), // default 5m TTL
+}},
+```
+
+For 1-hour TTL: `anthropic.CacheControlEphemeralParam{TTL: anthropic.CacheControlEphemeralTTLTTL1h}`. There's also a top-level `CacheControl` on `MessageNewParams` that auto-places on the last cacheable block.
+
+Verify hits via `resp.Usage.CacheCreationInputTokens` / `resp.Usage.CacheReadInputTokens`.
+
+---
+
## Server-Side Tools
Version-suffixed struct names with `Param` suffix. `Name`/`Type` are `constant.*` types — zero value marshals correctly, so `{}` works. Wrap in `ToolUnionParam` with the matching `Of*` field.
diff --git a/system-prompts/data-claude-api-reference-java.md b/system-prompts/data-claude-api-reference-java.md
index 2c47d77..819f320 100644
--- a/system-prompts/data-claude-api-reference-java.md
+++ b/system-prompts/data-claude-api-reference-java.md
@@ -1,7 +1,7 @@
# Claude API — Java
@@ -15,14 +15,14 @@ Maven:
com.anthropic
anthropic-java
- 2.16.1
+ 2.17.0
```
Gradle:
```groovy
-implementation("com.anthropic:anthropic-java:2.16.1")
+implementation("com.anthropic:anthropic-java:2.17.0")
```
## Client Initialization
@@ -259,7 +259,7 @@ Combine with `Thinking = ThinkingConfigAdaptive` for cost-quality control.
## Prompt Caching
-System message as a list of `TextBlockParam` with `CacheControlEphemeral`. Use `.systemOfTextBlockParams(...)` — the plain `.system(String)` overload can't carry cache control.
+System message as a list of `TextBlockParam` with `CacheControlEphemeral`. Use `.systemOfTextBlockParams(...)` — the plain `.system(String)` overload can't carry cache control. For placement patterns and the silent-invalidator audit checklist, see `shared/prompt-caching.md`.
```java
import com.anthropic.models.messages.TextBlockParam;
@@ -276,6 +276,8 @@ import com.anthropic.models.messages.CacheControlEphemeral;
There's also a top-level `.cacheControl(CacheControlEphemeral)` on `MessageCreateParams.Builder` and on `Tool.builder()`.
+Verify hits via `response.usage().cacheCreationInputTokens()` / `response.usage().cacheReadInputTokens()`.
+
---
## Token Counting
diff --git a/system-prompts/data-claude-api-reference-php.md b/system-prompts/data-claude-api-reference-php.md
index 7a1129d..c8302b2 100644
--- a/system-prompts/data-claude-api-reference-php.md
+++ b/system-prompts/data-claude-api-reference-php.md
@@ -1,11 +1,11 @@
# Claude API — PHP
-> **Note:** The PHP SDK is the official Anthropic SDK for PHP. Tool runner and Agent SDK are not available. Bedrock, Vertex AI, and Foundry clients are supported.
+> **Note:** The PHP SDK is the official Anthropic SDK for PHP. A beta tool runner is available via `$client->beta->messages->toolRunner()`. Structured output helpers are supported via `StructuredOutputModel` classes. Agent SDK is not available. Bedrock, Vertex AI, and Foundry clients are supported.
## Installation
@@ -94,7 +94,7 @@ foreach ($message->content as $block) {
## Streaming
-> **Requires SDK v0.5.0+.** v0.4.0 and earlier used a single `$params` array; calling with named parameters throws `Unknown named parameter $model`. Upgrade: `composer require "anthropic-ai/sdk:^0.6"`
+> **Requires SDK v0.5.0+.** v0.4.0 and earlier used a single `$params` array; calling with named parameters throws `Unknown named parameter $model`. Upgrade: `composer require "anthropic-ai/sdk:^0.7"`
```php
use Anthropic\Messages\RawContentBlockDeltaEvent;
@@ -117,7 +117,49 @@ foreach ($stream as $event) {
---
-## Tool Use (Manual Loop)
+## Tool Use
+
+### Tool Runner (Beta)
+
+**Beta:** The PHP SDK provides a tool runner via `$client->beta->messages->toolRunner()`. Define tools with `BetaRunnableTool` — a definition array plus a `run` closure:
+
+```php
+use Anthropic\Lib\Tools\BetaRunnableTool;
+
+$weatherTool = new BetaRunnableTool(
+ definition: [
+ 'name' => 'get_weather',
+ 'description' => 'Get the current weather for a location.',
+ 'input_schema' => [
+ 'type' => 'object',
+ 'properties' => [
+ 'location' => ['type' => 'string', 'description' => 'City and state'],
+ ],
+ 'required' => ['location'],
+ ],
+ ],
+ run: function (array $input): string {
+ return "The weather in {$input['location']} is sunny and 72°F.";
+ },
+);
+
+$runner = $client->beta->messages->toolRunner(
+ maxTokens: 16000,
+ messages: [['role' => 'user', 'content' => 'What is the weather in Paris?']],
+ model: '{{OPUS_ID}}',
+ tools: [$weatherTool],
+);
+
+foreach ($runner as $message) {
+ foreach ($message->content as $block) {
+ if ($block->type === 'text') {
+ echo $block->text;
+ }
+ }
+}
+```
+
+### Manual Loop
Tools are passed as arrays. **The SDK uses camelCase keys** (`inputSchema`, `toolUseID`, `stopReason`) and auto-maps to the API's snake_case on the wire — since v0.5.0. See [shared tool use concepts](../shared/tool-use-concepts.md) for the loop pattern.
@@ -222,6 +264,98 @@ foreach ($message->content as $block) {
---
+## Prompt Caching
+
+`system:` takes an array of text blocks; set `cacheControl` on the last block. Array-shape syntax (camelCase keys) is idiomatic. For placement patterns and the silent-invalidator audit checklist, see `shared/prompt-caching.md`.
+
+```php
+$message = $client->messages->create(
+ model: '{{OPUS_ID}}',
+ maxTokens: 16000,
+ system: [
+ ['type' => 'text', 'text' => $longSystemPrompt, 'cacheControl' => ['type' => 'ephemeral']],
+ ],
+ messages: [['role' => 'user', 'content' => 'Summarize the key points']],
+);
+```
+
+For 1-hour TTL: `'cacheControl' => ['type' => 'ephemeral', 'ttl' => '1h']`. There's also a top-level `cacheControl:` on `messages->create(...)` that auto-places on the last cacheable block.
+
+Verify hits via `$message->usage->cacheCreationInputTokens` / `$message->usage->cacheReadInputTokens`.
+
+---
+
+## Structured Outputs
+
+### Using StructuredOutputModel (Recommended)
+
+Define a PHP class implementing `StructuredOutputModel` and pass it as `outputConfig`:
+
+```php
+use Anthropic\Lib\Contracts\StructuredOutputModel;
+use Anthropic\Lib\Concerns\StructuredOutputModelTrait;
+use Anthropic\Lib\Attributes\Constrained;
+
+class Person implements StructuredOutputModel
+{
+ use StructuredOutputModelTrait;
+
+ #[Constrained(description: 'Full name')]
+ public string $name;
+
+ public int $age;
+
+ public ?string $email = null; // nullable = optional field
+}
+
+$message = $client->messages->create(
+ model: '{{OPUS_ID}}',
+ maxTokens: 16000,
+ messages: [['role' => 'user', 'content' => 'Generate a profile for Alice, age 30']],
+ outputConfig: ['format' => Person::class],
+);
+
+$person = $message->parsedOutput(); // Person instance
+echo $person->name;
+```
+
+Types are inferred from PHP type hints. Use `#[Constrained(description: '...')]` to add descriptions. Nullable properties (`?string`) become optional fields.
+
+### Raw Schema
+
+```php
+$message = $client->messages->create(
+ model: '{{OPUS_ID}}',
+ maxTokens: 16000,
+ messages: [['role' => 'user', 'content' => 'Extract: John (john@co.com), Enterprise plan']],
+ outputConfig: [
+ 'format' => [
+ 'type' => 'json_schema',
+ 'schema' => [
+ 'type' => 'object',
+ 'properties' => [
+ 'name' => ['type' => 'string'],
+ 'email' => ['type' => 'string'],
+ 'plan' => ['type' => 'string'],
+ ],
+ 'required' => ['name', 'email', 'plan'],
+ 'additionalProperties' => false,
+ ],
+ ],
+ ],
+);
+
+// First text block contains valid JSON
+foreach ($message->content as $block) {
+ if ($block->type === 'text') {
+ $data = json_decode($block->text, true);
+ break;
+ }
+}
+```
+
+---
+
## Beta Features & Server-Side Tools
**`betas:` is NOT a param on `$client->messages->create()`** — it only exists on the beta namespace. Use it for features that need an explicit opt-in header:
diff --git a/system-prompts/data-claude-api-reference-python.md b/system-prompts/data-claude-api-reference-python.md
index b0240ed..e0a40de 100644
--- a/system-prompts/data-claude-api-reference-python.md
+++ b/system-prompts/data-claude-api-reference-python.md
@@ -1,7 +1,7 @@
# Claude API — Python
@@ -116,7 +116,7 @@ response = client.messages.create(
## Prompt Caching
-Cache large context to reduce costs (up to 90% savings).
+Cache large context to reduce costs (up to 90% savings). **Caching is a prefix match** — any byte change anywhere in the prefix invalidates everything after it. For placement patterns, architectural guidance (frozen system prompt, deterministic tool order, where to put volatile content), and the silent-invalidator audit checklist, read `shared/prompt-caching.md`.
### Automatic Caching (Recommended)
@@ -161,6 +161,16 @@ response = client.messages.create(
)
```
+### Verifying Cache Hits
+
+```python
+print(response.usage.cache_creation_input_tokens) # tokens written to cache (~1.25x cost)
+print(response.usage.cache_read_input_tokens) # tokens served from cache (~0.1x cost)
+print(response.usage.input_tokens) # uncached tokens (full cost)
+```
+
+If `cache_read_input_tokens` is zero across repeated identical-prefix requests, a silent invalidator is at work — `datetime.now()` or a UUID in the system prompt, unsorted `json.dumps()`, or a varying tool set. See `shared/prompt-caching.md` for the full audit table.
+
---
## Extended Thinking
diff --git a/system-prompts/data-claude-api-reference-ruby.md b/system-prompts/data-claude-api-reference-ruby.md
index 493d291..8b5c204 100644
--- a/system-prompts/data-claude-api-reference-ruby.md
+++ b/system-prompts/data-claude-api-reference-ruby.md
@@ -1,7 +1,7 @@
# Claude API — Ruby
@@ -95,3 +95,24 @@ end
### Manual Loop
See the [shared tool use concepts](../shared/tool-use-concepts.md) for the tool definition format and agentic loop pattern.
+
+---
+
+## Prompt Caching
+
+`system_:` (trailing underscore — avoids shadowing `Kernel#system`) takes an array of text blocks; set `cache_control` on the last block. Plain hashes work via the `OrHash` type alias. For placement patterns and the silent-invalidator audit checklist, see `shared/prompt-caching.md`.
+
+```ruby
+message = client.messages.create(
+ model: :"{{OPUS_ID}}",
+ max_tokens: 16000,
+ system_: [
+ { type: "text", text: long_system_prompt, cache_control: { type: "ephemeral" } }
+ ],
+ messages: [{ role: "user", content: "Summarize the key points" }]
+)
+```
+
+For 1-hour TTL: `cache_control: { type: "ephemeral", ttl: "1h" }`. There's also a top-level `cache_control:` on `messages.create` that auto-places on the last cacheable block.
+
+Verify hits via `message.usage.cache_creation_input_tokens` / `message.usage.cache_read_input_tokens`.
diff --git a/system-prompts/data-claude-api-reference-typescript.md b/system-prompts/data-claude-api-reference-typescript.md
index 2ea3ede..307a00e 100644
--- a/system-prompts/data-claude-api-reference-typescript.md
+++ b/system-prompts/data-claude-api-reference-typescript.md
@@ -1,7 +1,7 @@
# Claude API — TypeScript
@@ -110,6 +110,8 @@ const response = await client.messages.create({
## Prompt Caching
+**Caching is a prefix match** — any byte change anywhere in the prefix invalidates everything after it. For placement patterns, architectural guidance (frozen system prompt, deterministic tool order, where to put volatile content), and the silent-invalidator audit checklist, read `shared/prompt-caching.md`.
+
### Automatic Caching (Recommended)
Use top-level `cache_control` to automatically cache the last cacheable block in the request:
@@ -157,6 +159,16 @@ const response2 = await client.messages.create({
});
```
+### Verifying Cache Hits
+
+```typescript
+console.log(response.usage.cache_creation_input_tokens); // tokens written to cache (~1.25x cost)
+console.log(response.usage.cache_read_input_tokens); // tokens served from cache (~0.1x cost)
+console.log(response.usage.input_tokens); // uncached tokens (full cost)
+```
+
+If `cache_read_input_tokens` is zero across repeated identical-prefix requests, a silent invalidator is at work — `Date.now()` or a UUID in the system prompt, non-deterministic key ordering, or a varying tool set. See `shared/prompt-caching.md` for the full audit table.
+
---
## Extended Thinking
diff --git a/system-prompts/data-prompt-caching-design-optimization.md b/system-prompts/data-prompt-caching-design-optimization.md
new file mode 100644
index 0000000..5c9366a
--- /dev/null
+++ b/system-prompts/data-prompt-caching-design-optimization.md
@@ -0,0 +1,133 @@
+
+# Prompt Caching — Design & Optimization
+
+This file covers how to design prompt-building code for effective caching. For language-specific syntax, see the `## Prompt Caching` section in each language's README or single-file doc.
+
+## The one invariant everything follows from
+
+**Prompt caching is a prefix match. Any change anywhere in the prefix invalidates everything after it.**
+
+The cache key is derived from the exact bytes of the rendered prompt up to each `cache_control` breakpoint. A single byte difference at position N — a timestamp, a reordered JSON key, a different tool in the list — invalidates the cache for all breakpoints at positions ≥ N.
+
+Render order is: `tools` → `system` → `messages`. A breakpoint on the last system block caches both tools and system together.
+
+Design the prompt-building path around this constraint. Get the ordering right and most caching works for free. Get it wrong and no amount of `cache_control` markers will help.
+
+---
+
+## Workflow for optimizing existing code
+
+When asked to add or optimize caching:
+
+1. **Trace the prompt assembly path.** Find where `system`, `tools`, and `messages` are constructed. Identify every input that flows into them.
+2. **Classify each input by stability:**
+ - Never changes → belongs early in the prompt, before any breakpoint
+ - Changes per-session → belongs after the global prefix, cache per-session
+ - Changes per-turn → belongs at the end, after the last breakpoint
+ - Changes per-request (timestamps, UUIDs, random IDs) → **eliminate or move to the very end**
+3. **Check rendered order matches stability order.** Stable content must physically precede volatile content. If a timestamp is interpolated into the system prompt header, everything after it is uncacheable regardless of markers.
+4. **Place breakpoints at stability boundaries.** See placement patterns below.
+5. **Audit for silent invalidators.** See anti-patterns table.
+
+---
+
+## Placement patterns
+
+### Large system prompt shared across many requests
+
+Put a breakpoint on the last system text block. If there are tools, they render before system — the marker on the last system block caches tools + system together.
+
+```json
+"system": [
+ {"type": "text", "text": "", "cache_control": {"type": "ephemeral"}}
+]
+```
+
+### Multi-turn conversations
+
+Put a breakpoint on the last content block of the most-recently-appended turn. Each subsequent request reuses the entire prior conversation prefix. Earlier breakpoints remain valid read points, so hits accrue incrementally as the conversation grows.
+
+```json
+// Last content block of the last user turn
+messages[-1].content[-1].cache_control = {"type": "ephemeral"}
+```
+
+### Shared prefix, varying suffix
+
+Many requests share a large fixed preamble (few-shot examples, retrieved docs, instructions) but differ in the final question. Put the breakpoint at the end of the **shared** portion, not at the end of the whole prompt — otherwise every request writes a distinct cache entry and nothing is ever read.
+
+```json
+"messages": [{"role": "user", "content": [
+ {"type": "text", "text": "", "cache_control": {"type": "ephemeral"}},
+ {"type": "text", "text": ""} // no marker — differs every time
+]}]
+```
+
+### Prompts that change from the beginning every time
+
+Don't cache. If the first 1K tokens differ per request, there is no reusable prefix. Adding `cache_control` only pays the cache-write premium with zero reads. Leave it off.
+
+---
+
+## Architectural guidance
+
+These are the decisions that matter more than marker placement. Fix these first.
+
+**Keep the system prompt frozen.** Don't interpolate "current date: X", "mode: Y", "user name: Z" into the system prompt — those sit at the front of the prefix and invalidate everything downstream. Inject dynamic context as a user or assistant message later in `messages`. A message at turn 5 invalidates nothing before turn 5.
+
+**Don't change tools or model mid-conversation.** Tools render at position 0; adding, removing, or reordering a tool invalidates the entire cache. Same for switching models (caches are model-scoped). If you need "modes", don't swap the tool set — give Claude a tool that records the mode transition, or pass the mode as message content. Serialize tools deterministically (sort by name).
+
+**Fork operations must reuse the parent's exact prefix.** Side computations (summarization, compaction, sub-agents) often spin up a separate API call. If the fork rebuilds `system` / `tools` / `model` with any difference, it misses the parent's cache entirely. Copy the parent's `system`, `tools`, and `model` verbatim, then append fork-specific content at the end.
+
+---
+
+## Silent invalidators
+
+When reviewing code, grep for these inside anything that feeds the prompt prefix:
+
+| Pattern | Why it breaks caching |
+|---|---|
+| `datetime.now()` / `Date.now()` / `time.time()` in system prompt | Prefix changes every request |
+| `uuid4()` / `crypto.randomUUID()` / request IDs early in content | Same — every request is unique |
+| `json.dumps(d)` without `sort_keys=True` / iterating a `set` | Non-deterministic serialization → prefix bytes differ |
+| f-string interpolating session/user ID into system prompt | Per-user prefix; no cross-user sharing |
+| Conditional system sections (`if flag: system += ...`) | Every flag combination is a distinct prefix |
+| `tools=build_tools(user)` where set varies per user | Tools render at position 0; nothing caches across users |
+
+Fix by moving the dynamic piece after the last breakpoint, making it deterministic, or deleting it if it's not load-bearing.
+
+---
+
+## API reference
+
+```json
+"cache_control": {"type": "ephemeral"} // 5-minute TTL (default)
+"cache_control": {"type": "ephemeral", "ttl": "1h"} // 1-hour TTL
+```
+
+- Max **4** `cache_control` breakpoints per request.
+- Goes on any content block: system text blocks, tool definitions, message content blocks (`text`, `image`, `tool_use`, `tool_result`, `document`).
+- Top-level `cache_control` on `messages.create()` auto-places on the last cacheable block — simplest option when you don't need fine-grained placement.
+- Minimum cacheable prefix is model-dependent (typically 1024–2048 tokens). Shorter prefixes silently won't cache even with a marker.
+
+**Economics:** Cache writes cost ~1.25× base input price; reads cost ~0.1×. A prefix must be used in at least two requests within TTL to break even (one writes the cache, subsequent ones read it). For bursty traffic, the 1-hour TTL keeps entries alive across gaps.
+
+---
+
+## Verifying cache hits
+
+The response `usage` object reports cache activity:
+
+| Field | Meaning |
+|---|---|
+| `cache_creation_input_tokens` | Tokens written to cache this request (you paid the ~1.25× write premium) |
+| `cache_read_input_tokens` | Tokens served from cache this request (you paid ~0.1×) |
+| `input_tokens` | Tokens processed at full price (not cached) |
+
+If `cache_read_input_tokens` is zero across repeated requests with identical prefixes, a silent invalidator is at work — diff the rendered prompt bytes between two requests to find it.
+
+Language-specific access: `response.usage.cache_read_input_tokens` (Python/TS/Ruby), `$message->usage->cacheReadInputTokens` (PHP), `resp.Usage.CacheReadInputTokens` (Go/C#), `.usage().cacheReadInputTokens()` (Java).
diff --git a/system-prompts/data-tool-use-concepts.md b/system-prompts/data-tool-use-concepts.md
index 4582487..472cb7b 100644
--- a/system-prompts/data-tool-use-concepts.md
+++ b/system-prompts/data-tool-use-concepts.md
@@ -1,7 +1,7 @@
# Tool Use Concepts
@@ -11,7 +11,7 @@ This file covers the conceptual foundations of tool use with the Claude API. For
### Tool Definition Structure
-> **Note:** When using the Tool Runner (beta), tool schemas are generated automatically from your function signatures (Python), Zod schemas (TypeScript), annotated classes (Java), `jsonschema` struct tags (Go), or `BaseTool` subclasses (Ruby). The raw JSON schema format below is for the manual approach or SDKs without tool runner support.
+> **Note:** When using the Tool Runner (beta), tool schemas are generated automatically from your function signatures (Python), Zod schemas (TypeScript), annotated classes (Java), `jsonschema` struct tags (Go), or `BaseTool` subclasses (Ruby). The raw JSON schema format below is for the manual approach — including PHP's `BetaRunnableTool`, which wraps a run closure around a hand-written schema — or SDKs without tool runner support.
Each tool requires a name, description, and JSON Schema for its inputs:
@@ -64,7 +64,7 @@ Any `tool_choice` value can also include `"disable_parallel_tool_use": true` to
### Tool Runner vs Manual Loop
-**Tool Runner (Recommended):** The SDK's tool runner handles the agentic loop automatically — it calls the API, detects tool use requests, executes your tool functions, feeds results back to Claude, and repeats until Claude stops calling tools. Available in Python, TypeScript, Java, Go, and Ruby SDKs (beta). The Python SDK also provides MCP conversion helpers (`anthropic.lib.tools.mcp`) to convert MCP tools, prompts, and resources for use with the tool runner — see `python/claude-api/tool-use.md` for details.
+**Tool Runner (Recommended):** The SDK's tool runner handles the agentic loop automatically — it calls the API, detects tool use requests, executes your tool functions, feeds results back to Claude, and repeats until Claude stops calling tools. Available in Python, TypeScript, Java, Go, Ruby, and PHP SDKs (beta). The Python SDK also provides MCP conversion helpers (`anthropic.lib.tools.mcp`) to convert MCP tools, prompts, and resources for use with the tool runner — see `python/claude-api/tool-use.md` for details.
**Manual Agentic Loop:** Use when you need fine-grained control over the loop (e.g., custom logging, conditional tool execution, human-in-the-loop approval). Loop until `stop_reason == "end_turn"`, always append the full `response.content` to preserve tool_use blocks, and ensure each `tool_result` includes the matching `tool_use_id`.
diff --git a/system-prompts/skill-build-with-claude-api-reference-guide.md b/system-prompts/skill-build-with-claude-api-reference-guide.md
index 7fdcfed..7e1e425 100644
--- a/system-prompts/skill-build-with-claude-api-reference-guide.md
+++ b/system-prompts/skill-build-with-claude-api-reference-guide.md
@@ -1,7 +1,7 @@
## Reference Documentation
@@ -18,6 +18,9 @@ The relevant documentation for your detected language is included below in `
# Building LLM-Powered Applications with Claude
@@ -60,7 +60,7 @@ Before reading code examples, determine which language the user is working in:
| Ruby | Yes (beta) | No | `BaseTool` + `tool_runner` in beta |
| cURL | N/A | N/A | Raw HTTP, no SDK features |
| C# | No | No | Official SDK |
-| PHP | No | No | Official SDK |
+| PHP | Yes (beta) | No | `BetaRunnableTool` + `toolRunner()` |
---
@@ -169,6 +169,18 @@ See `{lang}/claude-api/README.md` (Compaction section) for code examples. Full d
---
+## Prompt Caching (Quick Reference)
+
+**Prefix match.** Any byte change anywhere in the prefix invalidates everything after it. Render order is `tools` → `system` → `messages`. Keep stable content first (frozen system prompt, deterministic tool list), put volatile content (timestamps, per-request IDs, varying questions) after the last `cache_control` breakpoint.
+
+**Top-level auto-caching** (`cache_control: {type: "ephemeral"}` on `messages.create()`) is the simplest option when you don't need fine-grained placement. Max 4 breakpoints per request. Minimum cacheable prefix is ~1024 tokens — shorter prefixes silently won't cache.
+
+**Verify with `usage.cache_read_input_tokens`** — if it's zero across repeated requests, a silent invalidator is at work (`datetime.now()` in system prompt, unsorted JSON, varying tool set).
+
+For placement patterns, architectural guidance, and the silent-invalidator audit checklist: read `shared/prompt-caching.md`. Language-specific syntax: `{lang}/claude-api/README.md` (Prompt Caching section).
+
+---
+
## Reading Guide
After detecting the language, read the relevant files based on what the user needs:
@@ -184,6 +196,9 @@ After detecting the language, read the relevant files based on what the user nee
**Long-running conversations (may exceed context window):**
→ Read `{lang}/claude-api/README.md` — see Compaction section
+**Prompt caching / optimize caching / "why is my cache hit rate low":**
+→ Read `shared/prompt-caching.md` + `{lang}/claude-api/README.md` (Prompt Caching section)
+
**Function calling / tool use / agents:**
→ Read `{lang}/claude-api/README.md` + `shared/tool-use-concepts.md` + `{lang}/claude-api/tool-use.md`
@@ -206,8 +221,9 @@ Read the **language-specific Claude API folder** (`{language}/claude-api/`):
4. **`{language}/claude-api/streaming.md`** — Read when building chat UIs or interfaces that display responses incrementally.
5. **`{language}/claude-api/batches.md`** — Read when processing many requests offline (not latency-sensitive). Runs asynchronously at 50% cost.
6. **`{language}/claude-api/files-api.md`** — Read when sending the same file across multiple requests without re-uploading.
-7. **`shared/error-codes.md`** — Read when debugging HTTP errors or implementing error handling.
-8. **`shared/live-sources.md`** — WebFetch URLs for fetching the latest official documentation.
+7. **`shared/prompt-caching.md`** — Read when adding or optimizing prompt caching. Covers prefix-stability design, breakpoint placement, and anti-patterns that silently invalidate cache.
+8. **`shared/error-codes.md`** — Read when debugging HTTP errors or implementing error handling.
+9. **`shared/live-sources.md`** — WebFetch URLs for fetching the latest official documentation.
> **Note:** For Java, Go, Ruby, C#, PHP, and cURL — these have a single file each covering all basics. Read that file plus `shared/tool-use-concepts.md` and `shared/error-codes.md` as needed.
diff --git a/system-prompts/skill-verification-specialist.md b/system-prompts/skill-verification-specialist.md
deleted file mode 100644
index a65c909..0000000
--- a/system-prompts/skill-verification-specialist.md
+++ /dev/null
@@ -1,252 +0,0 @@
-
-The skill enables you to be a verification specialist for Claude Code. Your primary goal is to verify that code changes actually work and fix what they're supposed to fix. You provide detailed failure reports that enable immediate issue resolution.
-
-## Your Mission
-
-**Main Goal: Verify functionality works correctly.** You will be given information about what needs to be verified. Your job is to:
-1. Understand what was changed (from the prompt or by checking git)
-2. Discover available verifier skills in the project
-3. Create a verification plan and write it to a plan file
-4. Trigger the appropriate verifier skill(s) to execute the plan — multiple verifiers may run if changes span different areas
-5. Report results
-
-If a previous verification plan exists and the changes/objective are the same, pass the plan in your prompt to reuse it.
-
-## Phase 1: Discover Verifier Skills
-
-Check your available skills (listed in the Skill tool's "Available skills" section) for any with "verifier" in the name (case-insensitive). These are your verifier skills (e.g., `verifier-playwright`, `my-verifier`, `unit-test-verifier`). No file system scanning needed — use the skills already loaded and available to you.
-
-### How to Choose a Verifier
-
-1. Run `git status` or use provided context to identify changed files
-2. From the loaded skills with "verifier" in the name, read their descriptions to understand what each covers
-3. Match changed files to the appropriate verifier based on what it describes (e.g., a playwright verifier for UI files, an API verifier for backend files)
-
-**If no verifier skills are found:**
-- Suggest running `/init-verifiers` to create one
-- Do not proceed with verification until a verifier skill is configured
-
-## Phase 2: Analyze Changes
-
-If no context is provided, check git:
-- Run `git status` to see modified files
-- Run `git diff` to see the actual changes
-- Infer what functionality needs verification
-
-## Phase 3: Choose Verifier(s)
-
-Based on the changed files and available verifiers:
-1. Match each file to the most appropriate verifier based on the verifier's description
-2. If multiple verifiers could apply, choose based on change type:
- - UI changes → prefer playwright/e2e verifiers
- - API changes → prefer http/api verifiers
- - CLI changes → prefer cli/tmux verifiers
-3. Group files by verifier for batch execution
-
-## Phase 4: Generate Verification Plan
-
-**If a plan was passed in your prompt**, compare its "Files Being Verified" and "Change Summary" against the current git diff. If they still match, reuse the plan as-is (skip to Phase 5). If the changes have diverged, create a fresh plan below.
-
-**If no plan was provided**, create a structured, deterministic plan that can be executed exactly.
-
-Write the plan to a plan file:
-- Plans are stored in `~/.claude/plans/.md`
-- Use the Write tool to create the plan file
-- Include the verifier skill to use in the metadata
-
-### Plan Format
-
-```markdown
-# Verification Plan
-
-## Metadata
-- **Verifier Skills**:
-- **Project Type**:
-- **Created**:
-- **Change Summary**:
-
-## Files Being Verified
-