acceptEdits auto-approves file edits; plan only explores.
Each preset adds rules below. Test any rule with the permission rule tester.
One path per line. Gives Claude file access outside the project.
KEY=value, one per line. Don't put secrets in a committed file.
Build one with the status line generator.
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": [
"Bash(git status *)",
"Bash(git diff *)",
"Bash(git log *)",
"Bash(git branch *)"
],
"deny": [
"Read(./.env)",
"Read(./.env.*)",
"Read(./secrets/**)",
"Read(~/.ssh/**)",
"Read(~/.aws/**)"
]
}
}
.claude/settings.json. Claude Code picks up changes automatically. Precedence: managed > command line > local > project > user.What goes in settings.json
Most teams only need three things: a model, permission rules so routine commands stop prompting, and deny rules for secrets. Rules use the form Tool or Tool(specifier): Bash(npm run *) matches any npm script, Read(./.env) matches one file, and WebFetch(domain:github.com) matches a domain.
Check rules before committing them with the permission rule tester, add automation with the hooks generator, and look up any key in the environment variables reference.
Frequently asked questions
Where is the Claude Code settings.json file?
There are three you edit yourself: ~/.claude/settings.json applies to every project, .claude/settings.json in a repo is shared with your team through git, and .claude/settings.local.json is your personal override for that repo (Claude Code gitignores it). Organisations can also deploy managed settings that override all three.
Which settings file wins?
Highest first: managed settings, command-line flags, .claude/settings.local.json, .claude/settings.json, then ~/.claude/settings.json. Permission rules are combined across files rather than replaced, and a deny rule anywhere beats an allow rule.
How do I stop Claude Code asking for permission every time?
Add allow rules for the commands you trust, such as Bash(npm run *) or Bash(git commit *), or start in acceptEdits mode so file edits go through. Keep deny rules for secrets and destructive commands. Avoid bypassPermissions outside a sandbox.
How do I block Claude from reading my .env file?
Add Read(./.env) and Read(./.env.*) to permissions.deny. A Read deny rule also stops Edit and Write on the same path. Tick "Protect secrets" above to add these and the common key folders.
Does Claude Code validate settings.json?
Yes. Invalid rules or keys show up in a dialog at startup and in claude doctor. Adding the $schema line (included above) gives you autocomplete and inline validation in VS Code, Cursor and other editors.
Sources: Claude Code settings, Settings reference, Permissions. Claude Code Agents is an independent site, not affiliated with Anthropic.