agent skills

Claude API (Anthropic, official)

Anthropic's official Claude API skill from anthropics/skills — auto-loaded for Claude/Anthropic/LLM-shaped work. Routes to the right language-specific SDK file, picks the current model by default, and includes drift fixes for API shape changes since training.
★ 175.5k by Anthropic updated Sep 10, 2026 other
install via your agent of choice
❯ /plugin install example-skills@anthropic-agent-skills (Claude Code marketplace) — or register the whole repo: /plugin marketplace add anthropics/skills Then pick claude-api from the example-skills set. On Claude.ai the skill is already available on paid plans. Via the API, use the Skills API Quickstart.

## what it does

tl;dr: the auto-loaded instruction bundle Anthropic ships for any task that touches Claude / Anthropic / SDK code. It does not run code itself — it tells the agent (a) which language-specific sub-skill to read, (b) which model to use by default, and (c) where the API has drifted since training (extended-thinking shape, web tools IDs, files/skills out of beta, refusal fallback, etc.).

What it actually does

Per the frontmatter, the skill activates when the prompt names Claude/Anthropic in any form, when the user asks about an LLM (pricing / model choice / limits / caching), or when the task is LLM-shaped with provider unstated (agent / MCP / tool-definition / multi-agent / RAG / LLM-judge / computer-use; generate / summarize / extract / classify / rewrite). It also reads the SKILL.md before opening any target file — even if the change “looks like a one-liner.”

It explicitly bails when another provider is named (OpenAI / Gemini / Llama / Mistral / Cohere / Ollama) or when a project grep finds openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama. The exit is loud: tell the user the skill produces Claude/Anthropic SDK code and ask whether to switch or keep provider-neutral.

Default outputs (the SKILL.md “Defaults” block)

Unless the user says otherwise:

  • Model: claude-opus-5 — exact model string. Never claude-sonnet-5, never claude-opus-5-20251114 style suffixes. Use the table or the Models API; do not construct an ID from memory.
  • Thinking: thinking: {type: "adaptive"} for anything remotely complicated. budget_tokens is rejected with a 400 on Fable 5 / 5.1 / Opus 5 / 4.8 / 4.7 / Sonnet 5.
  • Streaming: default for any long-input / long-output / high-max_tokens request. Use the SDK’s .get_final_message() / .finalMessage() helper to skip per-event handling.

Where the API has drifted (the SKILL.md drift table, condensed)

AreaStale priorCurrent API
Extended thinkingthinking: {type: "enabled", budget_tokens: N}thinking: {type: "adaptive"} on Claude 4.6+ (Sonnet 4.6 onward). budget_tokens is rejected with 400 on Fable 5/5.1, Sonnet 5, Opus 5/4.8/4.7. Pre-4.6 models still use budget_tokens.
Web search / web fetch tool typeweb_search_20250305, web_fetch_20250910web_search_20260209, web_fetch_20260209 (dynamic filtering) on Opus 5/4.8/4.7/4.6, Sonnet 5, Sonnet 4.6. Vertex AI: only basic web_search_20250305, no web fetch.
PHP parameter namessnake_case wire names as named args (max_tokens)Top-level named args are camelCase (maxTokens). Nested array keys vary ('taskBudget', 'skillID', 'mcp_server_name'); copy exact keys from documented examples.
Managed Agents credentialsHost-side secret storage (only option pre-vaults)Vault environment_variable credentials — stored by Anthropic, substituted at egress, never visible in the sandbox. Host-side custom tools remain the fallback.
Files API / Skills APIclient.beta.files.* / client.beta.skills.* with beta headersOut of beta: client.files.* / client.skills.*, no beta header. client.beta.files / client.beta.skills shapes are breaking from earlier versions — migrate per shared/live-sources.md.

Current models (cached 2026-06-24 in the skill, fetched 2026-09-10 here)

ModelModel IDContextInput $/1MOutput $/1M
Claude Fable 5.1claude-fable-5-11M$10.00$50.00
Claude Mythos 5.1 (Project Glasswing)claude-mythos-5-11M$10.00$50.00
Claude Fable 5claude-fable-51M$10.00$50.00
Claude Opus 5claude-opus-51M$5.00$25.00
Claude Opus 4.8claude-opus-4-81M$5.00$25.00
Claude Opus 4.7claude-opus-4-71M$5.00$25.00
Claude Opus 4.6claude-opus-4-61M$5.00$25.00
Claude Sonnet 5claude-sonnet-51M$2.00$10.00
Claude Sonnet 4.6claude-sonnet-4-61M$3.00$15.00
Claude Haiku 4.5claude-haiku-4-5200K$1.00$5.00

Partner-platform pricing (Bedrock, Vertex, Foundry) is not the first-party rates above. Use the Bedrock or Vertex pricing pages, or the Pricing row in shared/live-sources.md.

Four agent approaches (the SKILL.md mental model)

