Agent skill · software engineering · jeremylongshore
elevenlabs-sdk-patterns
Apply production-ready ElevenLabs SDK patterns for TypeScript and Python. Use when implementing ElevenLabs integrations, refactoring SDK usage, or establishing team coding standards for audio AI applications. Trigger with "elevenlabs SDK patterns", "elevenlabs best practices", "elevenlabs code patterns", "idiomatic elevenlabs", "elevenlabs typescript".
Why this skill is useful
Adds production-ready TypeScript and Python SDK patterns for ElevenLabs, including executable code for singleton clients and error handling that the AI wouldn't generate on its own.
What it needs
Requires @elevenlabs/elevenlabs-js, elevenlabs installed locally. Requires elevenlabs account access. About 3k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.
What this skill does
ElevenLabs SDK Patterns Overview Production-ready patterns for the ElevenLabs TypeScript and Python SDKs. Covers singleton clients, type-safe TTS wrappers, error classification, retry with a concurrency queue, and multi-tenant client factories. Adopt them incrementally — the singleton client alone fixes the most common mistakes; add error classification and the queue as throughput grows. The full, copy-ready code for all six patterns lives in references/implementation.md. This file gives the high-level workflow plus the essential skeleton so you can follow it end to end, then drill into the reference for depth. Prerequisites @elevenlabs/elevenlabs-js installed (TypeScript) or elevenlabs (Python) ELEVENLABSAPIKEY exported in the environment (never hardcode the key) Familiarity with async/await patterns and error handling best practices Instructions Apply the patterns in order — each builds on the previous one: 1. Singleton client. Create one lazily-initialized ElevenLabsClient guarded by an ELEVENLABSAPIKEY check so misconfiguration fails fast at startup. Expose a resetClient() for tests. This is the skeleton every other pattern imports: 2. Type-safe TTS service. Wrap textToSpeech.convert behind a typed TTSOptions interface and named VoicePreset records (narration / conversational / dramatic / neutral) so voice settings are compile-time checked and consistent across the codebase. 3. Error classification. Map raw SDK errors to an ElevenLabsServiceError carrying a stable code (authfailed, quotaexceeded, ratelimited, concurrentlimit, voicenotfound, invalidrequest, servererror, networkerror) and a retryable flag driven by HTTP status. 4. Retry with a concurrency queue. Route calls through a p-queue sized to your plan's concurrent-request limit, retrying only retryable errors with exponential backoff + jitter. 5. Multi-tenant factory. For SaaS platforms, key one client per tenant in a Map so each customer's API key stays isolated. 6. Python async. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills jeremylongshore/elevenlabs-sdk-patterns--9a54d1