Agent skill · software engineering · jeremylongshore
anth-sdk-patterns
Apply production-ready Anthropic SDK patterns for TypeScript and Python.
Why this skill is useful
Adds production-ready SDK patterns for Claude integrations, including executable code examples and error handling strategies.
What it needs
Requires @anthropic-ai/sdk installed locally. 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 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 Pattern 2: Multi-Turn Conversation Manager Pattern 3: Structured Output with Prefill Pattern 4: Multi-Tenant Client Factory Pattern 5: Token-Aware Request Sizing Instructions Choose one pattern for the integration boundary instead of copying all of them into a single client. Start with the typed wrapper for a service that returns text, add the conversation manager only when the application owns turn history, and use token counting before submitting large documents. Keep tenant keys in a server-side secret store and make the factory key its cache by tenant identity; never accept or persist a customer key in browser code. Test the selected wrapper with a mocked SDK response before enabling live requests. Output The selected pattern yields a stable application-level interface: a text value or stream for an interactive request, a JSON object that has passed parsing for structured extraction, or a tenant-scoped client whose credentials remain isolated. Failures are surfaced as explicit SDK errors or a missing-text/JSON parsing error rather than silently returning partial data. Examples For a support API, instantiate one ClaudeService at process startup and call complete() from the server route; return its string only after the wrapper has confirmed a text block. For a document import, call counttokens() first, reduce the requested output to the remaining budget, then pass the bounded request to the wrapper. In a multi-tenant service, resolve the tenant's key from the secret store and use getClientForTenant() so one customer's retry or usage state cannot be confused with another's. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills jeremylongshore/anth-sdk-patterns