#ApproachYou writeHarness & deployment
1Claude API — manual loopThe while stop_reason == "tool_use" loop yourselfYou build the harness; you host
2Claude API — Tool Runner (client.beta.messages.tool_runner + @beta_tool / betaZodTool)Just the tool functionsSDK supplies the loop (harness only); you host
3Managed Agents (REST, beta)Agent config + tool resultsAnthropic supplies harness and hosts a per-session sandbox
4Claude Agent SDK (claude-agent-sdk / @anthropic-ai/claude-agent-sdk)A prompt + optionsSDK supplies Claude Code harness + built-in tools (harness only); you host

The SKILL.md is explicit: this skill generates options 1–3. Option 4 (Agent SDK) is a different library — if the user wants it, point them at code.claude.com/docs/en/agent-sdk. Don’t substitute the Tool Runner for the Agent SDK or vice-versa.

Subcommands

The SKILL.md ships four /claude-api <subcommand> flows, each gated by a dedicated shared/ file:

  • migrate — move existing code to a newer Claude model. Reads shared/model-migration.md. Asks for scope (which files / directories) before any edit. Audits prompts/skills/tool descriptions via shared/prompt-audit.md after — prompting written for the source model is part of every migration.
  • prompt-audit — non-interactive scan of existing prompts, skills, and tool descriptions for dated patterns. Reads shared/prompt-audit.md. Produces both the report and a proposed diff without pausing for confirmation; applies edits only if the request explicitly asked for them.
  • upgrade — bump the Anthropic SDK across a major version (currently Python anthropic 0.x → 1.x). Reads python/claude-api/sdk-upgrade.md. Not the same as migrate — this is the SDK package, not the model.
  • cost-optimize — reduce spend without sacrificing quality. Reads shared/cost-optimization.md. Free wins (caching, input-token hygiene, loop hygiene, output-token hygiene, batch) before tradeoffs (budgets, effort, model choice, multi-model). “No changes recommended” is a valid outcome.

Language detection

Reads the target file first, then routes to the right sub-skill (python/, typescript/, java/, go/, ruby/, csharp/, php/, curl/). If multiple languages are present, ask. If language can’t be inferred, default to Python and say so. Rust / Swift / C++ / Elixir get cURL examples with a note that community SDKs may exist.

Every listed SDK language supports both the beta Tool Runner and Managed Agents (beta). For the prompt-audit subcommand the inventory is language-agnostic and the audit is non-interactive.

