Claude Code permissions and settings: modes, rules and examples
By Shubhranshu, creator of claudeagents · Last reviewed
Permissions decide what Claude Code may do without asking you: read files, edit them, run commands or fetch web pages. You control them in two ways: a permission mode for the whole session, and rules that allow, ask about or deny specific actions.
This page explains both, where the settings files live, which one wins when they disagree, and gives configurations you can copy. Facts come from Anthropic's permissions documentation, checked on 16 November 2026.
What Claude Code asks permission for#
| Action | Asks first? | If you choose "don't ask again" |
|---|---|---|
| Read files, search code | No, inside your project and added folders | Not needed |
| Run shell commands | Yes, except a built-in set of read-only commands | Remembered for this project and command |
| Edit or create files | Yes | Remembered until the session ends |
| Fetch a web page | Yes, except some preapproved documentation sites | Remembered for this project and domain |
| Web search | Yes | Remembered for this project |
When a prompt appears, you can approve once, approve and remember, or say no. On most prompts you can press Tab to add a short note telling Claude why, such as "no, use the test database".
The permission modes#
The mode sets how cautious Claude Code is for the whole session. Press Shift+Tab to cycle through the main modes, or start in one with claude --permission-mode plan.
| Mode | Settings value | What it does |
|---|---|---|
| Manual | default | Asks before each tool the first time it's used. The safest place to start. |
| Accept edits | acceptEdits | Accepts file edits and simple file commands (mkdir, touch, mv, cp) in your project without asking. Still asks before other commands. |
| Plan | plan | Reads and explores but doesn't edit your files. Claude proposes a plan for you to approve. |
| Auto | auto | Works without routine prompts. A background check reviews commands and network requests and blocks risky ones. |
| Don't ask | dontAsk | Refuses anything that would need a prompt. Useful for unattended runs. Terminal only. |
| Bypass permissions | bypassPermissions | Skips prompts entirely. Only use it inside a container or virtual machine. |
To set the default for new sessions, add "defaultMode": "plan" (or another value) inside permissions in a settings file.
Allow, ask and deny rules#
Rules let you pre-approve safe actions and block dangerous ones, so you get fewer prompts without giving up control. Each rule names a tool, optionally with a pattern in brackets:
| Rule | Matches |
|---|---|
Bash(npm run build) | Exactly the command npm run build |
Bash(npm run *) | npm run build, npm run test and other npm scripts, but not npm install |
Read(./.env) | Reading the .env file in your project |
Read(./secrets/**) | Reading anything inside the secrets folder |
Edit(./src/**) | Editing files under src |
WebFetch(domain:example.com) | Fetching pages from example.com |
Bash | Every shell command |
Order matters: Claude Code checks deny rules first, then ask, then allow, and the first match decides. A broad deny like Bash(aws *) blocks aws s3 ls even if you also allowed that exact command. An allow rule can never carve an exception out of a deny.
Manage rules interactively with /permissions, or edit the settings files directly.
Where settings live#
| File | Applies to | Share it? |
|---|---|---|
| Managed settings (set by your company) | Everyone on the machine | Set by IT; can't be overridden |
.claude/settings.local.json | You, in this project | No, it's ignored by Git |
.claude/settings.json | Everyone working on this project | Yes, commit it |
~/.claude/settings.json | You, in every project | No |
Command-line flags apply to one session. Managed settings beat everything; after that, the more specific file wins. A deny rule at any level still blocks the action everywhere.
Copy-ready configurations#
A sensible starting point for a JavaScript project. Save it as .claude/settings.json and commit it so your team gets the same rules:
{
"permissions": {
"allow": [
"Bash(npm run *)",
"Bash(git status)",
"Bash(git diff *)"
],
"ask": [
"Bash(git push *)"
],
"deny": [
"Read(./.env)",
"Read(./.env.*)",
"Read(./secrets/**)",
"Bash(rm -rf *)"
]
}
}Personal preferences, such as starting every session in Plan mode, belong in ~/.claude/settings.json:
Personal defaults#
{
"permissions": {
"defaultMode": "plan"
}
}To give Claude access to a folder outside your project, use /add-dir ../shared-lib for one session, or add it under permissions.additionalDirectories in a settings file. Added folders grant file access only; Claude Code doesn't load most .claude/ configuration from them.
Safety tips#
- Deny reads of
.envfiles and secret folders in every project. - Keep
git push, deploys and database commands inask, even when you allow everything else. - Only use Bypass permissions inside a disposable container or VM.
- Review project
.claude/settings.jsonfiles in repositories you clone: they can pre-approve commands. - Keep your project in Git, because rewinding doesn't undo shell commands.
Frequently asked questions
How do I change permission mode in Claude Code?
Press Shift+Tab to cycle through Manual, Accept edits, Plan and Auto. To start in a mode, run claude --permission-mode plan, or set permissions.defaultMode in a settings file.
How do I stop Claude Code asking for permission every time?
Add allow rules for the commands you trust, such as Bash(npm run *), in .claude/settings.json, or answer 'Yes, don't ask again' on the prompt. Accept edits mode also stops prompts for file edits.
How do I stop Claude Code reading my .env file?
Add Read(./.env) and Read(./.env.*) to permissions.deny in your settings. A Read deny rule also blocks edits to the same file and common shell commands like cat on it.
Which settings file wins?
Managed settings from your company win over everything. After that, the more specific file wins: local project settings, then shared project settings, then your user settings. A deny rule at any level blocks the action.
Is bypass permissions mode safe?
Only inside an isolated container or virtual machine. It skips permission prompts entirely, so Claude can run any command without asking.