How to allow commands in Claude Code without allowing everything: my permission list
Write rules in permissions.allow in ~/.claude/settings.json (all your projects) or .claude/settings.json (one project, shared with the team), in the form Bash(npm run *): the star replaces what varies, and it goes after the subcommand. Claude Code applies deny rules first, then ask, then allow. My list has 61 rules, and the most useful change was a removal: **allowing node * or python * means allowing any script**, so I took them out.
The problem: too many questions, or none at all
In Manual mode with no rules, Claude Code asks before most shell commands. After an hour, you click “Yes” without reading, which protects nothing anymore. The other reflex is to switch everything off with --dangerously-skip-permissions. The documentation reserves that mode for isolated environments, a container or a virtual machine, not your own machine with your keys and your repositories.
In between, there is a list of rules: what is safe runs without a question, the rest asks. The job is to write that list wide enough that you stop being interrupted, and narrow enough that a rule does not allow more than it claims.
Where and how to write a rule
- `~/.claude/settings.json`: your rules, in every project. That is where mine lives.
- `.claude/settings.json` in the project: the team's rules, to commit.
- `.claude/settings.local.json` in the project: your personal exceptions. It is also where Claude Code stores a rule when you answer “Yes, and don't ask again” to a prompt.
A rule reads Tool or Tool(specifier). For the shell, write the command and replace what changes with *:
{
"permissions": {
"allow": ["Bash(npm run *)", "Bash(git commit *)"],
"deny": ["Bash(git push *)", "Read(./.env)"]
}
}- The star goes after the subcommand.
Bash(git log *)only allowsgit log.Bash(git *)allows every git command, push included. - The space matters.
Bash(ls *)coversls -labut notlsof.Bash(ls*)covers both. - Deny always wins. The order is deny, then ask, then allow. A more specific allow rule does not carve an exception out of a deny rule.
- Chained commands are checked one by one.
Bash(npm test *)does not allownpm test && rm -rf build.
The /permissions command shows every active rule and the file each one comes from.
My list, as it stands
My ~/.claude/settings.json holds 61 allow rules, 55 of them for the shell. They fall into three families:
- Reading:
ls,cat,grep,rg,find,jq,diff,treeand their neighbours. - My projects' tools:
npm,yarn,pnpm,git,gh,xcodebuild,pod,docker. - A single production rule, written on purpose:
Bash(vercel deploy --prod*), for my apps' websites. On top of these come tools outside the shell, such asmcp__argent, which allows every tool of the MCP server that drives my iOS simulator. The Sentry tools are not there: every status change on an error asks for confirmation.
An earlier version had 65. I removed five: node *, python *, python3 *, npx * and xargs *. These commands run whatever they are given. A Bash(node *) rule does not say “run Node”, it says “run any code”. The documentation points the same way: in auto mode, Claude Code drops rules that allow an interpreter with a wildcard on its own.
Auto mode is the other half of the setup. A second model reviews shell commands and network requests before they run, and its rules are set in autoMode.allow, as sentences rather than patterns. I added a single exception there, dated November 4, 2026: deploying my apps' websites to production is allowed, including from my scheduled tasks. Each of those tasks has an instruction for the opposite case: deployment refused for lack of permission, keep the commit and say so in the report.
What my list still lets through
- Rules that do nothing.
ls,cat,head,tail,grep,find,wc,diff,stat,du,which,echo,pwdandcdare among the read-only commands Claude Code already runs without asking. Fourteen of my rules add nothing. - Rules wider than they look.
Bash(git *)allowsgit push.Bash(curl *)reaches any address.Bash(awk *)can start another command through itssystem()function. I have no deny rule yet. - An instruction is not a rule. My
CLAUDE.mdsays “never read .env files”. That steers the model, it does not stop it: the documentation states that permissions are enforced by Claude Code, not by the model. The real barrier isRead(./.env)underdeny. - The local file gets cluttered. After many “Yes, and don't ask again”, my local file keeps exact rules, such as an
ssh-keygencommand with a full temporary path, that will never match again.
Even a deny rule is not a wall. It compares the command text: Bash(git push *) blocks git push origin main, not git -C . push origin main. For a block that does not depend on how the command is written, you need a hook that reads the command before it runs or Claude Code's sandbox. And in a scheduled task, a refused permission is seen by nobody: the report has to say it.
How to start
- Run
/fewer-permission-prompts: this skill bundled with Claude Code reads your past sessions, spots the read-only commands and MCP tools you run often, and proposes a list in the project's.claude/settings.json. - Write your rules with the star after the subcommand:
Bash(npm run *)rather thanBash(npm *). - Never allow
Bash(*), or an interpreter with a wildcard. - Put your secrets under
denyfrom day one:Read(./.env). - To work without interruptions, prefer auto mode (Shift+Tab to switch modes) over
--dangerously-skip-permissions.
Article written with the help of AI, from my daily practice and my projects.
The whole notebook