Agent skill · marketing growth · jeremylongshore

anth-performance-tuning

Optimize Claude API performance with prompt caching, model selection,

Why this skill is useful

Provides specific techniques and code examples for optimizing Claude API performance that the AI wouldn't reliably generate on its own.

What it needs

Requires anthropic account access. About 4k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

Anthropic Performance Tuning Overview Optimize Claude API latency and throughput via prompt caching, model selection, streaming, and request optimization. The biggest wins come from prompt caching (90% input cost reduction) and model selection (Haiku is 4x faster than Sonnet). Prompt Caching (Biggest Win) Cache requirements: Minimum 1,024 tokens for Sonnet/Opus, 2,048 for Haiku. Cache lives for 5 minutes (refreshed on each hit). Model Selection for Speed Model Speed Cost (per MTok in/out) Best For ------- ------- ---------------------- ---------- Claude Haiku Fastest $0.80 / $4.00 Classification, extraction, routing Claude Sonnet Balanced $3.00 / $15.00 General tasks, tool use, code Claude Opus Deepest $15.00 / $75.00 Complex reasoning, research Streaming for Perceived Speed Reduce Token Count Parallel Requests Performance Benchmarks Optimization Latency Impact Cost Impact ------------- ---------------- ------------- Prompt caching -50% (cached portion) -90% input cost Haiku over Sonnet -75% TTFT -73% cost Streaming -80% TTFT (perceived) Same cost Lower maxtokens -10-30% total time Same cost Prefill technique -20% output tokens Proportional savings Prerequisites Define latency, throughput, quality, token, and error SLOs plus the owner-approved model, cache, concurrency, and retry policy. Use pinned model IDs, synthetic prompts, an isolated workspace, and representative non-sensitive fixtures; do not benchmark with customer content or production credentials. Configure aggregate-only telemetry, bounded concurrency, rate-limit awareness, and a tested rollback configuration. Instructions 1. Establish a baseline for time-to-first-token, completion latency, tokens, cache hit rate, throughput, quality, and errors using repeated synthetic runs. 2. Change one lever at a time: model, prompt/cache layout, token budget, streaming, batching, or concurrency. Keep prompt content out of logs and verify cache eligibility for sensitive data before enabling it. 3. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/anth-performance-tuning

View the source on GitHub

Browse the @skills marketplace