DE

deepgram-multi-env-setup

Defines strategies for isolated Deepgram environments, including project segregation, model selection, and config management.

Install

mkdir -p .claude/skills/deepgram-multi-env-setup && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/8985" && unzip -o skill.zip -d .claude/skills/deepgram-multi-env-setup && rm skill.zip

Installs to .claude/skills/deepgram-multi-env-setup

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Configure Deepgram multi-environment setup for dev, staging, and production.
76 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Define environment-specific configurations for dev, staging, and production
  • Implement typed configuration interfaces
  • Manage environment-specific concurrency and model selection
  • Validate environment connectivity and project access
  • Configure Docker Compose profiles for environment isolation

How it works

It uses a typed configuration loader and a client factory to ensure that the correct project ID, model, and concurrency limits are applied based on the current environment.

Inputs & outputs

You give it
Environment name and corresponding API keys
You get back
Environment-validated Deepgram client factory

When to use deepgram-multi-env-setup

  • Configure staging vs production Deepgram projects
  • Set environment-specific model constraints
  • Implement typed configuration for Deepgram clients
  • Define concurrency and PII redaction by environment

About this skill

Deepgram Multi-Environment Setup

Overview

Configure isolated Deepgram environments for development, staging, and production. Each environment uses a separate Deepgram project, scoped API keys, environment-specific model selection, and validated configuration. Includes typed config, client factory, Docker Compose profiles, and Kubernetes overlays.

Environment Strategy

SettingDevelopmentStagingProduction
Modelbase (fast, cheap)nova-3nova-3
Concurrency520100
DiarizationOffOnOn
PII RedactionOffOnOn
Callback URLlocalhost:3000staging.example.comapi.example.com
Key RotationManualMonthly90-day auto

Instructions

Step 1: Typed Environment Configuration

interface DeepgramEnvConfig {
  apiKey: string;
  projectId: string;
  model: 'base' | 'nova-2' | 'nova-3';
  maxConcurrency: number;
  features: {
    diarize: boolean;
    smart_format: boolean;
    redact: string[] | false;
    summarize: boolean;
  };
  callbackBaseUrl?: string;
  timeout: number;
}

function loadConfig(env: string): DeepgramEnvConfig {
  const configs: Record<string, DeepgramEnvConfig> = {
    development: {
      apiKey: process.env.DEEPGRAM_API_KEY_DEV!,
      projectId: process.env.DEEPGRAM_PROJECT_ID_DEV!,
      model: 'base',
      maxConcurrency: 5,
      features: {
        diarize: false,
        smart_format: true,
        redact: false,
        summarize: false,
      },
      callbackBaseUrl: 'http://localhost:3000',
      timeout: 60000,
    },
    staging: {
      apiKey: process.env.DEEPGRAM_API_KEY_STAGING!,
      projectId: process.env.DEEPGRAM_PROJECT_ID_STAGING!,
      model: 'nova-3',
      maxConcurrency: 20,
      features: {
        diarize: true,
        smart_format: true,
        redact: ['pci', 'ssn'],
        summarize: true,
      },
      callbackBaseUrl: 'https://staging.example.com',
      timeout: 30000,
    },
    production: {
      apiKey: process.env.DEEPGRAM_API_KEY_PRODUCTION!,
      projectId: process.env.DEEPGRAM_PROJECT_ID_PRODUCTION!,
      model: 'nova-3',
      maxConcurrency: 100,
      features: {
        diarize: true,
        smart_format: true,
        redact: ['pci', 'ssn'],
        summarize: true,
      },
      callbackBaseUrl: 'https://api.example.com',
      timeout: 30000,
    },
  };

  const config = configs[env];
  if (!config) throw new Error(`Unknown environment: ${env}. Use: development, staging, production`);
  if (!config.apiKey) throw new Error(`DEEPGRAM_API_KEY_${env.toUpperCase()} not set`);
  return config;
}

const env = process.env.NODE_ENV ?? 'development';
const config = loadConfig(env);

Step 2: Client Factory

import { createClient, DeepgramClient } from '@deepgram/sdk';

class DeepgramClientFactory {
  private static clients = new Map<string, DeepgramClient>();

