Claude Code --dangerously-skip-permissions: What It Does and Safer Ways to Stop Prompts
By Shubhranshu, creator of claudeagents · Last reviewed
Claude Code permissions decide what Claude can do without asking you first. You control them with a permission mode (how cautious the whole session is) and with allow, ask and deny rules in settings.json (which exact commands and files are fine, need a check, or are off limits).
Out of the box, Claude asks before most edits, shell commands and web requests. That's safe, but after the fiftieth "Yes" of the day most people either give up and skip permissions entirely, or keep clicking without reading. Neither is great. A few lines of settings get you the middle ground: the boring, safe commands run on their own, and the risky ones still stop and ask.
This guide covers every piece: the permission modes, the /permissions command, where the settings files live, the rule syntax, how to keep Claude away from .env files, and what --dangerously-skip-permissions really does. Everything is checked against Anthropic's permissions docs on 21 November 2026. For a shorter reference, see our permissions and settings docs page.
The Claude Code permission modes
A permission mode is the session-wide setting for how much Claude does without asking. Rules (covered below) then fine-tune it. These are the modes in the current docs:
| Mode | What Claude does | Good for |
|---|---|---|
default | Asks before most file edits, shell commands and network requests. Shown as Manual in the app. | Unfamiliar code, anything important |
acceptEdits | Edits files in your project without asking, plus common file commands (mkdir, touch, mv, cp and similar). Other shell commands still ask. | Normal coding when you review the diff afterwards |
plan | Reads and explores, then writes a plan. No edits until you approve the plan. | Big changes you want to think through first |
auto | Runs without routine prompts. A background classifier reviews each action before it runs. Needs a supported model and plan. | Long tasks where you trust the setup |
dontAsk | Never prompts: anything that would ask is denied. Allowed and read-only actions still run. | Scripts and CI |
bypassPermissions | Skips permission prompts, including writes to protected folders like .git and .claude. | Throwaway containers and VMs only |
Deny rules block in every mode, including bypassPermissions. Allow rules have no effect in bypassPermissions, because nothing is being asked.
How to change the permission mode
There are three ways, and they apply in this order when a session starts: a command-line flag first, then the defaultMode from your settings, then Claude Code's built-in default.
During a session: Shift+Tab
Press Shift+Tab to cycle through the modes. The cycle runs default → acceptEdits → plan, with auto included when it's available to you. The current mode shows in the status bar. bypassPermissions only joins the cycle if you started Claude with a flag that enables it, and dontAsk never appears in the cycle.
When you start Claude: --permission-mode
Pass the mode as a flag. It accepts default, acceptEdits, plan, auto, dontAsk, bypassPermissions or manual (another name for default).
Every time: defaultMode in settings
To always start in the same mode, set permissions.defaultMode in a settings file. One catch: auto and bypassPermissions are ignored when they come from a project's .claude/settings.json or .claude/settings.local.json, so a repository you clone can't switch off your prompts. Put those in your user settings instead.
# Start in plan mode (read and plan, no edits)
claude --permission-mode plan
# Start with file edits auto-accepted
claude --permission-mode acceptEdits
# Skip all prompts. Only inside a container or VM.
claude --dangerously-skip-permissionsAnd to make acceptEdits your normal starting mode, add this to ~/.claude/settings.json:
Set a default mode in settings.json
{
"permissions": {
"defaultMode": "acceptEdits"
}
}Settings files are strict JSON: no comments and no trailing commas, or the file won't load. Changes to permissions reload without restarting Claude Code.
The /permissions command
Type /permissions in Claude Code to see every allow, ask and deny rule that's active, and which settings.json file each one comes from. You can add and remove rules from the same screen, even while Claude is working.
You also create rules without opening any file. When Claude asks to run a shell command, the prompt offers "Yes, and don't ask again" for that command. Choosing it saves an allow rule to .claude/settings.local.json in your project, so it only applies to this project and only on your machine. Approvals for file edits aren't saved this way; they last for the current session.
Where Claude Code permission settings live
Permission rules can sit in several files. Which one you use decides who the rule affects:
| File | Applies to | Share it? |
|---|---|---|
~/.claude/settings.json | You, in every project on this computer | No, it's personal |
.claude/settings.json | Everyone working on this project | Yes, commit it to git |
.claude/settings.local.json | You, in this project only | No, Claude Code keeps it out of git |
managed-settings.json | Everyone on the machine, set by an admin | Deployed by IT |
When the same setting appears in more than one file, the higher level wins, in this order: managed settings, then command-line flags like --settings, then project local, then shared project, then user.
Permission lists are different: they combine. An allow rule in your user file and another in the project file both apply. And because deny is always checked first, a deny rule in any file can't be undone by an allow rule in another.
One safety detail: allow rules in a project's committed .claude/settings.json only take effect after you accept the workspace trust dialog for that folder. Deny and ask rules apply straight away. To see which files loaded, run /status and look at the setting sources.
Permission rule syntax
A rule is a tool name, optionally followed by a specifier in brackets: Tool or Tool(specifier). A bare tool name like Bash or WebFetch matches every use of that tool.
Rules are checked in a fixed order: deny first, then ask, then allow. The first match decides, and a more specific rule doesn't jump the queue. So Bash(aws *) in deny blocks aws s3 ls even if you allowed Bash(aws s3 ls).
Bash commands
A * matches any text, spaces included. Put it after the part of the command you want to fix in place. Bash(npm run *) allows every npm script; Bash(git commit *) allows commits with any message. The older :* form still works at the end of a rule, so Bash(ls:*) and Bash(ls *) match the same commands.
Mind the space. Bash(ls *) matches ls and ls -la but not lsof. Bash(ls*) with no space matches lsof too.
For a chained command like npm test && git push, every part must be allowed for it to run silently, and a deny or ask rule on any part applies to the whole thing.
Files: Read and Edit
Read(...) and Edit(...) rules take file paths in the same style as .gitignore. Edit covers all of Claude's file-editing tools, and a Read deny also covers searches and @file mentions. How a path starts matters:
Read(./.env)orRead(*.env): relative to the current folder.Edit(/src/**/*.ts): relative to where the settings file applies. In project settings, that's the project folder.Read(~/Documents/*.pdf): from your home folder.Read(//Users/alice/secrets/**): an absolute path needs two slashes./Users/alice/filewith one slash is not treated as absolute.
Web requests and MCP tools
WebFetch(domain:example.com)covers one domain.WebFetch(domain:*.example.com)covers its subdomains but not the bare domain.mcp__githubcovers every tool from thegithubMCP server, andmcp__github__create_issuecovers one tool."deny": ["mcp__*"]removes all MCP tools.
A starter settings.json you can copy
This file lets routine checks run on their own, makes Claude ask before pushing, and keeps it out of your secrets. Put it in .claude/settings.json to share it with your team, or ~/.claude/settings.json to use it everywhere. Swap the npm scripts for your own.
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": [
"Bash(npm run lint)",
"Bash(npm run test *)",
"Bash(git diff *)",
"Bash(git log *)"
],
"ask": [
"Bash(git push *)"
],
"deny": [
"Read(./.env)",
"Read(./.env.*)",
"Read(./secrets/**)"
]
}
}The $schema line is optional. It gives you autocomplete and error checking in editors like VS Code.
How to stop Claude Code reading .env files
Add deny rules for the files. This is the example from Anthropic's own settings docs:
{
"permissions": {
"deny": [
"Read(./.env)",
"Read(./.env.*)"
]
}
}Read and Edit deny rules apply to Claude's file tools and also to common shell commands that read or write files, such as cat, head, tail, sed and tee. A .claudeignore file does nothing; use deny rules instead.
Know the limit, though. The docs are clear that permission rules match the commands Claude usually writes; they aren't a wall around the file. A script that opens the file itself, or a search run from inside its folder, can still get to it. For real enforcement at the operating-system level, turn on Claude Code's sandbox with /sandbox (macOS, Linux and WSL2), which can block reads to paths like ~/.aws/credentials for every command.
What --dangerously-skip-permissions does
claude --dangerously-skip-permissions starts Claude in bypassPermissions mode: no permission prompts, including for writes to .git and .claude. It's exactly the same as --permission-mode bypassPermissions.
Anthropic's advice is short: only use it in isolated environments like containers or VMs, where Claude can't damage anything that matters. For unattended runs on Linux and macOS, run it as a normal user, not root.
A few things still hold in bypass mode. Deny rules still block, explicit ask rules still prompt, and organisations can turn the mode off entirely. There's also --allow-dangerously-skip-permissions, which adds bypass mode to the Shift+Tab cycle without starting in it, so you can switch in only when you need to.
“Only use this mode in isolated environments like containers or VMs where Claude Code can't cause damage.”
If what you really want is fewer prompts on your own laptop, you usually don't need bypass mode. Try acceptEdits plus a handful of allow rules for your test and lint commands, or auto mode if your plan supports it. You keep the safety net for the commands that matter.
Permissions in scripts and CI
When you run Claude non-interactively with claude -p, nobody is there to answer a prompt. Use dontAsk mode with an explicit list of allowed tools, so anything outside the list is denied instead of hanging:
claude -p "run the test suite" \
--permission-mode dontAsk \
--allowedTools "Bash(npm test)" "Read"--allowedTools lists tools and commands that run without prompting. --disallowedTools does the opposite: a bare name like Edit removes the tool completely, while a scoped rule like Bash(rm *) keeps the tool but blocks matching calls.
Managed settings for teams
Companies can push a policy file that sits above every developer's own settings. It lives at:
- macOS:
/Library/Application Support/ClaudeCode/managed-settings.json - Linux and WSL:
/etc/claude-code/managed-settings.json - Windows:
C:\Program Files\ClaudeCode\managed-settings.json
{
"permissions": {
"deny": ["Read(./.env)", "Read(./secrets/**)"],
"disableBypassPermissionsMode": "disable"
},
"allowManagedPermissionRulesOnly": true
}This blocks secret files for everyone, turns off bypass mode, and with allowManagedPermissionRulesOnly ignores any allow rules developers add themselves. Policies can also come from MDM tools or the Claude admin console. Run /status to confirm a policy is active.
Frequently asked questions
How do I stop Claude Code asking for permission every time?
Add allow rules for the commands you trust in settings.json, for example "allow": ["Bash(npm run test *)"], or pick "Yes, and don't ask again" when Claude asks. To stop prompts for file edits, switch to acceptEdits mode with Shift+Tab or set it as permissions.defaultMode.
How do I give Claude Code all permissions?
Start it with claude --dangerously-skip-permissions (the same as --permission-mode bypassPermissions). Anthropic recommends this only inside an isolated container or VM. Deny rules and explicit ask rules still apply in this mode.
Is --dangerously-skip-permissions safe?
Only in a throwaway environment. With no prompts, a wrong command can delete files or push code. On your main machine, acceptEdits plus allow rules for your usual commands gives most of the speed with much less risk.
Where is the Claude Code settings.json file?
Your personal settings are in ~/.claude/settings.json. Project settings are in .claude/settings.json (shared through git) and .claude/settings.local.json (just you). Company policies go in managed-settings.json. Run /status to see which ones loaded.
How do I deny Claude Code access to certain files?
Add Read and Edit deny rules, such as "deny": ["Read(./.env)", "Read(./secrets/**)"]. For enforcement that also covers scripts and every shell command, turn on the sandbox with /sandbox.
What's the difference between ask and deny rules?
An ask rule always makes Claude stop and ask you, even in acceptEdits or bypass mode. A deny rule blocks the action with no prompt, in every mode. Deny is checked first, then ask, then allow.
Sources
Skip the setup: get 85 ready-made agents
Coding, SEO and marketing kits for Claude Code, with 52 skills and 53 slash commands. $29 one-time, lifetime updates.
See what's included →