How to stop Claude Code asking permission for every command

Add allow rules to the permissions block of a settings file. "Bash(npm run *)" lets Claude run any npm script without a prompt, and "Bash(git commit *)" any commit. Put them in ~/.claude/settings.json for every project or .claude/settings.json to share with your team, and keep risky commands in "deny" so a broad allow can't reach them.

A starting permissions block

{
  "permissions": {
    "allow": [
      "Bash(npm run *)",
      "Bash(npm test *)",
      "Bash(git status)",
      "Bash(git diff *)",
      "Bash(git commit *)"
    ],
    "deny": [
      "Bash(git push *)",
      "Read(./.env)"
    ]
  }
}

Rules are checked deny first, then ask, then allow. The first match decides, and a more specific allow can't carve an exception out of a broader deny.

How the wildcard works

Rules look like Tool or Tool(specifier). In a Bash rule, * matches any text, spaces included. Everything before the first * must match as written, so put the * after the subcommand.

RuleMatchesDoesn't match
Bash(npm run build)npm run buildnpm run build --watch
Bash(npm run *)npm run build, npm runnpm install
Bash(git log *)git log --onelinegit push
Bash(ls *)ls -la, lslsof

Other tools take their own specifiers: WebFetch(domain:example.com), Read(./.env), and mcp__github__* for every tool from one MCP server.

Which file to put the rules in

  • ~/.claude/settings.json: commands you trust in every repo, like git status.
  • .claude/settings.json: the project's own scripts, committed so the team stops seeing the same prompts.
  • .claude/settings.local.json: your personal exceptions for one repo. This is also where "Yes, and don't ask again" saves rules.

Allow and deny lists merge across all of these, so you can add rules at any level without copying the others. Details in settings.json precedence.

Clean up the rules you already have

After a few weeks of clicking "don't ask again", a local settings file fills up with one exact command per line: Bash(git add src/a.ts), Bash(git add src/b.ts), and so on. Those exact rules never match the next file. Replace a run of them with one prefix rule such as Bash(git add *), and move the ones you want everywhere up to ~/.claude/settings.json. Rulebook's Permissions editor groups rules by tool and offers that consolidation in one click.

Commands that still prompt

  • Compound commands. npm test && git push runs without a prompt only if every part is allowed.
  • Different spellings. Bash(git push *) doesn't match git -C . push. Deny rules cover the usual form, not every form; use sandboxing or a PreToolUse hook for a hard boundary.
  • Untrusted project files. Allow rules in a committed .claude/settings.json wait until you trust the folder.

If you'd rather tell Claude how to work than what it may run, that belongs in CLAUDE.md: see where Claude Code looks for CLAUDE.md.

Questions

How do I allow all git commands in Claude Code?
Add "Bash(git *)" to permissions.allow. That covers every git subcommand, including push. To allow only some, list them: "Bash(git status)", "Bash(git diff *)", "Bash(git commit *)", and add "Bash(git push *)" to deny if pushes should never run on their own.
Is Bash(git:*) the same as Bash(git *)?
Yes. A trailing :* is an older way to write a trailing wildcard and still matches the same commands. The permission dialog now saves the space form. :* only works at the very end of a rule.
Where did my "don't ask again" approvals go?
Into .claude/settings.local.json at the root of the git repository, as allow rules. They apply to that repo only. Run /permissions to see every rule and the file it came from.
Why does Claude Code still ask after I allowed a command?
A deny or ask rule in any settings file wins over an allow rule, a compound command like a && b needs every part allowed, and allow rules in a committed project file wait until you trust the folder.
Can CLAUDE.md give Claude permission to run commands?
No. CLAUDE.md shapes what Claude tries to do, but Claude Code enforces permissions from settings files, /permissions, permission modes and hooks.

Rulebook for Mac

Rulebook is a native Mac app we are building for these files. It shows every CLAUDE.md and settings.json level side by side, lets you drag a rule from one file to another, and edits permissions without hand-written JSON. See the features.

Rulebook is in development and not available yet.

Email us about the launch

Related guides