clade-sdk-patterns

Featured

Production-ready Anthropic SDK patterns — client config, retries, timeouts, Use when working with sdk-patterns patterns. error handling, TypeScript types, and async patterns. Trigger with "anthropic sdk", "claude client setup", "anthropic typescript", "anthropic python patterns".

AI & Automation 2,926 stars 433 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Anthropic SDK Patterns ## Overview Production patterns for the `@claude-ai/sdk` (TypeScript) and `anthropic` (Python) SDKs. ## Client Configuration ## Instructions ### Step 1: TypeScript ```typescript import Anthropic from '@claude-ai/sdk'; // Default — reads ANTHROPIC_API_KEY from env const client = new Anthropic(); // Full configuration const client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY, // default: env var maxRetries: 3, // default: 2 timeout: 60_000, // default: 10 minutes baseURL: 'https://api.anthropic.com', // override for proxies defaultHeaders: { // custom headers 'claude-beta': 'prompt-caching-2024-07-31', }, }); ``` ### Step 2: Python ```python import anthropic # Sync client client = anthropic.Anthropic() # Async client client = anthropic.AsyncAnthropic() # Full configuration client = anthropic.Anthropic( api_key=os.environ["ANTHROPIC_API_KEY"], max_retries=3, timeout=60.0, base_url="https://api.anthropic.com", default_headers={"claude-beta": "prompt-caching-2024-07-31"}, ) ``` ## Output - Properly configured client with retries, timeouts, and custom headers - Type-safe error handling with specific exception classes - Streaming implementation using your preferred pattern - Prompt caching enabled for repeated system prompts (90% cost savings) - Batch processing configured for bulk operations (50% cost savings) ## Error...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category