  static getClient(env?: string): DeepgramClient {
    const environment = env ?? process.env.NODE_ENV ?? 'development';

    if (!this.clients.has(environment)) {
      const config = loadConfig(environment);
      this.clients.set(environment, createClient(config.apiKey));
      console.log(`Deepgram client created for: ${environment} (model: ${config.model})`);
    }

    return this.clients.get(environment)!;
  }

  // Convenience: transcribe with environment defaults
  static async transcribe(url: string, overrides: Record<string, any> = {}) {
    const environment = process.env.NODE_ENV ?? 'development';
    const config = loadConfig(environment);
    const client = this.getClient(environment);

    const { result, error } = await client.listen.prerecorded.transcribeUrl(
      { url },
      {
        model: config.model,
        smart_format: config.features.smart_format,
        diarize: config.features.diarize,
        redact: config.features.redact || undefined,
        summarize: config.features.summarize ? 'v2' : undefined,
        ...overrides,
      }
    );
    if (error) throw error;
    return result;
  }

  // Reset for key rotation
  static reset(env?: string) {
    if (env) {
      this.clients.delete(env);
    } else {
      this.clients.clear();
    }
  }
}

Step 3: Environment Variables Template

# .env.development
DEEPGRAM_API_KEY_DEV=dev-key-here
DEEPGRAM_PROJECT_ID_DEV=dev-project-id

# .env.staging
DEEPGRAM_API_KEY_STAGING=staging-key-here
DEEPGRAM_PROJECT_ID_STAGING=staging-project-id

# .env.production (use secret manager, not file)
# DEEPGRAM_API_KEY_PRODUCTION=production-key-here
# DEEPGRAM_PROJECT_ID_PRODUCTION=production-project-id

Step 4: Docker Compose Multi-Profile

# docker-compose.yml
x-common: &common
  build: .
  restart: unless-stopped
  healthcheck:
    test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/health"]
    interval: 30s
    timeout: 10s

services:
  app-dev:
    <<: *common
    profiles: ["development"]
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=development
      - DEEPGRAM_API_KEY_DEV=${DEEPGRAM_API_KEY_DEV}
      - DEEPGRAM_PROJECT_ID_DEV=${DEEPGRAM_PROJECT_ID_DEV}

  app-staging:
    <<: *common
    profiles: ["staging"]
    ports:
      - "3001:3000"
    environment:
      - NODE_ENV=staging
      - DEEPGRAM_API_KEY_STAGING=${DEEPGRAM_API_KEY_STAGING}
      - DEEPGRAM_PROJECT_ID_STAGING=${DEEPGRAM_PROJECT_ID_STAGING}

  app-production:
    <<: *common
    profiles: ["production"]
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
      - DEEPGRAM_API_KEY_PRODUCTION=${DEEPGRAM_API_KEY_PRODUCTION}
      - DEEPGRAM_PROJECT_ID_PRODUCTION=${DEEPGRAM_PROJECT_ID_PRODUCTION}
    deploy:
      resources:
        limits:
          memory: 512M
# Usage:
docker compose --profile development up
docker compose --profile staging up
docker compose --profile production up

Step 5: Kubernetes Kustomize Overlays

# k8s/base/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: deepgram-config
data:
  DEEPGRAM_MODEL: "nova-3"
  DEEPGRAM_SMART_FORMAT: "true"

---
# k8s/overlays/development/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
  - ../../base
patchesStrategicMerge:
  - configmap-patch.yaml
secretGenerator:
  - name: deepgram-secrets
    literals:
      - api-key=dev-key-here

---
# k8s/overlays/development/configmap-patch.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: deepgram-config
data:
  DEEPGRAM_MODEL: "base"
  DEEPGRAM_MAX_CONCURRENCY: "5"

Step 6: Environment Validation

