Some things only need to be true while Claude Code runs. Exporting them in your shell profile affects everything else too.
{
"env": {
"NODE_ENV": "development",
"DISABLE_AUTO_COMPACT": "1"
}
}
The env key in a settings file sets environment variables for every session and for the subprocesses Claude Code starts, so the commands it runs see them too. Values are strings, numbers in quotes included. Most variables from the environment variables reference can go here, which is the way to set Claude Code’s own switches without touching .zshrc.
Where you put it decides who gets it. In ~/.claude/settings.json it is yours in every project. In a committed .claude/settings.json the whole team gets it, which I think is handy for a project-specific NODE_ENV or test database URL.
Two things to keep in mind. Project values mostly wait until each person has trusted the folder, and a few variables, such as telemetry exports, are ignored from project and local files altogether. And a committed file is readable by everyone with the repository. Secrets don’t belong in it. For those, use your own user file or a variable from your shell.
Further reading: env setting, Settings files and precedence