Skip to content
Back to skills

Coderabbit Multi Env Setup

ASecurity

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

  • 1,689 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 1, 2026
developmenttypescriptbashnodeawsgcpgitapici/cd

Works with

  • api

Security analysis

A100/100

Scanned September 1, 2026

npx -y skills add Dicklesworthstone/pi_agent_rust --skill coderabbit-multi-env-setup --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Coderabbit Multi Env Setup?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Coderabbit Multi Env Setup
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dicklesworthstone-coderabbit-multi-env-setup/badge)](https://www.skillsdirectory.com/skills/dicklesworthstone-coderabbit-multi-env-setup)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: coderabbit-multi-env-setup
description: |
  Configure CodeRabbit across development, staging, and production environments.
  Use when setting up multi-environment deployments, configuring per-environment secrets,
  or implementing environment-specific CodeRabbit configurations.
  Trigger with phrases like "coderabbit environments", "coderabbit staging",
  "coderabbit dev prod", "coderabbit environment setup", "coderabbit 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>
---

# CodeRabbit Multi-Environment Setup

## Overview
Configure CodeRabbit across development, staging, and production environments.

## Prerequisites
- Separate CodeRabbit 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 |
|-------------|---------|----------|------|
| Development | Local dev | Test keys | Sandbox |
| Staging | Pre-prod validation | Staging keys | Test data |
| Production | Live traffic | Production keys | Real data |

## Configuration Structure

```
config/
├── coderabbit/
│   ├── base.json           # Shared config
│   ├── development.json    # Dev overrides
│   ├── staging.json        # Staging overrides
│   └── production.json     # Prod overrides
```

### base.json
```json
{
  "timeout": 30000,
  "retries": 3,
  "cache": {
    "enabled": true,
    "ttlSeconds": 60
  }
}
```

### development.json
```json
{
  "apiKey": "${CODERABBIT_API_KEY}",
  "baseUrl": "https://api-sandbox.coderabbit.com",
  "debug": true,
  "cache": {
    "enabled": false
  }
}
```

### staging.json
```json
{
  "apiKey": "${CODERABBIT_API_KEY_STAGING}",
  "baseUrl": "https://api-staging.coderabbit.com",
  "debug": false
}
```

### production.json
```json
{
  "apiKey": "${CODERABBIT_API_KEY_PROD}",
  "baseUrl": "https://api.coderabbit.com",
  "debug": false,
  "retries": 5
}
```

## Environment Detection

```typescript
// src/coderabbit/config.ts
import baseConfig from '../../config/coderabbit/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 getCodeRabbitConfig() {
  const env = detectEnvironment();
  const envConfig = require(`../../config/coderabbit/${env}.json`);

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

## Secret Management by Environment

### Local Development
```bash
# .env.local (git-ignored)
CODERABBIT_API_KEY=sk_test_dev_***
```

### CI/CD (GitHub Actions)
```yaml
env:
  CODERABBIT_API_KEY: ${{ secrets.CODERABBIT_API_KEY_${{ matrix.environment }} }}
```

### Production (Vault/Secrets Manager)
```bash
# AWS Secrets Manager
aws secretsmanager get-secret-value --secret-id coderabbit/production/api-key

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

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

## Environment Isolation

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

  if (config.environment !== 'production') {
    console.warn(`[coderabbit] ${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

```typescript
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
| Issue | Cause | Solution |
|-------|-------|----------|
| Wrong environment | Missing NODE_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 NODE_ENV value |

## Examples

### Quick Environment Check
```typescript
const env = getCodeRabbitConfig();
console.log(`Running in ${env.environment} with ${env.baseUrl}`);
```

## Resources
- [CodeRabbit Environments Guide](https://docs.coderabbit.com/environments)
- [12-Factor App Config](https://12factor.net/config)

## Next Steps
For observability setup, see `coderabbit-observability`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.