Claude Code permissions generator
Pick presets or write your own allow, ask and deny rules, choose the settings file, and copy valid JSON. The rule syntax follows Anthropic's Claude Code docs as of October 2026.
Rule syntax
A rule is Tool or Tool(specifier). Claude Code checks deny rules first, then ask, then allow, and the first match decides no matter how specific the other rules are. An allow rule can't carve an exception out of a deny rule.
| Rule | Matches |
|---|---|
Bash(npm run build) | Exactly npm run build |
Bash(npm run *) | npm run build, npm run test --watch, and bare npm run |
Bash(npm run test:*) | The same as Bash(npm run test *); :* works only at the end |
Bash(ls *) | ls -la but not lsof; Bash(ls*) matches both |
Bash(git *) | Every git command, push included |
Read(./.env) | The .env file in the current directory |
Read(**/.env) | Any .env at or below the current directory |
Read(~/.zshrc) | A path in your home folder |
Edit(//tmp/scratch.txt) | An absolute path: note the two slashes |
Edit(/src/**) | src/ under the settings source: the project for project settings, ~/.claude for user settings |
WebFetch(domain:example.com) | Fetches from example.com; *.example.com matches subdomains only |
mcp__github | Every tool from the github MCP server; mcp__github__get_issue matches one tool |
Agent(Explore) | The Explore subagent |
Each part of a compound command such as npm test && git push has to match a rule on its own. A bare tool name in deny, such as Edit, removes that tool from Claude's context entirely. Note that Read(**/.env.*) also blocks files like .env.example.
Which file, and which wins
- User:
~/.claude/settings.json, for you in every project. - Project:
.claude/settings.json, committed for the team. Its allow rules wait until you accept the workspace trust dialog. - Local:
.claude/settings.local.json, for you in one project. "Yes, and don't ask again" saves rules here. - Managed: deployed by an organization. Nothing you set overrides it.
Precedence, highest first: managed, command-line arguments, local, project, user. List keys such as permissions.allow merge across files instead of replacing each other, and a deny at any level beats an allow at any other.
defaultMode values
default (labelled Manual, with manual accepted as an alias from v2.1.200), acceptEdits, plan, auto, dontAsk and bypassPermissions. auto and bypassPermissions take effect only from user or managed settings. Deny rules apply in every mode, and ask rules still prompt even in bypassPermissions.
What rules can't do
Rules match what Claude writes, not what a program does. Bash(curl *) doesn't stop /usr/bin/curl or sh -c 'curl …', and a Read deny doesn't stop a Python or Node script that opens the file itself. For limits enforced by the operating system, use the Bash sandbox: run /sandbox inside Claude Code. To see every rule in force and the file it came from, run /permissions. The guide to permission prompts covers modes and the sandbox in more depth, and if you'd rather answer the prompts that remain from your phone, Melta (for iPhone and Android) shows them with Allow and Deny buttons.
Common questions
Where is the Claude Code settings.json file?
Your user settings are in ~/.claude/settings.json, shared project settings in .claude/settings.json inside the project, and personal project settings in .claude/settings.local.json. Installing Claude Code doesn't create any of them, so create the one you need.
How do I let Claude Code run a command without asking?
Add an allow rule such as "Bash(npm run test *)" under permissions.allow, or choose "Yes, and don't ask again" on the prompt, which saves the rule to .claude/settings.local.json.
What does Bash(git *) allow in Claude Code?
Every git command, including git push, because only the words before the first * limit the rule. Put the * after the subcommand instead, as in Bash(git log *) or Bash(git commit *).
How do I stop Claude Code from reading .env files?
Add deny rules such as "Read(./.env)" and "Read(./.env.*)", or "Read(**/.env)" to cover nested copies. They block Claude's file tools and recognized commands like cat, but not a script that reads the file itself, so use the sandbox for a hard limit.
Why is defaultMode auto ignored in my project settings?
auto and bypassPermissions don't take effect from .claude/settings.json or .claude/settings.local.json. Put defaultMode in ~/.claude/settings.json, or start the session with --permission-mode auto.
Do deny rules override allow rules in Claude Code?
Yes. Deny is checked first, then ask, then allow, and that holds across files: a deny in user settings blocks an allow in project settings, and the reverse.