agentsclimarketplace

Elevenlabs local dev loop

Skill jeremylongshore/claude-code-plugins-plus-skills/skills/.curated/elevenlabs-local-dev-loop

425 plugins, 2,810 skills, 200 agents for Claude Code. Open-source marketplace at tonsofskills.com with the ccpi CLI package manager.

Install
npx -y skills add jeremylongshore/claude-code-plugins-plus-skills --skill elevenlabs-local-dev-loop

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

Use when setting up a local ElevenLabs dev environment for a TTS/voice project and you need SDK mocking, hot reload, quota-aware iteration, and audio-output testing that does not burn character quota during development. Trigger with "elevenlabs dev setup", "elevenlabs local development", "elevenlabs dev environment", "develop with elevenlabs", "test elevenlabs locally".

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

5.6 KB, as published. Nobody here has run it

ElevenLabs Local Dev Loop

Overview

Set up a fast, cost-effective local development workflow for ElevenLabs audio projects. The loop centers on three moves — mock the SDK so unit tests never burn character quota, gate real API calls behind an explicit ELEVENLABS_INTEGRATION=1 flag, and select a cheaper model in dev while keeping the high-quality model for production — with tsx watch hot reload and a quota checker to round out the cycle.

Follow the high-level flow below to scaffold the project, then drill into references/implementation.md for the full code of every step and references/examples.md for worked end-to-end runs.

Prerequisites

Before starting, confirm your environment is ready:

  • The elevenlabs-install-auth setup is complete, so the SDK (@elevenlabs/elevenlabs-js) is installed and ELEVENLABS_API_KEY is available in .env.local.
  • Node.js 18+ with npm or pnpm.
  • vitest installed as the test runner (recommended) — it powers the mock layer and the integration-test guard.

Instructions

Work through the six steps in order. Each is summarized here; the full code for every step lives in references/implementation.md.

  1. Project structure — lay out src/elevenlabs/ (client, config, tts), tests/__mocks__/ and tests/fixtures/sample.mp3, a git-ignored output/, and .env.local / .env.example. Full tree in the reference.

  2. Environment configuration — write an environment-aware config.ts that picks the model and output format by NODE_ENV. This is the essential skeleton:

    // src/elevenlabs/config.ts
    export function loadConfig() {
      const env = process.env.NODE_ENV || "development";
      return {
        apiKey: process.env.ELEVENLABS_API_KEY || "",
        // cheaper/faster in dev, best quality in prod
        modelId: env === "production"
          ? "eleven_multilingual_v2"   // 1.0 credits/char
          : "eleven_flash_v2_5",       // 0.5 credits/char, ~75ms
        defaultVoiceId: process.env.ELEVENLABS_VOICE_ID || "21m00Tcm4TlvDq8ikWAM",
        outputFormat: "mp3_22050_32",  // smaller files for dev
      };
    }
    
  3. Mock the SDK — write tests/__mocks__/elevenlabs.ts that returns the sample.mp3 fixture from textToSpeech.convert/stream and stubs voices.getAll and user.get, so unit tests cost nothing.

  4. Development scripts — add dev (tsx watch), test, test:watch, test:integration, generate, and quota scripts to package.json.

  5. Quota-aware development — add src/check-quota.ts that reads user.subscription and exits non-zero when fewer than 1000 characters remain, so a low balance fails fast.

  6. Integration test guard — write tests/tts.test.ts where the real-API test is it.skipIf(!useRealApi) and only runs under ELEVENLABS_INTEGRATION=1; the mocked test always runs.

See references/implementation.md for the complete, copy-pasteable code for each step.

Output

  • Working development environment with hot reload via tsx watch
  • Mock layer that avoids API calls and character charges during dev
  • Quota checker to prevent surprise billing
  • Integration test guard pattern (ELEVENLABS_INTEGRATION=1)
  • Environment-aware model selection (cheap in dev, quality in prod)

Error Handling

ErrorCauseSolution
MODULE_NOT_FOUNDSDK not installednpm install @elevenlabs/elevenlabs-js
Mock returns undefinedMock not wiredCheck vi.mock path matches import
Integration test failsNo API keySet ELEVENLABS_API_KEY in .env.local
Quota exceeded in devRunning real API callsUse mock layer; run npm run quota first

Examples

Four worked runs of the loop — full walkthroughs in references/examples.md:

  • Zero-cost unit testsnpm run test drives the service through the mock client, passes offline, and never touches the API or your quota.
  • Quota preflightnpm run quota prints Characters: 500 / 10,000 (5.0% used) and exits 1 when fewer than 1000 characters remain, blocking a paid run before it starts.
  • Opt-in integration runnpm run test:integration sets ELEVENLABS_INTEGRATION=1, flipping the it.skipIf(!useRealApi) test on so the real API is hit only when you ask for it.
  • Hot-reload iterationnpm run dev (tsx watch) restarts on save; with the dev model (eleven_flash_v2_5) and mocks, each loop stays fast and free.

Resources

Next Steps

Once the dev loop is running, move on to production-ready code: see the elevenlabs-sdk-patterns skill for streaming, retries, and voice-management patterns you can layer on top of this environment.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.