Environment Config Manager
Expert in 12-factor configuration management, feature flags, and environment-specific config across dev, staging, and production.
Activation Triggers
Activate on: "environment variables", "ConfigMap", "feature flags", "12-factor config", "dotenv setup", "config per environment", "runtime configuration", "config validation", "environment parity"
NOT for: Secret storage → secret-management-expert | IaC provisioning → terraform-module-builder | CI/CD variables → github-actions-pipeline-builder
Quick Start
- Separate config from code — no hardcoded URLs, ports, or feature toggles in source
- Define config schema — typed validation with defaults (zod, envalid, convict)
- Layer environments — base config overridden by environment-specific values
- Implement feature flags — runtime toggleable features without deployment
- Validate on startup — fail fast if required config is missing or invalid
Core Capabilities
| Domain |
Technologies |
| Validation |
zod, envalid, @t3-oss/env-nextjs, convict, joi |
| Feature Flags |
LaunchDarkly, Unleash, Flagsmith, Statsig, simple JSON flags |
| K8s Config |
ConfigMap, ExternalSecret, Kustomize overlays |
| Local Dev |
dotenv, direnv, 1Password CLI (op run), docker-compose env |
| Runtime Config |
etcd, Consul KV, AWS AppConfig, Firebase Remote Config |
Architecture Patterns
Typed Config Validation (TypeScript)
// config/env.ts — fail fast on invalid config
import { z } from 'zod';
const envSchema = z.object({
NODE_ENV: z.enum(['development', 'staging', 'production']),
PORT: z.coerce.number().default(3000),
DATABASE_URL: z.string().url(),
REDIS_URL: z.string().url().optional(),
LOG_LEVEL: z.enum(['debug', 'info', 'warn', 'error']).default('info'),
FEATURE_NEW_CHECKOUT: z.coerce.boolean().default(false),
API_RATE_LIMIT: z.coerce.number().default(100),
});
export type Env = z.infer<typeof envSchema>;
// Parse and validate — throws on startup if invalid
export const env = envSchema.parse(process.env);
Environment Layering
.env # Base defaults (committed, no secrets)
.env.development # Dev overrides (committed)
.env.staging # Staging overrides (committed, no secrets)
.env.production # Production overrides (committed, no secrets)
.env.local # Local overrides (gitignored, may have secrets)
Loading order (later overrides earlier):
.env → .env.{NODE_ENV} → .env.local
Secrets come from secret store, NOT .env files:
DATABASE_URL → AWS Secrets Manager / Vault
API_KEY → External Secrets Operator
Feature Flag Architecture
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Client │ │ Flag Store │ │ Admin UI │
│ SDK/hook │───▶│ (Unleash/ │◀───│ Toggle flags │
│ │ │ LaunchDarkly)│ │ per env │
└──────────────┘ └──────────────┘ └──────────────┘
Evaluation: user context + flag rules → boolean/variant
- Percentage rollout: 10% of users see new feature
- User targeting: beta users see new feature
- Environment: enabled in staging, disabled in production
- Kill switch: instantly disable without deployment
Anti-Patterns
- Config in code — hardcoded
localhost:5432 or if (env === 'production') scattered across files. Centralize all config in one validated module.
- Secrets in .env files committed to Git — even example files leak secret formats. Use
.env.example with placeholder descriptions, not values.
- No config validation — trusting
process.env.PORT is a valid number. Validate and coerce all config at startup with a schema library.
- Feature flags as permanent config — flags accumulate and become tech debt. Set expiration dates and clean up old flags quarterly.
- Environment-specific code paths —
if (process.env.NODE_ENV === 'production') for business logic. Use feature flags instead; environment should only affect infrastructure config.
Quality Checklist
[ ] All config loaded from environment variables (12-factor compliant)
[ ] Config schema validated on application startup (fail fast)
[ ] .env.example documents all required variables with descriptions
[ ] No secrets in committed .env files
[ ] .env.local in .gitignore
[ ] Feature flags have owner, description, and expiration date
[ ] Dev/staging/production parity maintained (same config keys)
[ ] Config changes do not require code deployment
[ ] Default values sensible for development (zero-config local setup)
[ ] ConfigMaps and Secrets separated in Kubernetes
[ ] Feature flag cleanup tracked in backlog
[ ] Runtime config changes logged and auditable
1---
2license: Apache-2.0
3name: environment-config-manager
4description: "Environment configuration manager for 12-factor config, feature flags, and multi-environment management. Activate on: environment variables, ConfigMap, feature flags, 12-factor config, dotenv management, config per environment, runtime config. NOT for: secret storage (use secret-management-expert), IaC provisioning (use terraform-module-builder), CI/CD variables (use github-actions-pipeline-builder)."
5allowed-tools: Read,Write,Edit,Bash(docker:*,kubectl:*,terraform:*,npm:*,npx:*)
6category: DevOps & Infrastructure
7tags:
8 - configuration
9 - twelve-factor
10 - feature-flags
11 - devops
12pairs-with:
13 - skill: devops-automator
14 reason: Config management is a core piece of deployment automation
15 - skill: secret-management-expert
16 reason: Secrets are a special class of configuration requiring separate handling
17metadata:
18 source: https://skillmd.com/skills/curiositech/environment-config-manager
19---
20
21# Environment Config Manager
22
23Expert in 12-factor configuration management, feature flags, and environment-specific config across dev, staging, and production.
24
25## Activation Triggers
26
27**Activate on:** "environment variables", "ConfigMap", "feature flags", "12-factor config", "dotenv setup", "config per environment", "runtime configuration", "config validation", "environment parity"
28
29**NOT for:** Secret storage → `secret-management-expert` | IaC provisioning → `terraform-module-builder` | CI/CD variables → `github-actions-pipeline-builder`
30
31## Quick Start
32
331. **Separate config from code** — no hardcoded URLs, ports, or feature toggles in source
342. **Define config schema** — typed validation with defaults (zod, envalid, convict)
353. **Layer environments** — base config overridden by environment-specific values
364. **Implement feature flags** — runtime toggleable features without deployment
375. **Validate on startup** — fail fast if required config is missing or invalid
38
39## Core Capabilities
40
41| Domain | Technologies |
42|--------|-------------|
43| **Validation** | zod, envalid, @t3-oss/env-nextjs, convict, joi |
44| **Feature Flags** | LaunchDarkly, Unleash, Flagsmith, Statsig, simple JSON flags |
45| **K8s Config** | ConfigMap, ExternalSecret, Kustomize overlays |
46| **Local Dev** | dotenv, direnv, 1Password CLI (`op run`), docker-compose env |
47| **Runtime Config** | etcd, Consul KV, AWS AppConfig, Firebase Remote Config |
48
49## Architecture Patterns
50
51### Typed Config Validation (TypeScript)
52
53```typescript
54// config/env.ts — fail fast on invalid config
55import { z } from 'zod';
56
57const envSchema = z.object({
58 NODE_ENV: z.enum(['development', 'staging', 'production']),
59 PORT: z.coerce.number().default(3000),
60 DATABASE_URL: z.string().url(),
61 REDIS_URL: z.string().url().optional(),
62 LOG_LEVEL: z.enum(['debug', 'info', 'warn', 'error']).default('info'),
63 FEATURE_NEW_CHECKOUT: z.coerce.boolean().default(false),
64 API_RATE_LIMIT: z.coerce.number().default(100),
65});
66
67export type Env = z.infer<typeof envSchema>;
68
69// Parse and validate — throws on startup if invalid
70export const env = envSchema.parse(process.env);
71```
72
73### Environment Layering
74
75```
76.env # Base defaults (committed, no secrets)
77.env.development # Dev overrides (committed)
78.env.staging # Staging overrides (committed, no secrets)
79.env.production # Production overrides (committed, no secrets)
80.env.local # Local overrides (gitignored, may have secrets)
81
82Loading order (later overrides earlier):
83 .env → .env.{NODE_ENV} → .env.local
84
85Secrets come from secret store, NOT .env files:
86 DATABASE_URL → AWS Secrets Manager / Vault
87 API_KEY → External Secrets Operator
88```
89
90### Feature Flag Architecture
91
92```
93┌──────────────┐ ┌──────────────┐ ┌──────────────┐
94│ Client │ │ Flag Store │ │ Admin UI │
95│ SDK/hook │───▶│ (Unleash/ │◀───│ Toggle flags │
96│ │ │ LaunchDarkly)│ │ per env │
97└──────────────┘ └──────────────┘ └──────────────┘
98
99Evaluation: user context + flag rules → boolean/variant
100 - Percentage rollout: 10% of users see new feature
101 - User targeting: beta users see new feature
102 - Environment: enabled in staging, disabled in production
103 - Kill switch: instantly disable without deployment
104```
105
106## Anti-Patterns
107
1081. **Config in code** — hardcoded `localhost:5432` or `if (env === 'production')` scattered across files. Centralize all config in one validated module.
1092. **Secrets in .env files committed to Git** — even example files leak secret formats. Use `.env.example` with placeholder descriptions, not values.
1103. **No config validation** — trusting `process.env.PORT` is a valid number. Validate and coerce all config at startup with a schema library.
1114. **Feature flags as permanent config** — flags accumulate and become tech debt. Set expiration dates and clean up old flags quarterly.
1125. **Environment-specific code paths** — `if (process.env.NODE_ENV === 'production')` for business logic. Use feature flags instead; environment should only affect infrastructure config.
113
114## Quality Checklist
115
116```
117[ ] All config loaded from environment variables (12-factor compliant)
118[ ] Config schema validated on application startup (fail fast)
119[ ] .env.example documents all required variables with descriptions
120[ ] No secrets in committed .env files
121[ ] .env.local in .gitignore
122[ ] Feature flags have owner, description, and expiration date
123[ ] Dev/staging/production parity maintained (same config keys)
124[ ] Config changes do not require code deployment
125[ ] Default values sensible for development (zero-config local setup)
126[ ] ConfigMaps and Secrets separated in Kubernetes
127[ ] Feature flag cleanup tracked in backlog
128[ ] Runtime config changes logged and auditable
129```