speak-multi-env-setup
Configure Speak across development, staging, and production environments. Use when setting up multi-environment deployments, configuring per-environment secrets, or implementing environment-specific Speak configurations. Trigger with phrases like "speak environments", "speak staging", "speak dev prod", "speak environment setup", "speak config by env".
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 2.0k
- Forks
- 231
01 前言 Front Matter
- name
- speak-multi-env-setup
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Configure Speak across development, staging, and production environments. Use when setting up multi-environment deployments, configuring per-environment secrets, or implementing environment-specific Speak configurations. Trigger with phrases like "speak environments", "speak staging", "speak dev prod", "speak environment setup", "speak config by env".
- allowed-tools
- Read, Write, Edit, Bash(aws:*), Bash(gcloud:*), Bash(vault:*)
03 SKILL.md 正文
Speak Multi-Environment Setup
Overview
Configure Speak across development, staging, and production environments for language learning applications.
Prerequisites
- Separate Speak accounts or API keys per environment
- Secret management solution (Vault, AWS Secrets Manager, etc.)
- CI/CD pipeline with environment variables
- Environment detection in application
Environment Strategy
| Environment | Purpose | API Keys | Data | Languages |
|---|---|---|---|---|
| Development | Local dev | Sandbox keys | Mock/test | All enabled |
| Staging | Pre-prod validation | Staging keys | Test data | All enabled |
| Production | Live users | Production keys | Real data | Enabled per plan |
Configuration Structure
config/
├── speak/
│ ├── base.json # Shared config
│ ├── development.json # Dev overrides
│ ├── staging.json # Staging overrides
│ └── production.json # Prod overrides
base.json
{
"timeout": 30000,
"retries": 3,
"cache": {
"enabled": true,
"ttlSeconds": 300
},
"audio": {
"maxDuration": 60,
"format": "wav",
"sampleRate": 16000
},
"supportedLanguages": ["en", "es", "fr", "de", "ko", "ja", "zh-CN", "pt-BR"]
}
development.json
{
"baseUrl": "https://api-sandbox.speak.com",
"debug": true,
"cache": {
"enabled": false
},
"mockMode": true,
"features": {
"experimentalTutor": true,
"betaSpeechEngine": true,
"allLanguages": true
}
}
staging.json
{
"baseUrl": "https://api-staging.speak.com",
"debug": false,
"features": {
"experimentalTutor": true,
"betaSpeechEngine": false,
"allLanguages": true
},
"rateLimits": {
"lessonsPerHour": 100,
"audioMinutesPerHour": 60
}
}
production.json
{
"baseUrl": "https://api.speak.com",
"debug": false,
"retries": 5,
"features": {
"experimentalTutor": false,
"betaSpeechEngine": false,
"allLanguages": false
},
"rateLimits": {
"lessonsPerHour": 1000,
"audioMinutesPerHour": 500
}
}
Environment Detection
// src/speak/config.ts
import baseConfig from '../../config/speak/base.json';
type Environment = 'development' | 'staging' | 'production';
function detectEnvironment(): Environment {
// Check multiple sources for environment
const env = process.env.SPEAK_ENV ||
process.env.NODE_ENV ||
'development';
const validEnvs: Environment[] = ['development', 'staging', 'production'];
return validEnvs.includes(env as Environment)
? (env as Environment)
: 'development';
}
export function getSpeakConfig(): SpeakConfig {
const env = detectEnvironment();
const envConfig = require(`../../config/speak/${env}.json`);
return {
...baseConfig,
...envConfig,
apiKey: process.env.SPEAK_API_KEY!,
appId: process.env.SPEAK_APP_ID!,
webhookSecret: process.env.SPEAK_WEBHOOK_SECRET,
environment: env,
};
}
Secret Management by Environment
Local Development
# .env.local (git-ignored)
SPEAK_ENV=development
SPEAK_API_KEY=sk_sandbox_***
SPEAK_APP_ID=app_dev_***
SPEAK_MOCK_MODE=true
CI/CD (GitHub Actions)
jobs:
deploy:
environment: ${{ matrix.environment }}
env:
SPEAK_ENV: ${{ matrix.environment }}
SPEAK_API_KEY: ${{ secrets[format('SPEAK_API_KEY_{0}', matrix.environment)] }}
SPEAK_APP_ID: ${{ secrets[format('SPEAK_APP_ID_{0}', matrix.environment)] }}
strategy:
matrix:
environment: [staging, production]
Production (Vault/Secrets Manager)
# AWS Secrets Manager
aws secretsmanager get-secret-value \
--secret-id speak/production/credentials
# GCP Secret Manager
gcloud secrets versions access latest \
--secret=speak-production-api-key
# HashiCorp Vault
vault kv get -field=api_key secret/speak/production
Environment Isolation
Prevent Production Operations in Non-Prod
function guardProductionOperation(operation: string): void {
const config = getSpeakConfig();
if (config.environment !== 'production') {
console.warn(`[speak] ${operation} blocked in ${config.environment}`);
throw new Error(`${operation} only allowed in production`);
}
}
// Usage
async function deleteUserData(userId: string): Promise<void> {
guardProductionOperation('deleteUserData');
await speakClient.users.delete(userId);
}
Environment-Specific Lesson Restrictions
function getAvailableLanguages(): string[] {
const config = getSpeakConfig();
if (config.features?.allLanguages) {
return config.supportedLanguages;
}
// Production: Only enabled languages for user's plan
return getUserPlanLanguages();
}
function canAccessFeature(feature: string): boolean {
const config = getSpeakConfig();
return config.features?.[feature] ?? false;
}
Feature Flags by Environment
interface FeatureFlags {
experimentalTutor: boolean;
betaSpeechEngine: boolean;
newPronunciationModel: boolean;
gamificationV2: boolean;
offlineMode: boolean;
}
const featureFlags: Record<Environment, FeatureFlags> = {
development: {
experimentalTutor: true,
betaSpeechEngine: true,
newPronunciationModel: true,
gamificationV2: true,
offlineMode: true,
},
staging: {
experimentalTutor: true,
betaSpeechEngine: true,
newPronunciationModel: true,
gamificationV2: false,
offlineMode: false,
},
production: {
experimentalTutor: false,
betaSpeechEngine: false,
newPronunciationModel: false,
gamificationV2: false,
offlineMode: false,
},
};
export function isFeatureEnabled(feature: keyof FeatureFlags): boolean {
const env = detectEnvironment();
return featureFlags[env][feature];
}
Environment-Specific Audio Storage
interface AudioStorageConfig {
type: 'local' | 's3' | 'gcs';
bucket?: string;
encryption: boolean;
retention: number; // days
}
const audioStorage: Record<Environment, AudioStorageConfig> = {
development: {
type: 'local',
encryption: false,
retention: 1,
},
staging: {
type: 's3',
bucket: 'speak-staging-audio',
encryption: true,
retention: 7,
},
production: {
type: 's3',
bucket: 'speak-production-audio',
encryption: true,
retention: 30,
},
};
Environment Health Checks
async function verifyEnvironmentConfig(): Promise<EnvironmentCheck> {
const config = getSpeakConfig();
const checks = {
apiKeyValid: false,
canConnect: false,
correctEnvironment: false,
featuresAccessible: false,
};
try {
// Verify API key
const health = await speakClient.health.check();
checks.apiKeyValid = true;
checks.canConnect = health.healthy;
// Verify we're hitting the right environment
const expectedBase = config.baseUrl;
checks.correctEnvironment = health.endpoint.includes(
config.environment === 'production' ? 'api.speak.com' : `api-${config.environment}`
);
// Verify feature access
if (config.features?.experimentalTutor) {
checks.featuresAccessible = await canAccessExperimentalTutor();
} else {
checks.featuresAccessible = true;
}
} catch (error) {
console.error('Environment verification failed:', error);
}
return {
environment: config.environment,
checks,
allPassed: Object.values(checks).every(Boolean),
};
}
Output
- Multi-environment config structure
- Environment detection logic
- Secure secret management
- Production safeguards enabled
- Feature flags by environment
Error Handling
| Issue | Cause | Solution |
|---|---|---|
| Wrong environment | Missing SPEAK_ENV | Set environment variable |
| Secret not found | Wrong secret path | Verify secret manager config |
| Config merge fails | Invalid JSON | Validate config files |
| Production guard triggered | Wrong environment | Check SPEAK_ENV value |
| Feature unavailable | Wrong environment | Verify feature flags |
Examples
Quick Environment Check
const config = getSpeakConfig();
console.log(`Environment: ${config.environment}`);
console.log(`API Base: ${config.baseUrl}`);
console.log(`Mock Mode: ${config.mockMode ? 'ON' : 'OFF'}`);
console.log(`Features:`, config.features);
Environment Switching Script
#!/bin/bash
# switch-speak-env.sh
case "$1" in
dev)
export SPEAK_ENV=development
export SPEAK_API_KEY=$(vault kv get -field=api_key secret/speak/development)
;;
staging)
export SPEAK_ENV=staging
export SPEAK_API_KEY=$(vault kv get -field=api_key secret/speak/staging)
;;
prod)
export SPEAK_ENV=production
export SPEAK_API_KEY=$(vault kv get -field=api_key secret/speak/production)
;;
esac
echo "Switched to $SPEAK_ENV environment"
Resources
Next Steps
For observability setup, see speak-observability.
04 同仓库更多 Skills
web-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
neuropixels-analysis
Neuropixels neural recording analysis. Load SpikeGLX/OpenEphys data, preprocess, motion correction, Kilosort4 spike sorting, quality metrics, Allen/IBL curation, AI-assisted visual analysis, for Neuropixels 1.0/2.0 extracellular electrophysiology. Use when working with neural recordings, spike sorting, extracellular electrophysiology, or when the user mentions Neuropixels, SpikeGLX, Open Ephys, Kilosort, quality metrics, or unit curation.
skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
notebooklm
Use this skill to query your Google NotebookLM notebooks directly from Claude Code for source-grounded, citation-backed answers from Gemini. Browser automation, library management, persistent auth. Drastically reduced hallucinations through document-only responses.
slack-gif-creator
Knowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."