claude-api — API Development Assistant
- Trigger:
/claude-apior code importinganthropic/@anthropic-ai/sdk - Best for: Building apps with Claude API, debugging API calls, optimizing prompt caching
- Not for: Other LLM providers (OpenAI etc.), general API development
Overview
claude-api helps you build, debug, and optimize applications using the Claude API / Anthropic SDK. It excels at Prompt Caching, model version migration, and tool use optimization.
Trigger Conditions
claude-api auto-triggers when:
- Code imports
anthropicor@anthropic-ai/sdk - You mention Claude API, Anthropic SDK
- You add/modify Claude features (caching, thinking, tool use)
- You ask about prompt caching
Skipped when:
- Importing
openaior other providers - General HTTP API development
Examples
Example 1: Add Prompt Caching
/claude-api Help me add prompt caching to this chat app to reduce token costsClaude analyzes the code and suggests:
- What to cache (system prompts, tool definitions)
- How to use
cache_controlmarkers - How to verify cache hit rate
Example 2: Model Version Migration
/claude-api Migrate this project from Claude 4.5 to 4.7, check for breaking changesExample 3: Tool Use Optimization
/claude-api My tool use response times are too slow — help me optimizeExample 4: Error Handling
/claude-api Improve the API call error handling and retry logicExample 5: Streaming
/claude-api Add streaming responses to this chat applicationCommon Optimizations
| Optimization | Effect |
|---|---|
| Prompt Caching | 90%+ reduction in duplicate token costs |
| Thinking Budget | Control reasoning depth and cost |
| Token Limits | Prevent context window overflow |
| Batch Processing | Reduce API call count |
Notes
- Prompt Caching has a minimum cacheable length (typically >1024 tokens)
- Caching is based on exact string matching — even one character difference causes a miss
- Model migration: watch for behavioral differences, not just API differences
- Always implement exponential backoff for production error handling
Related Skills
- write-a-skill — Encapsulate common API patterns as a Skill
- diagnose — Troubleshoot API call issues