Developer pack
Claude Skill

Claude API Builder

Scaffolds and debugs Claude API / Anthropic SDK code — with prompt caching, streaming, and the right model defaults built in.

What it does

Takes a feature you want to build on the Claude API — chat, tool use, structured output, batching, caching — and produces working Anthropic SDK code in your project's language, with prompt caching and streaming on by default. Also migrates existing Claude code between model versions and catches provider-mixing mistakes before they ship.

When to use

  • Building or debugging an app on the Anthropic SDK (Python, TypeScript, Go, Java, Ruby)
  • Adding a Claude feature — prompt caching, extended thinking, tool use, batch, citations
  • Migrating a call to a newer model version, or chasing a low cache-hit rate

When not to use

  • The file is OpenAI / provider-neutral code — this skill writes Claude/Anthropic SDK code specifically
  • General prompt engineering or ML work not tied to the SDK

Install

Download the .zip, then unzip into your Claude skills folder.

mkdir -p ~/.claude/skills
unzip ~/Downloads/claude-api-builder.zip -d ~/.claude/skills/

# Restart Claude Code session.
# Skill is now available — Claude will use it when relevant.

SKILL.md

SKILL.md
---
name: claude-api-builder
description: Use when building, debugging, or optimizing an app on the Claude API / Anthropic SDK. Triggers on "Anthropic SDK", "Claude API", adding prompt caching / thinking / tool use, or migrating a Claude call to a new model.
---

# Claude API Builder

Most Claude API code leaves performance and money on the table because three things get skipped: prompt caching, streaming, and current model defaults. This skill writes SDK code that has them from the start, and migrates code that doesn't.

## First, check the file isn't another provider

Scan the target file for non-Anthropic markers — `import openai`, `langchain_openai`, `gpt-4`/`gpt-5`, a `*-openai` filename, or an explicit "keep this provider-neutral" instruction. If you find any, stop and ask before writing Anthropic SDK calls into it. Never mix two providers in one file.

## Required inputs

1. **Language** — infer from the project (`.py` → Python, `.ts` → TypeScript, etc.); ask only if ambiguous
2. **Surface** — plain messages, tool use, structured output, batch, or files/citations
3. **Prompt shape** — what's static (cacheable) vs. per-request (the variable tail)

## Defaults (unless the user says otherwise)

- **Use the official Anthropic SDK** for the language, never a raw `fetch`/`requests` shim, never an OpenAI-compatible wrapper
- **Model**: default to the current Opus model string; don't hardcode a retired version
- **Prompt caching**: mark the stable prefix (system prompt, long context, tool defs) with a cache breakpoint. This is the single biggest cost + latency win and the most-skipped step.
- **Streaming**: turn it on for anything with long input/output or high `max_tokens` — it prevents request timeouts. Use the SDK's final-message helper if you don't need per-event handling.
- **Thinking**: default to adaptive thinking for non-trivial reasoning tasks

## Don't guess the SDK surface

Method names, import paths, and signatures must come from the actual SDK docs for that language — not inferred from another language or from a cURL shape. If you're unsure of a binding, look it up before writing it.

## Output

Working code plus a one-line note on: which model, whether caching is active and where the breakpoint sits, and the expected cache-hit behavior (first call writes, repeats read).

## Anti-patterns

- A static 4K-token system prompt re-sent uncached on every request
- Hardcoding a model version that will retire (pin to the current one, leave a comment)
- Blocking (non-streaming) calls with high `max_tokens` that time out under load
- Reaching for raw HTTP in a project that has an official SDK

Example prompts

Once installed, try these prompts in Claude:

  • Add prompt caching to my Anthropic SDK chat endpoint — the system prompt is ~4K tokens and repeated on every request.
  • Migrate this Claude 3.5 Sonnet call to the current Opus model and turn on adaptive thinking + streaming.

Related prompts

Don't want to install a skill? These prompts in /prompts cover similar ground for one-shot use: