Agent skill · software engineering · jeremylongshore
clade-performance-tuning
Optimize Anthropic API latency \u2014 streaming, prompt caching, model\
Why this skill is useful
Adds executable scripts and optimization patterns specifically for improving performance with the Anthropic API, which the AI wouldn't generate on its own.
What it needs
Requires typescript installed locally. Requires anthropic account access. About 3k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.
What this skill does
Anthropic Performance Tuning Overview Claude latency has two components: time to first token (TTFT) and tokens per second (TPS). Different strategies target each. Latency Benchmarks (approximate) Model TTFT (p50) TTFT (p95) Output TPS ------- ----------- ----------- ------------ Claude Haiku 4.5 200ms 600ms ~150 Claude Sonnet 4 400ms 1.2s ~90 Claude Opus 4 800ms 2.5s ~40 Optimization Strategies Instructions Step 1: Always Stream Step 2: Prompt Caching — Faster TTFT Step 3: Use Haiku for Speed-Critical Paths Step 4: Reuse Client Instance Step 5: Parallel Requests Step 6: Minimize Output Tokens Output Streaming enabled for all user-facing responses (first token in ~400ms with Sonnet) Prompt caching reducing TTFT for large system prompts Model routing to Haiku for speed-critical classification/routing tasks Client instance reused across requests (no per-request connection overhead) Parallel requests firing independent Claude calls concurrently Error Handling Issue Cause Fix ------- ------- ----- TTFT > 3s Large uncached prompt Enable prompt caching Slow output Using Opus for simple tasks Downgrade to Haiku/Sonnet Timeouts Long generation + default timeout new Anthropic({ timeout: 120000 }) 529 overloaded API capacity SDK auto-retries; add fallback model Examples See Latency Benchmarks table and six numbered strategy sections above, each with complete TypeScript code examples. Resources Streaming Docs Prompt Caching Models Comparison Next Steps See clade-deploy-integration for production deployment patterns. Prerequisites Completed clade-install-auth User-facing application where latency matters Understanding of streaming and async patterns
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills jeremylongshore/clade-performance-tuning--23ce58