Environment Variable Planner
Map out the env vars Claude Code and your app actually need.
- $19 Free
- 50 sec
- No signup
List the vars your app + Claude Code use
Mark which are secret
Copy the .env.example and secret checklist
You get: A committable .env.example plus a private .env checklist.
Select the vars you need
Claude Code
App
Ops
Custom vars
.env.example
Safe to commit. Placeholders only - no real secret values.
# .env.example - safe to commit. Real values go in .env (gitignored). # Your Anthropic API key. Used when Claude Code (or your app) calls the API directly. (SECRET - do not commit the real value) ANTHROPIC_API_KEY= # Override the default model Claude Code uses (for example, a Sonnet or Opus model id). ANTHROPIC_MODEL=claude-sonnet-model-id # Connection string for your database. Contains credentials - keep it secret. (SECRET - do not commit the real value) DATABASE_URL= # The runtime environment for a Node app (development, production, test). NODE_ENV=development # The port your app's server listens on. PORT=3000
Shell export block
For a quick manual session. Replace <value> before running.
# Shell export block. Replace <value> before running. export ANTHROPIC_API_KEY=<value> export ANTHROPIC_MODEL =<value> export DATABASE_URL =<value> export NODE_ENV =<value> export PORT =<value>
Secret checklist (keep private)
These belong ONLY in .env (never .env.example, never committed): [ ] ANTHROPIC_API_KEY [ ] DATABASE_URL Also confirm: .env is listed in .gitignore.
Why environment variables are worth planning
Environment variables are how your project reads configuration and secrets from the environment it runs in, instead of hardcoding them into source. That separation is the whole point: the same code runs in development, staging, and production, and only the variables change. The failure mode is not using them - it is using them carelessly, which is how API keys end up committed to git and leaked. The planner above helps you do it cleanly: pick the variables your app and Claude Code actually use, mark which are secret, and get a committable .env.example plus a private checklist of what must never leave your machine.
The two-file pattern is the industry norm. You keep real values in a .env file that is gitignored and never committed, and you commit a .env.example that documents every variable your project needs using placeholders instead of real values. New contributors copy the example to .env and fill in their own values. The planner generates both sides of that so the documentation and reality stay in sync.
The Claude Code variables worth knowing
- ANTHROPIC_API_KEY - your Anthropic API key, used when Claude Code or your own app calls the API directly. This is a secret. It should live only in .env or your machine's environment, never in a committed file.
- ANTHROPIC_MODEL - overrides the default model Claude Code uses. Not secret; it is just a model identifier.
- ANTHROPIC_SMALL_FAST_MODEL - the lightweight model Claude Code reaches for on cheap background work. Not secret.
- ANTHROPIC_BASE_URL - points Claude Code at a custom API base, such as a proxy or gateway. Not secret by itself.
- DISABLE_TELEMETRY and DISABLE_ERROR_REPORTING - set to 1 to opt out of usage telemetry and automatic error reporting respectively.
A secret is anything that grants access
API keys, database connection strings with passwords, and payment keys are secrets. Model names, ports, and log levels are not. The rule of thumb: if leaking it would let someone spend your money or reach your data, it is a secret and belongs only in .env.
Secret vs non-secret, and why it matters
The single most important distinction the planner enforces is which variables are secrets. A secret is any value that grants access or spend - an API key, a database URL with a password, a payment provider's secret key. These must never appear in a committed file, which is why the .env.example the planner writes leaves secret values blank and adds a warning comment next to each. Non-secret configuration - the port, the environment name, the log level, a model identifier - can safely carry a real default value in the example, because there is nothing to leak. Getting this split right is most of what keeps keys out of git.
The .env and .env.example workflow
- Add .env to your .gitignore before you create it, so a real secret can never be committed by accident.
- Create .env with your real values. This file stays on your machine and out of version control.
- Commit the .env.example the planner generates. It documents every variable with a comment and a safe placeholder.
- When a teammate clones the repo, they copy .env.example to .env and fill in their own values.
- When you add a new variable, add it to both files - the real value in .env, the documented placeholder in .env.example - so the example never drifts out of date.
How to load the variables at runtime
There are a few common ways to get variables from a .env file into your running process. Many frameworks load .env automatically. In Node projects a small loader library reads the file into the process environment at startup. For a quick manual shell session you can export the variables directly, which is what the export block the planner generates is for - though for anything real, a gitignored .env is safer than pasting secrets into your shell history. Whatever the mechanism, the code reads from the environment, so it never needs to know where the values came from.
Common mistakes this prevents
The classic disasters are all avoidable. Committing a real .env is the most common - the fix is gitignoring it before it exists. Putting a secret's real value in .env.example defeats the purpose and leaks it just as surely; the planner blanks those for you. Exposing a server-side secret to the browser is another - anything a client can read is public, so a secret key must stay server-side. And letting .env.example rot until it no longer matches what the app needs makes onboarding painful; keeping the two files in lockstep as you add variables keeps the example trustworthy. If a secret ever does get committed, rotating the key is the only real fix - removing it from the latest commit is not enough, because it lives in git history.
Keeping environments separate
Development, staging, and production should use different values for the same variables - different databases, different keys, ideally different everything that touches real users or money. The variable names stay the same across environments; only the values differ, which is exactly why environment variables exist. In practice that means your production secrets live in your host's secret manager or deployment environment, not in a file on anyone's laptop, and your local .env holds development values that cannot touch production. The planner's job ends at documenting the shape; where each environment's real values live is a deployment decision, and secrets should always sit behind proper access controls.
Frequently asked questions
What is the difference between .env and .env.example?
.env holds your real values and is gitignored - it never gets committed. .env.example documents every variable with placeholders and is committed, so teammates know what to set. The planner generates both.
Which Claude Code variables should I set?
ANTHROPIC_API_KEY if you call the API directly (secret), and optionally ANTHROPIC_MODEL / ANTHROPIC_SMALL_FAST_MODEL to pick models, ANTHROPIC_BASE_URL for a custom endpoint, and DISABLE_TELEMETRY / DISABLE_ERROR_REPORTING to opt out of reporting.
How do I know if a variable is a secret?
If leaking it would let someone access your data or spend your money, it is a secret - API keys, database URLs with passwords, payment keys. Ports, environment names, model ids, and log levels are not secrets.
Is it safe to commit .env.example?
Yes, that is its whole purpose - as long as it contains only placeholders for secrets. The planner leaves secret values blank and adds a warning so a real key never slips in.
I accidentally committed a secret. What now?
Rotate the key immediately - assume it is compromised. Removing it from the latest commit is not enough because it remains in git history, so revoking and reissuing the key is the only real fix.
Where should production secrets live?
In your host's secret manager or deployment environment, not in a file on a laptop. Keep local .env values for development only, and never point local config at production.
Liked this tool? The club is the next step.
Join Claude Code Club for $9/month. 650+ lessons, weekly updates, and the workflows behind every tool on this site.
- No experience needed
- Cancel anytime
- Updated weekly
