env-config
Skill1 starsChanged 9 months agoApache-2.0View on GitHub
Environment and configuration management covering .env patterns, runtime validation with zod and envalid, secret handling, 12-factor config principles, and Docker env injection.
- Reads credentials
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- AutumnsGrove/ClaudeSkillstheir own version, first seen Oct 26, 2025
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- AutumnsGrove/ClaudeSkills★ 34same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository73 other files it gives its agents.
- accessibility-wcagSkill
- api-designSkill
- api-testingSkill
- asset-optimizationSkill
- audio-systemsSkill
- aws-essentialsSkill
- ci-cd-pipelinesSkill
- codebase-analysisSkill
- code-reviewerSkill
- container-securitySkill
- cost-optimizationSkill
- database-designSkill
- data-visualizationSkill
- doc-generationSkill
- docker-kubernetesSkill
- docxSkill
- email-notificationsSkill
- flutter-mobileSkill
- framer-motionSkill
- frontend-code-reviewSkill
- frontend-designSkill
- fullstack-developerSkill
- game-enginesSkill
- gameplay-designSkill
- game-programming-languagesSkill
- game-serversSkill
- git-workflowSkill
- godot-4Skill
- golang-proSkill
- go-linter-configurationSkill
- graphics-renderingSkill
- i18n-localizationSkill
- incident-responseSkill
- level-designSkill
- llm-integrationSkill
- local-securitySkill
- memory-managementSkill
- monetization-systemsSkill
- monitoring-observabilitySkill
- multiplayer-netcodeSkill
- nextjs-16Skill
- notebooklm-researchSkill
- npm-packageSkill
- oauth-authSkill
- particle-systemsSkill
- performance-optimizationSkill
- playwright-testingSkill
- postgres-advancedSkill
- programming-architectureSkill
- project-migrationSkill
- publishing-platformsSkill
- python-best-practicesSkill
- react-nativeSkill
- redis-patternsSkill
- refactoring-patternsSkill
- remotion-best-practicesSkill
- rust-best-practicesSkill
- scraping-automationSkill
- security-reviewSkill
- seo-metaSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. About 0 are common, 14 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 22
Use SCREAMING_SNAKE_CASE. No dots, no dashes.
- Very specific: line 29
Use placeholder values that make the expected format obvious: MYAPP_API_KEY=sk_test_xxxxxxxxxxxx.
- Distinctive: line 48
Call this at application startup, before any other initialization.
- Very specific: line 51
Use z.coerce for numbers and booleans since env vars are always strings.
- Distinctive: line 75
Never commit secrets to version control.
- Distinctive: line 77
Use short-lived tokens over long-lived API keys.
- Very specific: line 82
Local dev: Use .env.local (gitignored) or a secrets manager CLI.
- Distinctive: line 83
CI/CD: Use the platform's built-in secrets (GitHub Actions secrets, GitLab CI variables).
- Distinctive: line 84
Production: Use a dedicated secrets manager: HashiCorp Vault, AWS Secrets Manager, GCP Secret Manager, or Doppler.
- Distinctive: line 85
Encryption at rest: Use SOPS or age to encrypt secrets files that must live in the repo.
- Distinctive: line 89
Add a pre-commit hook with gitleaks or trufflehog to scan for secrets.
- Distinctive: line 91
If a secret is committed accidentally, rotate it immediately.
- Distinctive: line 99
Never group config into named environments inside the app ("the staging config object").
- Distinctive: line 104
Default values should be safe for local development, never for production.
- Very specific: line 128
Use env_file for bulk variables.
- Very specific: line 129
Never put secrets in docker-compose.yml.
- Very specific: line 133
Do not copy .env files into Docker images.
- Distinctive: line 188
Use different values per environment (Production, Preview, Development).
- Distinctive: line 195
Use environment-level secrets for deploy targets that need different credentials.
- Distinctive: line 199
Use ConfigMaps for non-sensitive config, Secrets for sensitive data.
- Distinctive: line 201
Use External Secrets Operator to sync from cloud secret managers.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Purpose
Prevent misconfigurations from reaching production. Validate environment variables at startup, manage secrets safely, and keep config portable across local dev, CI, and production.
.env File Patterns
File Hierarchy
.envholds shared defaults. Commit this to the repo with safe placeholder values..env.localholds developer-specific overrides. Add to.gitignore..env.production,.env.staging,.env.testhold environment-specific values.- Load order (most frameworks):
.env<.env.local<.env.[environment]<.env.[environment].local.
Naming Conventions
- Prefix variables with the app or service name:
MYAPP_DATABASE_URL, not justDATABASE_URL. - Use SCREAMING_SNAKE_CASE. No dots, no dashes.
- Boolean values: use
true/false, not1/0oryes/no. - Group related variables with a common prefix:
MYAPP_REDIS_HOST,MYAPP_REDIS_PORT.
Template Files
- Maintain a
.env.examplewith every variable, documented with comments. - Use placeholder values that make the expected format obvious:
MYAPP_API_KEY=sk_test_xxxxxxxxxxxx. - Script a setup step that copies
.env.exampleto.envif.envdoes not exist.
Validation with Zod
import { z } from 'zod';
const envSchema = z.object({
NODE_ENV: z.enum(['development', 'staging', 'production']),
PORT: z.coerce.number().int().min(1).max(65535).default(3000),
DATABASE_URL: z.string().url(),
API_KEY: z.string().min(10),
ENABLE_CACHE: z.coerce.boolean().default(false),
});
export const env = envSchema.parse(process.env);- Call this at application startup, before any other initialization.
- Fail fast with a clear error listing all missing or invalid variables.
- Export the parsed result as a typed object. Never access
process.envdirectly elsewhere. - Use
z.coercefor numbers and booleans since env vars are always strings.
Validation with Envalid
import { cleanEnv, str, port, bool, url } from 'envalid';
export const env = cleanEnv(process.env, {
NODE_ENV: str({ choices: ['development', 'staging', 'production'] }),
PORT: port({ default: 3000 }),
DATABASE_URL: url(),
API_KEY: str(),
ENABLE_CACHE: bool({ default: false }),
});- Envalid strips
NODE_ENVawareness into the validator. Useenv.isDev,env.isProd. - Built-in validators:
str,bool,num,port,url,email,json,host. - Custom validators: pass a function to
makeValidator.
Secret Management
Principles
- Never commit secrets to version control. Not even in private repos.
- Rotate secrets on a schedule. Automate rotation where possible.
- Use short-lived tokens over long-lived API keys.
- Audit secret access. Log who accessed what and when.
Tools
- Local dev: Use
.env.local(gitignored) or a secrets manager CLI. - CI/CD: Use the platform's built-in secrets (GitHub Actions secrets, GitLab CI variables).
- Production: Use a dedicated secrets manager: HashiCorp Vault, AWS Secrets Manager, GCP Secret Manager, or Doppler.
- Encryption at rest: Use SOPS or age to encrypt secrets files that must live in the repo.
Git Protection
- Add a pre-commit hook with gitleaks or trufflehog to scan for secrets.
- Configure
.gitignoreto exclude all.env*files except.env.example. - If a secret is committed accidentally, rotate it immediately. Removing it from history is not enough.
12-Factor Config
Core Principles
- Store config in environment variables, not in code or config files baked into the image.
- Config varies between deploys (staging, production). Code does not.
- Never group config into named environments inside the app ("the staging config object"). Use individual env vars.
Implementation
- One env var per config value. Compose connection strings from parts if needed.
- Default values should be safe for local development, never for production.
- Validate all config at startup. Log which config source was used (env var, default, file).
Docker Environment Injection
Build-time vs Runtime
ARGin Dockerfile: available only during build. Use for build tools, versions.ENVin Dockerfile: baked into the image. Use for static defaults.- Runtime env vars (
docker run -e): overrideENVvalues. Use for secrets and deploy-specific config.
Compose
services:
app:
environment:
- NODE_ENV=production
- PORT=3000
env_file:
- .env.productionenvironmentin compose takes precedence overenv_file.- Use
env_filefor bulk variables. Useenvironmentfor overrides. - Never put secrets in
docker-compose.yml. Use Docker secrets or an external env file.
Multi-stage Builds
- Do not copy
.envfiles into Docker images. - Pass build-time config via
ARGand--build-arg. - Inject runtime config via environment variables at container start.
dotenv-vault
Encrypted .env files for teams. Alternative to secrets managers for small projects.
# Install
npm install dotenv-vault-core
# Setup
npx dotenv-vault new
npx dotenv-vault push production # Upload .env to vault
# In production, use DOTENV_KEY instead of .env file
DOTENV_KEY="dotenv://vault-key-here" node server.js// Load in app
require('dotenv-vault-core').config();
console.log(process.env.DATABASE_URL); // Decrypted from vaultWhen to use: Small teams (< 10 people), need encryption at rest, want git-based workflow without committing secrets.
Cloud Provider Env Patterns
AWS Systems Manager (SSM) Parameter Store
// Fetch secrets at startup
import { SSMClient, GetParametersCommand } from "@aws-sdk/client-ssm";
const client = new SSMClient({ region: "us-east-1" });
const response = await client.send(new GetParametersCommand({
Names: ["/myapp/database-url", "/myapp/api-key"],
WithDecryption: true,
}));
const env = {};
for (const param of response.Parameters) {
const key = param.Name.split('/').pop().toUpperCase().replace('-', '_');
env[key] = param.Value;
}
// Now use env.DATABASE_URL, env.API_KEYVercel Environment Variables
- Set env vars in the Vercel dashboard or via
vercel env add. - Prefix client-exposed vars with
NEXT_PUBLIC_in Next.js. - Use different values per environment (Production, Preview, Development).
- Pull env vars to local:
vercel env pull .env.local.
GitHub Actions
- Store secrets in Settings > Secrets and variables > Actions.
- Access via
${{ secrets.MY_SECRET }}in workflow files. - Use environment-level secrets for deploy targets that need different credentials.
Kubernetes
- Use ConfigMaps for non-sensitive config, Secrets for sensitive data.
- Mount as environment variables or files depending on the consumer.
- Use External Secrets Operator to sync from cloud secret managers.
Troubleshooting
- Variable not loading: check file encoding (must be UTF-8, no BOM), line endings (LF not CRLF).
- Variable undefined in browser: ensure the framework prefix is correct (NEXT_PUBLIC_, VITE_, REACT_APP_).
- Docker env not applying: check that env_file path is relative to the compose file, not the build context.
- Validation failing in CI: ensure CI secrets are set for the correct environment (not just production).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