async function validateEnvironments() {
  const envs = ['development', 'staging', 'production'];
  const results: Record<string, { valid: boolean; error?: string }> = {};

  for (const env of envs) {
    try {
      const config = loadConfig(env);
      const client = createClient(config.apiKey);

      // Test 1: Key validity
      const { error: authError } = await client.manage.getProjects();
      if (authError) throw new Error(`Auth failed: ${authError.message}`);

      // Test 2: Project access
      const { error: projError } = await client.manage.getProject(config.projectId);
      if (projError) throw new Error(`Project access failed: ${projError.message}`);

      // Test 3: Transcription works
      const { error: sttError } = await client.listen.prerecorded.transcribeUrl(
        { url: 'https://static.deepgram.com/examples/Bueller-Life-moves-702702706.wav' },
        { model: config.model, smart_format: true }
      );
      if (sttError) throw new Error(`STT failed: ${sttError.message}`);

      results[env] = { valid: true };
      console.log(`[PASS] ${env}`);
    } catch (err: any) {
      results[env] = { valid: false, error: err.message };
      console.log(`[FAIL] ${env}: ${err.message}`);
    }
  }

  const allValid = Object.values(results).every(r => r.valid);
  console.log(`\nValidation: ${allValid ? 'ALL PASS' : 'FAILURES DETECTED'}`);
  return results;
}

Output

  • Typed environment configuration (dev/staging/prod)
  • Singleton client factory per environment
  • Docker Compose multi-profile setup
  • Kubernetes Kustomize overlays
  • Environment validation script

Error Handling

IssueCauseSolution
DEEPGRAM_API_KEY_DEV not setMissing env varSet in .env.development
Wrong model in stagingConfig mismatchCheck loadConfig mapping
Cross-env key usedShared keyCreate separate projects per environment
Validation fails for one envKey expiredRotate key for that environment

Resources

  • Deepgram Projects
  • API Key Management
  • Kustomize

When not to use it

  • When using a single global project for all environments
  • When environment isolation is not a security requirement

Prerequisites

Separate Deepgram projects per environment

Limitations

  • Requires separate projects for full isolation
  • Validation script requires network access to Deepgram API

How it compares

It enforces strict environment separation through code-level validation and factory patterns instead of relying on manual environment variable management.

Compared to similar skills

deepgram-multi-env-setup side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
deepgram-multi-env-setup (this skill)027dCautionIntermediate
azure-devops-rest-api158moReviewIntermediate
upstash-qstash66moNo flagsIntermediate
sns17moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

You might also like

azure-devops-rest-api

Tiberriver256

Guide for working with Azure DevOps REST APIs and OpenAPI specifications. Use this skill when implementing new Azure DevOps API integrations, exploring API capabilities, understanding request/response formats, or referencing the official OpenAPI specifications from the vsts-rest-api-specs repository.

15119

upstash-qstash

davila7

Upstash QStash expert for serverless message queues, scheduled jobs, and reliable HTTP-based task delivery without managing infrastructure. Use when: qstash, upstash queue, serverless cron, scheduled http, message queue serverless.

613

sns

itsmostafa

AWS SNS notification service for pub/sub messaging. Use when creating topics, managing subscriptions, configuring message filtering, sending notifications, or setting up mobile push.

12

nginx-to-higress-migration

alibaba

Migrate from ingress-nginx to Higress in Kubernetes environments. Use when (1) analyzing existing ingress-nginx setup (2) reading nginx Ingress resources and ConfigMaps (3) installing Higress via helm with proper ingressClass (4) identifying unsupported nginx annotations (5) generating WASM plugins for nginx snippets/advanced features (6) building and deploying custom plugins to image registry. Supports full migration workflow with compatibility analysis and plugin generation.

11

posthog-deploy-integration

jeremylongshore

Deploy PostHog integrations to Vercel, Fly.io, and Cloud Run platforms. Use when deploying PostHog-powered applications to production, configuring platform-specific secrets, or setting up deployment pipelines. Trigger with phrases like "deploy posthog", "posthog Vercel", "posthog production deploy", "posthog Cloud Run", "posthog Fly.io".

10

instantly-multi-env-setup

jeremylongshore

Configure Instantly across development, staging, and production environments. Use when setting up multi-environment deployments, configuring per-environment secrets, or implementing environment-specific Instantly configurations. Trigger with phrases like "instantly environments", "instantly staging", "instantly dev prod", "instantly environment setup", "instantly config by env".

00

Search skills

Search the agent skills registry