Black Friday sale: 85 Claude Code agents for $29 one-time · lifetime updatesGet access →

Claude Code permissions and settings: modes, rules and examples

Updated · 9 min read

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#

Which actions need approval in Manual mode
ActionAsks first?If you choose "don't ask again"
Read files, search codeNo, inside your project and added foldersNot needed
Run shell commandsYes, except a built-in set of read-only commandsRemembered for this project and command
Edit or create filesYesRemembered until the session ends
Fetch a web pageYes, except some preapproved documentation sitesRemembered for this project and domain
Web searchYesRemembered 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.

Claude Code permission modes
ModeSettings valueWhat it does
ManualdefaultAsks before each tool the first time it's used. The safest place to start.
Accept editsacceptEditsAccepts file edits and simple file commands (mkdir, touch, mv, cp) in your project without asking. Still asks before other commands.
PlanplanReads and explores but doesn't edit your files. Claude proposes a plan for you to approve.
AutoautoWorks without routine prompts. A background check reviews commands and network requests and blocks risky ones.
Don't askdontAskRefuses anything that would need a prompt. Useful for unattended runs. Terminal only.
Bypass permissionsbypassPermissionsSkips 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:

Permission rule examples
RuleMatches
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
BashEvery 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#

Claude Code settings files
FileApplies toShare it?
Managed settings (set by your company)Everyone on the machineSet by IT; can't be overridden
.claude/settings.local.jsonYou, in this projectNo, it's ignored by Git
.claude/settings.jsonEveryone working on this projectYes, commit it
~/.claude/settings.jsonYou, in every projectNo

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:

.claude/settings.json
{
  "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#

~/.claude/settings.json
{
  "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 .env files and secret folders in every project.
  • Keep git push, deploys and database commands in ask, even when you allow everything else.
  • Only use Bypass permissions inside a disposable container or VM.
  • Review project .claude/settings.json files 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.

Sources

Keep reading