anth-sdk-patterns

Featured

Apply production-ready Anthropic SDK patterns for TypeScript and Python. Use when implementing Claude integrations, building reusable wrappers, or establishing team coding standards for the Messages API. Trigger with phrases like "anthropic SDK patterns", "claude best practices", "anthropic code patterns", "production claude code".

AI & Automation 2,266 stars 315 forks Updated today 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-ready patterns for the Anthropic SDK covering client management, error handling, type safety, and multi-tenant configurations. ## Prerequisites - Completed `anth-install-auth` setup - Familiarity with async/await patterns - TypeScript 5+ or Python 3.10+ ## Pattern 1: Typed Wrapper with Retry ```typescript import Anthropic from '@anthropic-ai/sdk'; import type { Message, MessageCreateParams } from '@anthropic-ai/sdk/resources/messages'; class ClaudeService { private client: Anthropic; constructor(apiKey?: string) { this.client = new Anthropic({ apiKey: apiKey || process.env.ANTHROPIC_API_KEY, maxRetries: 3, // SDK handles 429 + 5xx automatically timeout: 60_000, }); } async complete( prompt: string, options: Partial<MessageCreateParams> = {} ): Promise<string> { const message = await this.client.messages.create({ model: options.model || 'claude-sonnet-4-20250514', max_tokens: options.max_tokens || 1024, messages: [{ role: 'user', content: prompt }], ...options, }); const textBlock = message.content.find((b) => b.type === 'text'); if (!textBlock || textBlock.type !== 'text') { throw new Error(`No text in response: ${message.stop_reason}`); } return textBlock.text; } async *stream(prompt: string, model = 'claude-sonnet-4-20250514'): AsyncGenerator<string> { const stream = this.client.messages.stream({ mode...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

clade-sdk-patterns

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".

2,266 Updated today
jeremylongshore
AI & Automation Listed

claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

0 Updated today
CodeWithBehnam
AI & Automation Solid

claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

199,464 Updated today
affaan-m
AI & Automation Featured

clade-reliability-patterns

Build fault-tolerant Claude integrations — retries, circuit breakers, Use when working with reliability-patterns patterns. fallbacks, timeouts, and graceful degradation. Trigger with "anthropic reliability", "claude fault tolerance", "anthropic circuit breaker", "claude fallback".

2,266 Updated today
jeremylongshore
AI & Automation Featured

anth-install-auth

Install and configure Anthropic Claude SDK authentication for Python and TypeScript. Use when setting up a new Claude API integration, configuring API keys, or initializing the Anthropic SDK in your project. Trigger with phrases like "install anthropic", "setup claude api", "anthropic auth", "configure anthropic API key", "claude sdk setup".

2,266 Updated today
jeremylongshore