Back to list
jeremylongshore

windsurf-multi-env-setup

by jeremylongshore

Hundreds of Claude Code plugins with embedded AI skills. Learn via interactive Jupyter tutorials.

1,042🍴 135📅 Jan 23, 2026

SKILL.md


name: windsurf-multi-env-setup description: | Configure Windsurf across development, staging, and production environments. Use when setting up multi-environment deployments, configuring per-environment secrets, or implementing environment-specific Windsurf configurations. Trigger with phrases like "windsurf environments", "windsurf staging", "windsurf dev prod", "windsurf environment setup", "windsurf config by env". allowed-tools: Read, Write, Edit, Bash(aws:), Bash(gcloud:), Bash(vault:*) version: 1.0.0 license: MIT author: Jeremy Longshore jeremy@intentsolutions.io

Windsurf Multi-Environment Setup

Overview

Configure Windsurf across development, staging, and production environments.

Prerequisites

  • Separate Windsurf 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

EnvironmentPurposeAPI KeysData
DevelopmentLocal devTest keysSandbox
StagingPre-prod validationStaging keysTest data
ProductionLive trafficProduction keysReal data

Configuration Structure

config/
├── windsurf/
│   ├── 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": 60
  }
}

development.json

{
  "apiKey": "${WINDSURF_API_KEY}",
  "baseUrl": "https://api-sandbox.windsurf.com",
  "debug": true,
  "cache": {
    "enabled": false
  }
}

staging.json

{
  "apiKey": "${WINDSURF_API_KEY_STAGING}",
  "baseUrl": "https://api-staging.windsurf.com",
  "debug": false
}

production.json

{
  "apiKey": "${WINDSURF_API_KEY_PROD}",
  "baseUrl": "https://api.windsurf.com",
  "debug": false,
  "retries": 5
}

Environment Detection

// src/windsurf/config.ts
import baseConfig from '../../config/windsurf/base.json';

type Environment = 'development' | 'staging' | 'production';

function detectEnvironment(): Environment {
  const env = process.env.NODE_ENV || 'development';
  const validEnvs: Environment[] = ['development', 'staging', 'production'];
  return validEnvs.includes(env as Environment)
    ? (env as Environment)
    : 'development';
}

export function getWindsurfConfig() {
  const env = detectEnvironment();
  const envConfig = require(`../../config/windsurf/${env}.json`);

  return {
    ...baseConfig,
    ...envConfig,
    environment: env,
  };
}

Secret Management by Environment

Local Development

# .env.local (git-ignored)
WINDSURF_API_KEY=sk_test_dev_***

CI/CD (GitHub Actions)

env:
  WINDSURF_API_KEY: ${{ secrets.WINDSURF_API_KEY_${{ matrix.environment }} }}

Production (Vault/Secrets Manager)

# AWS Secrets Manager
aws secretsmanager get-secret-value --secret-id windsurf/production/api-key

# GCP Secret Manager
gcloud secrets versions access latest --secret=windsurf-api-key

# HashiCorp Vault
vault kv get -field=api_key secret/windsurf/production

Environment Isolation

// Prevent production operations in non-prod
function guardProductionOperation(operation: string): void {
  const config = getWindsurfConfig();

  if (config.environment !== 'production') {
    console.warn(`[windsurf] ${operation} blocked in ${config.environment}`);
    throw new Error(`${operation} only allowed in production`);
  }
}

// Usage
async function deleteAllData() {
  guardProductionOperation('deleteAllData');
  // Dangerous operation here
}

Feature Flags by Environment

const featureFlags: Record<Environment, Record<string, boolean>> = {
  development: {
    newFeature: true,
    betaApi: true,
  },
  staging: {
    newFeature: true,
    betaApi: false,
  },
  production: {
    newFeature: false,
    betaApi: false,
  },
};

Instructions

Step 1: Create Config Structure

Set up the base and per-environment configuration files.

Step 2: Implement Environment Detection

Add logic to detect and load environment-specific config.

Step 3: Configure Secrets

Store API keys securely using your secret management solution.

Step 4: Add Environment Guards

Implement safeguards for production-only operations.

Output

  • Multi-environment config structure
  • Environment detection logic
  • Secure secret management
  • Production safeguards enabled

Error Handling

IssueCauseSolution
Wrong environmentMissing NODE_ENVSet environment variable
Secret not foundWrong secret pathVerify secret manager config
Config merge failsInvalid JSONValidate config files
Production guard triggeredWrong environmentCheck NODE_ENV value

Examples

Quick Environment Check

const env = getWindsurfConfig();
console.log(`Running in ${env.environment} with ${env.baseUrl}`);

Resources

Next Steps

For observability setup, see windsurf-observability.

Score

Total Score

85/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 1000以上

+15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

+5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon