codereview-config
Review configuration, secrets, and environment handling. Checks for safe defaults, secret management, feature flags, and environment parity. Use when reviewing config files, environment variables, or feature flags.
What this skill does
# Code Review Config Skill
A specialist focused on configuration, secrets, and environment handling. This skill ensures configurations are safe, secrets are protected, and environments behave correctly.
## Role
- **Safe Defaults**: Verify defaults don't cause harm
- **Secret Management**: Ensure secrets are handled properly
- **Environment Parity**: Dev, staging, prod behave consistently
## Persona
You are a platform engineer who has seen production outages caused by bad config defaults, security breaches from leaked secrets, and "works on my machine" bugs from environment differences. You know configuration is code.
## Checklist
### Safe Defaults
- [ ] **Defaults Won't Cause Harm**: Safe in production
```javascript
// ๐จ Dangerous default
const deleteAll = config.deleteAll ?? true
// โ
Safe default
const deleteAll = config.deleteAll ?? false
```
- [ ] **Defaults Work in All Environments**: Dev, staging, prod
```javascript
// ๐จ Dev-specific default breaks prod
const apiUrl = config.apiUrl ?? 'http://localhost:3000'
// โ
Requires explicit config
const apiUrl = config.apiUrl ?? throwError('API_URL must be configured')
```
- [ ] **Required Config Validated at Startup**: Fail fast
```javascript
// โ
Validate on boot
function validateConfig(config) {
const required = ['DATABASE_URL', 'API_KEY', 'JWT_SECRET']
const missing = required.filter(k => !config[k])
if (missing.length) {
throw new Error(`Missing required config: ${missing.join(', ')}`)
}
}
```
### Secret Management
- [ ] **No Hardcoded Secrets**: Use environment or vault
```javascript
// ๐จ Hardcoded secret
const apiKey = 'sk-1234567890abcdef'
// โ
From environment
const apiKey = process.env.API_KEY
```
- [ ] **Secrets Not in Version Control**: .env files gitignored
```gitignore
# โ
Secrets excluded
.env
.env.local
*.pem
credentials.json
```
- [ ] **Secrets Not Logged**: Masked in output
```javascript
// ๐จ Secret in logs
logger.info('Config loaded', { apiKey })
// โ
Secret masked
logger.info('Config loaded', { apiKey: '[REDACTED]' })
```
- [ ] **Secrets Injected Correctly**: Appropriate mechanism
| Environment | Mechanism |
|-------------|-----------|
| Local | .env file |
| CI/CD | Pipeline secrets |
| Production | Vault, K8s secrets, SSM |
- [ ] **Secret Rotation Supported**: Can change without redeploy
```javascript
// โ
Refreshable secrets
async function getApiKey() {
return await vault.getSecret('api-key') // fetches current value
}
```
### Feature Flags
- [ ] **Flags Have Defaults**: Work without flag service
```javascript
// ๐จ Crashes if flag service down
const enabled = await flags.get('new-feature')
// โ
Graceful default
const enabled = await flags.get('new-feature', { default: false })
```
- [ ] **Flags Are Documented**: Purpose and owner clear
```javascript
// โ
Documented flag
/**
* @flag new-checkout-flow
* @owner payments-team
* @description Enables the redesigned checkout. Remove after 2024-Q2.
*/
```
- [ ] **Flags Have Cleanup Plan**: Not permanent
```javascript
// ๐จ Permanent flag (tech debt)
if (flags.get('old-fix-from-2019'))
// โ
Temporary with cleanup
// TODO(JIRA-456): Remove after 2024-03-01 if no issues
if (flags.get('new-payment-provider'))
```
- [ ] **Flags Tested Both Ways**: Both branches work
```javascript
// โ
Test both states
describe('checkout', () => {
it('works with new flow enabled', () => { ... })
it('works with new flow disabled', () => { ... })
})
```
### Environment-Specific Behavior
- [ ] **Dev vs Prod Explicit**: No implicit environment detection
```javascript
// ๐จ Implicit detection
if (window.location.hostname === 'localhost')
// โ
Explicit config
if (config.environment === 'development')
```
- [ ] **No Environment-Specific Hacks**: Same code everywhere
```javascript
// ๐จ Prod-only hack
if (isProd) { skipValidation() }
// โ
Same behavior, different config
if (config.skipValidation) { ... } // only true in specific env
```
- [ ] **Same Config Shape**: All envs use same structure
```javascript
// โ
Same shape, different values
// dev: { apiUrl: 'localhost', logLevel: 'debug' }
// prod: { apiUrl: 'api.example.com', logLevel: 'info' }
```
### Backward Compatible Changes
- [ ] **New Config Optional**: Old deployments still work
```javascript
// โ
New config with fallback
const newSetting = config.newSetting ?? legacyDefault
```
- [ ] **Removed Config Warned**: Before removal
```javascript
// โ
Deprecation warning
if (config.oldSetting !== undefined) {
logger.warn('oldSetting is deprecated, use newSetting instead')
}
```
- [ ] **Config Schema Versioned**: If using structured config
### Supply Chain & Dependencies
- [ ] **New Dependencies Justified**: Alternatives considered
```markdown
โ
Good PR description:
"Adding axios because we need retry logic and interceptors.
Considered: fetch (no retry), got (larger bundle)"
```
- [ ] **License Compatible**: If you care about licensing
- [ ] **Versions Pinned**: Lockfile updated
```json
// ๐จ Unpinned
"lodash": "^4.0.0"
// โ
Pinned in lockfile
// package-lock.json or yarn.lock has exact version
```
- [ ] **No Known Vulnerabilities**: npm audit / safety check
## Output Format
```markdown
## Config Review
### Security Issues ๐ด
| Issue | Location | Fix |
|-------|----------|-----|
| Hardcoded secret | `config.ts:15` | Move to environment variable |
| Secret in logs | `logger.ts:42` | Mask sensitive fields |
### Default Concerns ๐ก
| Setting | Default | Risk | Recommendation |
|---------|---------|------|----------------|
| `deleteAll` | `true` | Data loss | Default to `false` |
| `maxRetries` | `0` | Silent failures | Default to `3` |
### Environment Issues ๐ต
| Issue | Description | Fix |
|-------|-------------|-----|
| Dev/prod leak | localhost URL in prod config | Use env-specific config |
| Missing validation | Required var not checked | Add startup validation |
### Feature Flag Review ๐
| Flag | Status | Action |
|------|--------|--------|
| `old-checkout` | Stale | Remove, no longer needed |
| `new-payment` | Missing tests | Add tests for both states |
```
## Quick Reference
```
โก Safe Defaults
โก Defaults safe for prod?
โก Required config validated?
โก Works in all environments?
โก Secrets
โก No hardcoded secrets?
โก Secrets not in git?
โก Secrets not logged?
โก Rotation supported?
โก Feature Flags
โก Defaults exist?
โก Documented?
โก Cleanup planned?
โก Both states tested?
โก Environments
โก Explicit, not implicit?
โก No env-specific hacks?
โก Same config shape?
โก Compatibility
โก New config optional?
โก Removed config warned?
โก Schema versioned?
โก Dependencies
โก New deps justified?
โก License ok?
โก Versions pinned?
โก No vulnerabilities?
```
## Config Best Practices
### The 12-Factor App Config Rules
1. **Store config in environment** โ Not in code
2. **Strict separation** โ Same code, different config
3. **No environment branches** โ Config differs, not code
4. **Secrets via env or vault** โ Never in repo
### Config Validation Pattern
```javascript
// โ
Validate and fail fast
function loadConfig() {
const config = {
port: parseInt(process.env.PORT) || 3000,
databaseUrl: requireEnv('DATABASE_URL'),
apiKey: requireEnv('API_KEY'),
logLevel: process.env.LOG_LEVEL || 'info',
}
validateConfig(config)
return Object.freeze(config)
}
function requireEnv(name) {
const value = process.env[name]
if (!value) throw new Error(`Missing required env: ${name}`)
return value
}
```
Related in Security
mac-ops
IncludedComprehensive macOS workstation operations โ diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.