Claude Code permissions, without guessing the syntax
Say what Claude Code may do on its own, what it should ask about and what it must never do. The builder writes the settings.json with allow, ask and deny rules for your toolchain, and tells you which rules won’t do what you expect. No sign-up, and nothing leaves this page. Already have a file? Check it instead.
1Say what Claude Code may do
Read secrets
.env files, a secrets folder, SSH and cloud keys. Also covers cat, head and tail on them in commands Claude Code can read.
Edit files in the project
Edit, Write and every other tool that changes files, inside this folder only.
Run the tests
The test commands of the toolchains picked above.
Lint, build and type check
Lint, build, type check and format.
Install packages
A new package runs its own install scripts on your machine.
Look at git changes and history
git status, diff, log and show.
Commit and switch branches
git add, commit and switch, on this machine only.
Push to the remote
Anything pushed is seen by others and can start a deploy.
Throw away work or history
Force pushes, hard resets and git clean. Spelled another way they slip past; see below.
Delete files with rm
rm and rmdir on anything, in or out of the project.
Use curl and wget
curl and wget can send your files anywhere. Allow web pages by domain below instead.
Search the web
Claude Code's own WebSearch tool.
Containers, clusters and cloud
docker, kubectl, helm, terraform and the AWS, Google Cloud and Azure command lines.
Database command lines
psql, mysql, sqlite3, mongosh and redis-cli: any query, including DROP.
Your own rules: deploy scripts, MCP servers, anything else
One per line. A plain command such as make deploy is covered with and without arguments. Rules such as Bash(./scripts/release.sh *), mcp__github or mcp__stripe__create_refund are kept as written.
2Save the settings file
.claude/settings.json
Runs without asking
- Run the tests
- Lint, build and type check
- Look at git changes and history
- Search the web
Asks you first
- Edit files in the project
- Install packages
- Commit and switch branches
- Push to the remote
- Delete files with rm
- Use curl and wget
- Containers, clusters and cloud
- Database command lines
- Fetch web pages
Never runs
- Read secrets
- Throw away work or history
- An allowed command takes any arguments, and a few arguments run other programs or write files, such as go test -exec, make SHELL=… or git diff --output. Allow only what you would let a teammate run unwatched.
- Allow rules in a shared .claude/settings.json apply only once each person has trusted the folder. Ask and deny rules apply at once.
If the file already has settings, merge the lists by hand. Claude Code joins the allow, ask and deny lists from every settings file; for a single value such as the mode, the more specific file wins.
How Claude Code reads the rules
Claude Code checks deny rules first, then ask, then allow, and the first match decides. It joins the lists from every settings file: managed settings, the command line, .claude/settings.local.json, .claude/settings.json and ~/.claude/settings.json. The details are in Claude Code’s permissions documentation, which this builder follows (checked 20 November 2026).
| Option | Rule | What it matches |
|---|---|---|
| A shell command | RuleBash(npm run test *) | What it matchesnpm run test with any arguments. A space before * keeps it from matching npm run tests. |
| Reading files | RuleRead(./.env.*) | What it matchesPaths use .gitignore patterns: ./ is the current folder, ~/ your home, // the root, ** any depth. |
| Changing files | RuleEdit(./src/**) | What it matchesCovers Edit, Write and every other tool that changes files. |
| Web pages | RuleWebFetch(domain:docs.python.org) | What it matchesOne host. *.example.com takes its subdomains but not example.com itself. |
| MCP tools | Rulemcp__github__create_issue | What it matchesmcp__github takes every tool of that server. No brackets: Claude Code skips an MCP rule that has them. |
What rules can’t do
Arguments are easy to respell
A deny rule for
git push --force *missesgit push origin main --force. Keep the whole command in ask, and protect your main branch on the server, where no spelling gets past.A file rule is not a sandbox
Read(./.env)also stopscat .envin commands Claude Code can read, but not a script that opens the file itself. Claude Code’ssandboxsetting adds a wall at the operating system level.Asking only works while you watch
An ask rule waits at the terminal. Step away and the session stops there; in a run nobody watches, it is refused. Sending the question to your phone keeps it moving without allowing more.
Answer the asks from anywhere
Tick the phone box above and each question Claude Code would ask you goes to your VariantGate inbox instead: yes or no from email, Slack, Teams, Discord or a phone notification, with every answer kept on the record. Free for one person and 100 requests a month, with no card.
Questions
Which wins when an allow, ask and deny rule all match?
Deny rules first, then ask, then allow. The first rule that matches decides, and a more specific rule does not win over a broader one. So Bash(git push *) in ask beats Bash(git push origin feature *) in allow: that push still asks. The builder points out rules like that one.
Which settings file should I put this in?
Use .claude/settings.json for rules the whole team should share, checked into git. Use .claude/settings.local.json for your own choices in one project, and keep it out of git. Use ~/.claude/settings.json for rules that follow you into every project. Claude Code joins the allow, ask and deny lists from all of them.
Why are my project allow rules ignored?
Allow rules and extra folders in a shared .claude/settings.json only apply once each person has trusted the folder. Deny and ask rules apply at once, so a cloned repository can make Claude Code more careful without asking, never less.
How do I write a rule for a shell command?
Bash(npm test *), with a space before the star, matches npm test with any arguments but not npm testing. The older Bash(npm test:*) means the same and still works. Bash on its own, or Bash(*), matches every command. A rule for one command never covers a chain such as npm test && rm -rf build: each part needs its own match.
How do I stop Claude Code reading .env files?
Add Read(./.env) and Read(./.env.*) to deny, and a folder pattern such as Read(./secrets/**). Read rules also cover cat, head, tail and similar commands in shell commands Claude Code can read, but not every way a program can open a file, so they are not a sandbox. Claude Code's sandbox setting keeps commands away from files at the operating system level.
Can a deny rule block force pushes?
Not reliably. Claude Code's documentation calls rules that pin down a command's arguments fragile: a deny rule for git push --force does not catch git push origin main --force. Use such rules as a reminder, keep push itself in ask, and protect your main branch on the server, where no spelling gets past.
Can I set auto or bypassPermissions mode here?
In a project or local settings file, no: Claude Code takes auto and bypassPermissions only from user or managed settings, or from the command line for one session. The builder offers the modes a project file can set, and can switch bypassPermissions off with disableBypassPermissionsMode.
How does answering from my phone work?
Claude Code runs a PermissionRequest hook only when it is about to ask you. The variantgate hook sends that question to your inbox, waits up to two minutes for a yes or no from email, Slack, Teams, Discord or a phone notification, and hands Claude Code the answer. Calls your rules already allow never reach it. If nobody answers in time or the service cannot be reached, you get Claude Code's own prompt as before.
Do you see what I put in the builder?
No. The builder runs in your browser and sends nothing anywhere. A link to your settings carries them after the # sign, which browsers never send to a server.