Provider clients (first sentence only — read the per-language file before writing code)

  • Amazon Bedrock — use AnthropicBedrockMantle (Python) / AnthropicBedrockMantle (TS) / bedrock.NewMantleClient (Go) / AnthropicOkHttpClient.builder().backend(BedrockMantleBackend.fromEnv()) (Java) / new AnthropicBedrockMantleClient(...) (C#) / MantleClient (PHP) / Anthropic::BedrockMantleClient.new (Ruby). Region required. Legacy AnthropicBedrock / BedrockBackend (without Mantle) is the InvokeModel path — prefer Mantle for new code.
  • Microsoft Foundry — AnthropicFoundry (Python/TS), FoundryBackend (Java), AnthropicFoundryClient (C#), Foundry\Client::withCredentials (PHP). Go and Ruby: no first-party Foundry SDK; Ruby falls back to Anthropic::Client.new(base_url=...) (no built-in Entra ID).
  • Google Cloud Vertex AI — AnthropicVertex(project_id, region) (Python, install anthropic[vertex]); TS, Go, Java, C#, PHP, Ruby follow the same pattern. Vertex model IDs take no prefix for current-gen; dated snapshots use @ (claude-opus-4-5@20251101, not …-20251101). Auth is GCP ADC; no Anthropic API key.

shared/platform-availability.md is the single source of truth for per-platform feature availability — do not infer it from anywhere else.

Auth quick reference

The SDKs and ant CLI resolve credentials in this order: ANTHROPIC_API_KEY → ANTHROPIC_AUTH_TOKEN → ant auth login profile → Workload Identity Federation env vars → default profile on disk. A bare zero-arg client (Anthropic(), new Anthropic(), anthropic.NewClient()) works after ant auth login with no env var set. For raw HTTP, ant auth print-credentials --access-token returns a short-lived token; OAuth tokens go on Authorization: Bearer, not x-api-key.

Things the SKILL.md flags as easy to miss

  • Adaptive thinking is mandatory. budget_tokens is dead on 4.6+ models. Sending it returns a 400, not a warning.
  • thinking.display defaults to "omitted" on Fable 5 / 5.1 / Mythos 5 / 5.1 / Opus 5 / 4.8 / 4.7 / Sonnet 5. Silent change from Opus 4.6 / Sonnet 4.6 where it was "summarized". Set display: "summarized" if you stream reasoning to users — otherwise they see a long pause.
  • Claude Fable 5.1 thinking is always on. Omit thinking, or send {type: "adaptive"}. {type: "disabled"} and {type: "enabled", budget_tokens: N} both return 400. Control depth with output_config.effort.
  • Refusal stop reason. Safety classifiers may decline a request as HTTP 200, stop_reason: "refusal", with stop_details. Always check stop_reason before reading content. Default to fallbacks: "default" with beta server-side-fallback-2026-07-01 when writing Fable 5.1 / Opus 5 code; tell the user it’s on. The array form (fallbacks: [{model: ...}]) still works on the first-party API and Claude Platform on AWS; Bedrock / Vertex / Foundry use the SDKs’ client-side BetaRefusalFallbackMiddleware.
  • No assistant prefill on 4.6+ family.
  • 30-day data retention required for Claude Fable 5.1 — not eligible for zero-data-retention unless Anthropic expressly authorizes it. ZDR orgs get 400 invalid_request_error.
  • Compaction is append-only. Append response.content (not the text string) back to messages every turn. Compaction blocks in the response must be preserved — extracting text and appending that silently loses compaction state. Beta header compact-2026-01-12.
  • Prompt caching invalidates on any byte change in the prefix. Render order tools → system → messages. Stable content first, volatile content last. Max 4 breakpoints per request. Minimum cacheable prefix is model-dependent (512–4096 tokens) — shorter prefixes silently won’t cache. Verify with usage.cache_read_input_tokens; if zero, audit for silent invalidators (datetime.now() in system prompt, unsorted JSON, varying tool set).
  • Mid-conversation system messages preserve cache prefix on Opus 5 / 4.8 / Fable 5 / 5.1 / Mythos 5 / 5.1 — append {"role": "system", ...} to messages[] instead of editing top-level system. Not on Sonnet 5.
  • Fast Mode is Opus 5 / Opus 4.8 only, research preview. Three required things on every request: client.beta.messages...., beta flag fast-mode-2026-02-01, top-level speed: "fast" (not a header, not in extra_body). Opus 4.7 fast mode is removed — speed: "fast" on 4.7 returns an error. Fast mode on Opus 5 is $10 / $50 per MTok. Not available on Batch, Priority Tier, Claude Platform on AWS, Bedrock, Vertex, or Foundry.
  • Task Budgets (beta, Opus 5 / Fable 5 / Fable 5.1 / Sonnet 5 / Opus 4.8 / 4.7) — token ceiling for an agentic loop inside output_config.task_budget with beta task-budgets-2026-03-13. Stream so the large max_tokens doesn’t hit HTTP timeouts. Not the same as Managed Agents session budgets (those are dollar-denominated platform-enforced caps).
  • Context editing is clearing, not compaction. Strategy types clear_tool_uses_20250919 and clear_thinking_20251015 on beta context-management-2025-06-27. Do not use compact_20260112 or beta compact-2026-01-12 here — those are the separate compaction feature.
  • Structured outputs: output_config.format (deprecated old name was output_format) and strict: true for tool parameter validation. The recommended path is client.messages.parse() which validates responses against your schema automatically.

Gotchas

  • License is Proprietary. LICENSE.txt restricts redistribution and derivative works. You use the skill; you don’t fork it.
  • Default model is Opus 5, not Sonnet. The SKILL.md is explicit: do not downgrade for cost unless the user asks. Effort (output_config.effort: low|medium|high|xhigh|max) is the cost-tuning lever within a model — measure on real requests before raising a default.
  • The skill does not cover Claude Agent SDK code. If the user wants claude-agent-sdk / @anthropic-ai/claude-agent-sdk, redirect to code.claude.com/docs/en/agent-sdk. Don’t substitute the API Tool Runner.
  • For C# / Java / Go / PHP / Ruby: never infer the binding from cURL or another language’s SDK. Function names, namespaces, method signatures, import paths must come from explicit docs. If the binding you need isn’t documented in the {lang}/ file, WebFetch the SDK repo from shared/live-sources.md before writing code.
  • Vertex model IDs have no prefix for current-gen; dated snapshots use @. claude-opus-4-5@20251101, not claude-opus-4-5-20251101.
  • Fast Mode / Priority Tier are not on every model. Priority Tier is excluded on Opus 5, Sonnet 5, Fable 5.1, Mythos 5 / 5.1, Mythos Preview.
  • sandbox_test untested — we read the SKILL.md, we did not run a build through the agent.

Install

# Claude Code (marketplace) — example-skills set includes claude-api
/plugin marketplace add anthropics/skills
/plugin install example-skills@anthropic-agent-skills

# Or clone the folder directly into a watched skills directory
git clone https://github.com/anthropics/skills.git
cp -r skills/claude-api ~/.claude/skills/claude-api   # macOS / Linux
# Windows (PowerShell): Copy-Item -Recurse skills\claude-api $HOME\.claude\skills\claude-api

On Claude.ai, claude-api is part of the example-skills available on paid plans. Via the API, attach via container.skills:

{
  "model": "claude-opus-5",
  "max_tokens": 4096,
  "container": {
    "skills": [
      { "type": "anthropic", "skill_id": "claude-api", "version": "latest" }
    ]
  },
  "messages": [
    { "role": "user", "content": "Help me migrate src/agent.py to claude-opus-5" }
  ],
  "tools": [
    { "type": "code_execution_20250825", "name": "code_execution" }
  ]
}

Skills via the API require code_execution_20250825 and a model that supports the Skills API (claude-opus-5 in the example).

## compatibility

claude-code ✓
cursor ~
cline ~
aider —

## embed this badge

cache ✓ in cache.directory
![cached](https://cache.directory/badge/anthropic-claude-api.svg)