Prompt Caching Patterns
softspark/ai-toolkit
Anthropic API prompt caching: TTL, breakpoints, stacking, invalidation, hit rate.
The reference agents' cache-stable request assembly, covering the static system and per-request context split, the fixed tool list, the rolling conversation breakpoint, which config fields are…
$ npx skills add anthropics/commerce-agents --skill commerce-prompt-caching -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install anthropics/commerce-agents commerce-prompt-caching --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/anthropics/commerce-agents.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/commerce-builder/skills/commerce-prompt-caching .claude/skills/commerce-prompt-caching && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "commerce-prompt-caching" agent skill from https://github.com/anthropics/commerce-agents/tree/main/plugins/commerce-builder/skills/commerce-prompt-caching into .claude/skills/commerce-prompt-caching/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "commerce-prompt-caching", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/anthropics/commerce-agents/tree/main/plugins/commerce-builder/skills/commerce-prompt-cachingType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add anthropics/commerce-agents --skill commerce-prompt-caching -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install anthropics/commerce-agents commerce-prompt-caching --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/anthropics/commerce-agents.git skills-src && mkdir -p .agents/skills && cp -r skills-src/plugins/commerce-builder/skills/commerce-prompt-caching .agents/skills/commerce-prompt-caching && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "commerce-prompt-caching" agent skill from https://github.com/anthropics/commerce-agents/tree/main/plugins/commerce-builder/skills/commerce-prompt-caching into .agents/skills/commerce-prompt-caching/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "commerce-prompt-caching", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add anthropics/commerce-agents --skill commerce-prompt-caching -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install anthropics/commerce-agents commerce-prompt-caching --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/anthropics/commerce-agents.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/plugins/commerce-builder/skills/commerce-prompt-caching .cursor/skills/commerce-prompt-caching && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "commerce-prompt-caching" agent skill from https://github.com/anthropics/commerce-agents/tree/main/plugins/commerce-builder/skills/commerce-prompt-caching into .cursor/skills/commerce-prompt-caching/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "commerce-prompt-caching", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/anthropics/commerce-agents.git --path plugins/commerce-builder/skills/commerce-prompt-caching--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add anthropics/commerce-agents --skill commerce-prompt-caching -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install anthropics/commerce-agents commerce-prompt-caching --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/anthropics/commerce-agents.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/plugins/commerce-builder/skills/commerce-prompt-caching .gemini/skills/commerce-prompt-caching && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "commerce-prompt-caching" agent skill from https://github.com/anthropics/commerce-agents/tree/main/plugins/commerce-builder/skills/commerce-prompt-caching into .gemini/skills/commerce-prompt-caching/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "commerce-prompt-caching", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install anthropics/commerce-agents commerce-prompt-cachingInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add anthropics/commerce-agents --skill commerce-prompt-caching -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/anthropics/commerce-agents.git skills-src && mkdir -p .github/skills && cp -r skills-src/plugins/commerce-builder/skills/commerce-prompt-caching .github/skills/commerce-prompt-caching && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "commerce-prompt-caching" agent skill from https://github.com/anthropics/commerce-agents/tree/main/plugins/commerce-builder/skills/commerce-prompt-caching into .github/skills/commerce-prompt-caching/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "commerce-prompt-caching", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add anthropics/commerce-agents --skill commerce-prompt-caching -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install anthropics/commerce-agents commerce-prompt-caching --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/anthropics/commerce-agents.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/plugins/commerce-builder/skills/commerce-prompt-caching .opencode/skills/commerce-prompt-caching && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "commerce-prompt-caching" agent skill from https://github.com/anthropics/commerce-agents/tree/main/plugins/commerce-builder/skills/commerce-prompt-caching into .opencode/skills/commerce-prompt-caching/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "commerce-prompt-caching", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
commerce-prompt-cachingThe reference agents' cache-stable request assembly, covering the static system and per-request context split, the fixed tool list, the rolling conversation breakpoint, which config fields are…
Commerce Prompt Caching is an agent skill from anthropics/commerce-agents, published by the product's own GitHub organization. The reference agents' cache-stable request assembly, covering the static system and per-request context split, the fixed tool list, the rolling conversation breakpoint, which config fields are prompt bytes, and verification. Load when writing or reviewing a commerce agent's prompt assembly, when cache reads are zero, or when a turn's latency or cost is the question.
Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Frontend & Design, covering Responsive design and LLM cost and token optimization. The repository describes itself as: Reference blueprint for building shopping and merchant agents with Claude. Examples in retail, commerce, telecom, and entertainment included. The licence is Apache-2.0.
3 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit fd4d592. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md.
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Commerce Prompt Caching loads about 2k tokens when it runs. Until then it costs about 98 tokens; SKILL.md has 1,017 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from anthropics/commerce-agents at commit fd4d592, republished under its Apache-2.0 licence (© anthropics). 1,017 words, ~2,022 tokens.
.claude/skills/commerce-prompt-caching/SKILL.md (or your agent's skills folder).commerce_common/ is commerce-common/commerce_common/, shopping_agent/ is shopping-agent/core/shopping_agent/, and
merchant_agent/ is merchant-agent/core/merchant_agent/.
A request's cacheable prefix runs tools, then system, then the messages; a breakpoint ends a span the next call reads
back. The reference agents place three, all from commerce_common/prompt_assembly.py:
with_tool_cache_control(tools).build_system_blocks(static, context) marks it and appends the context block unmarked.build_request_messages(messages, rolling_breakpoint=...) marks the last persisted
block on the outgoing request only; the next call then reads the earlier rounds, search payloads included, from cache.Everything per request goes in the context block, which the role's build_dynamic_context(...) renders once per turn.
In the static block or the tool list, those bytes would break the system or tool span on every request; in the context block they cost
one re-read of the conversation on a turn whose cart, page, or facts moved, and the rolling marker holds from that turn's
next round. The clock renders to the hour (context_clock), so a new minute moves nothing.
build_static_system(config, skills) in each role's prompt.py renders identity, the most-turns rules, the fence
notice, and the skill index from the config and the installed skills: the same bytes for the life of a deployment.build_dynamic_context(...) in the same module renders the per-request material inside the role's data fence: shopping
takes preferences, memory facts, the cart, the page, the account block, and the time; merchant takes the store context,
memory facts, and the time. Backend context blocks have their own size cap.ShoppingAgent.__init__ and MerchantAgent.__init__ (each role's runtime-messages-api orchestrator.py) build
_static_system and _tools once per process; stream_turn renders the context block per turn and calls
build_request_messages per model call.build_tools in each role's tools/registry.py emits the built-ins in a fixed order (the merchant builder adds run_analysis after them when enabled), the load_skill enum sorted,
then extensions in the order given, then web_search when enabled; every registered tool ships on every request, and
the executor decides on arrival whether a call can be served.SKILL_TOOL_ADAPTER) and the same contracts, and the SDK caches
them; the hosted manifests carry the text as system.md, which scripts/check.py compares with the builder.Two rounds carry no marker. A bare first call (one message): a one-shot session would pay the write without a read, and
the second call's marker covers the first message anyway. A round whose tool_choice is other than auto (the
grounding-forced first iteration and the forced-text last one): tool_choice keys the messages span, so an entry written
under a forced round is unreadable by the auto rounds after it; the system and tool spans still hit. Both live in
build_request_messages and the loops' rolling_breakpoint= argument; rolling_conversation_cache turns the marker off
for debugging.
When a turn's last call was given compact_history_above_tokens or more (its usage says; the default is the platform's
own tool-result-clearing default, a tenth of the window), the turn ends with compact_history in
commerce_common/turn.py, which replaces the oldest tool results in the stored conversation with a one-line marker
until the conversation is half its previous size. The next turn's first round rewrites the messages span once and later
rounds read the shorter one; turn_complete.results_cleared tells a host that appends its transcript to rewrite it. The
system and tool spans, the messages, and the write gates are unaffected; provenance lives on the session state.
The fields marked (prompt) in commerce_common/config.py and the role configs, plus enable_analysis and
max_items_per_change, which the merchant tool builder reads, render into the static text or the tool list; changing one is a redeploy and a miss on the next request:
| Config | Fields |
|---|---|
BaseAgentConfig (commerce_common/config.py) | brand_name, assistant_name, brand_voice, enable_web_search |
ShoppingAgentConfig (shopping_agent/config.py) | domain_search_notes, enable_disclosures, and the system switches enable_cart, enable_orders, enable_policies, enable_fulfillment |
MerchantAgentConfig (merchant_agent/config.py) | enable_analysis, require_host_approval, approval_surface, stage_shows_preview, and the system switches enable_listing_edits, enable_inventory, enable_pricing, enable_campaigns; max_items_per_change and max_search_results set maxItems and maximum on tool schemas |
Skills, presentation extensions, and delegates are prompt bytes too. Gate lexicons, guardrail limits, memory settings,
the latency knobs (eager_tool_dispatch, rolling_conversation_cache, eager_partial_frames,
close_on_presentation), cart caps, and compact_history_above_tokens are not; tests/test_role_registries.py
asserts it for each.
tools[] membership decided per request (a flag read per request instead of once at construction).(prompt) field, a skill, or an extension on a running deployment; each is a redeploy.tool_choice (grounding first, none last) misses the messages span only; the loops skip the marker there.turn_complete carries usage (usage_totals in commerce_common/turn.py, the turn's calls summed) and
elapsed_ms; every call also logs one line with the same counters and its own time (log_model_call, on
shopping_agent_runtime.orchestrator and merchant_agent_runtime.orchestrator). Zero cache reads on the second turn
of a conversation means the prefix changed. The counters worth charting per config version are cache reads as a
share of input, elapsed_ms, rounds per turn, and blocked tool_result events by gate.tests/test_role_registries.py builds each role's prompt and tools twice and compares bytes, checks the cache marks,
and checks that non-prompt settings change nothing; commerce-common/tests/test_prompt_assembly.py covers the block
builders, the context clock, the rolling marker, and the skip cases; tests/test_turn_loop.py pins both loops to the
same blocks, marker, and clean history. A deployment's tests carry the same three checks.© anthropics, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in plugins/commerce-builder/skills/commerce-prompt-caching of anthropics/commerce-agents.
Open the folder on GitHubat commit fd4d592
Commerce Prompt Caching next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Commerce Prompt Caching this skillanthropics/commerce-agents | 3.2k | — | ~2k | Automated safety check: Pass | Apache-2.0 | |
| Prompt Caching Patternssoftspark/ai-toolkit | 179 | — | ~1.1k | Automated safety check: Pass | Apache-2.0 | |
| UI StylingOhh-889/skyroc | 795 | 13 repos | ~2.5k | Automated safety check: Pass | MIT | |
| Material 3hamen/material-3-skill | 1.5k | 2 repos | ~7.8k | Automated safety check: Pass | MIT | |
| Trip Map Builderhiyeshu/trip-map-builder | 244 | — | ~1.7k | Automated safety check: Pass | None | |
| Antislop Layoutmobilemiqdadbadjuber/anti-slop | 5.7k | — | ~4.1k | Automated safety check: Pass | MIT |
softspark/ai-toolkit
Anthropic API prompt caching: TTL, breakpoints, stacking, invalidation, hit rate.
Ohh-889/skyroc
Create beautiful, accessible user interfaces with shadcn/ui components (built on Radix UI + Tailwind), Tailwind CSS utility-first styling, and canvas-based visual designs.
hamen/material-3-skill
Implement Google's Material Design 3 (Material You) UI system.
hiyeshu/trip-map-builder
End-to-end trip planning: gather user constraints, build a reference itinerary, research locations and dining signals via 大众点评 + 小红书, then generate an interactive mobile-first map page (Leaflet +…
miqdadbadjuber/anti-slop
Mobile layout skill for antislop. An agent skill from miqdadbadjuber/anti-slop.
lobehub/lobe-ui
Local browser verification for the lobe-ui component library and documentation site.
anthropics/commerce-agents
Authoring and running behavioral evals for a shopping or merchant agent, covering the case shape, authoring rules, code graders and judges, the run pattern, and poisoned fixtures.
anthropics/commerce-agents
Creating and improving listing content, covering titles, descriptions, attribute completeness, categorization fixes, image callouts written as text, edits written from material the operator…
anthropics/commerce-agents
How the reference commerce agents of either role are structured, covering the loop, where each rule lives, skills, the backend interface, delegates, and model fields.
anthropics/commerce-agents
The reference merchant agent, covering its flows, staged changes and host approval, metrics grounding, the analysis delegate, store memory, components, and marketplace rules.
anthropics/commerce-agents
The rules the reference agents enforce in code for third-party content, writes, grounding, identity, and memory, each with its module, plus two adversarial-eval rules.
anthropics/commerce-agents
The reference presentation-tool contract, covering server-side enrichment, suggestion chips, the event stream, progressive rendering, both roles' built-in components, and adding a vertical component.
Categories
The reference agents' cache-stable request assembly, covering the static system and per-request context split, the fixed tool list, the rolling conversation breakpoint, which config fields are…. Commerce Prompt Caching is an agent skill from anthropics/commerce-agents, published by the product's own GitHub organization. The reference agents' cache-stable request assembly, covering the static system and per-request context split, the fixed tool list, the rolling conversation breakpoint, which config fields are prompt bytes, and verification.
Commerce Prompt Caching fits situations like: tasks that involve Responsive design; tasks that involve LLM cost and token optimization.
Run `npx skills add anthropics/commerce-agents --skill commerce-prompt-caching -a claude-code`. Or copy the skill folder (plugins/commerce-builder/skills/commerce-prompt-caching in anthropics/commerce-agents) into .claude/skills/commerce-prompt-caching in your project. Claude Code loads it when a task matches its description.
Run `npx skills add anthropics/commerce-agents --skill commerce-prompt-caching -a codex`. Or copy the skill folder (plugins/commerce-builder/skills/commerce-prompt-caching in anthropics/commerce-agents) into .agents/skills/commerce-prompt-caching in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add anthropics/commerce-agents --skill commerce-prompt-caching -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/commerce-prompt-caching, .gemini/skills/commerce-prompt-caching, .github/skills/commerce-prompt-caching and .opencode/skills/commerce-prompt-caching in your project.
SKILL.md names no scripts, command-line tools or credentials: Commerce Prompt Caching is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Commerce Prompt Caching is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2k tokens (SKILL.md is roughly 8.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Commerce Prompt Caching: Prompt Caching Patterns (softspark/ai-toolkit, 179 stars), UI Styling (Ohh-889/skyroc, 795 stars), Material 3 (hamen/material-3-skill, 1.5k stars) and Trip Map Builder (hiyeshu/trip-map-builder, 244 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
anthropics (a GitHub organization, an official publisher) maintains it in anthropics/commerce-agents, which has 3,198 GitHub stars. The repository holds 16 skills in this directory. The repository was last updated on October 2, 2026.
Source: anthropics/commerce-agents on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.