Skip to content
Agents Handbook
PlaybooksJobsAgentsLessonsField logFor agents

Claude Code settings.json permissions builder

Claude Code reads permission rules from the permissions object in settings.json: allow runs a tool without asking, ask always prompts, and deny blocks it, with deny checked first. This builder writes that block from a preset, explains each rule in plain words and flags risky ones, all in your browser.

Also accepts file edits and common file commands such as mkdir, mv and cp in your working folders.

Save as
.claude/settings.json
settings.json
{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "permissions": {
    "allow": [
      "Bash(npm test *)",
      "Bash(npm run test *)",
      "Bash(npm run lint *)",
      "Bash(npm run build *)",
      "Bash(git add *)",
      "Bash(git commit *)"
    ],
    "ask": [
      "Bash(git push *)",
      "Edit(**/*.test.*)",
      "Edit(**/*.spec.*)",
      "Edit(**/__tests__/**)",
      "Edit(**/tests/**)",
      "Edit(**/test_*.py)",
      "Bash(rm *)"
    ],
    "deny": [
      "Read(**/.env)",
      "Read(**/.env.*)",
      "Read(~/.ssh/**)",
      "Read(~/.aws/**)",
      "Bash(git push --force *)",
      "Bash(git push -f *)",
      "Bash(git push * --force)",
      "Bash(git push * -f)"
    ],
    "defaultMode": "acceptEdits"
  }
}
Checks0 errors, 0 risks
  • NoteAllow rules and extra folders in .claude/settings.json apply only after each person accepts the workspace trust dialog.
  • If the file exists, merge the permissions object into it. Settings files are strict JSON: no comments, no trailing commas.
  • Rules from every settings file merge. A deny in any file beats an allow in any other.
  • Claude Code reloads permission changes without a restart. Run /permissions to see each rule and its file.

Examples: Bash(git commit *), Edit(/docs/**), WebFetch(domain:github.com), mcp__github__get_*

Allowruns without asking6
  • Bash(npm test *)Runs without asking: shell commands that start with "npm test".
  • Bash(npm run test *)Runs without asking: shell commands that start with "npm run test".
  • Bash(npm run lint *)Runs without asking: shell commands that start with "npm run lint".
  • Bash(npm run build *)Runs without asking: shell commands that start with "npm run build".
  • Bash(git add *)Runs without asking: shell commands that start with "git add".
  • Bash(git commit *)Runs without asking: shell commands that start with "git commit".Commits stay local until a push, and the push asks first.
Askalways prompts7
  • Bash(git push *)Always asks first: shell commands that start with "git push".
  • Edit(**/*.test.*)Always asks first: editing or creating **/*.test.*.
  • Edit(**/*.spec.*)Always asks first: editing or creating **/*.spec.*.
  • Edit(**/__tests__/**)Always asks first: editing or creating **/__tests__/**.
  • Edit(**/tests/**)Always asks first: editing or creating **/tests/**.
  • Edit(**/test_*.py)Always asks first: editing or creating **/test_*.py.
  • Bash(rm *)Always asks first: shell commands that start with "rm".Files removed with rm skip the trash. You see each path before it goes.
Denyblocked, checked first8
  • Read(**/.env)Blocked: reading **/.env. Edits and new files there are blocked too.
  • Read(**/.env.*)Blocked: reading **/.env.*. Edits and new files there are blocked too.
  • Read(~/.ssh/**)Blocked: reading ~/.ssh/** in your home folder. Edits and new files there are blocked too.
  • Read(~/.aws/**)Blocked: reading ~/.aws/** in your home folder. Edits and new files there are blocked too.
  • Bash(git push --force *)Blocked: shell commands that start with "git push --force".
  • Bash(git push -f *)Blocked: shell commands that start with "git push -f".
  • Bash(git push * --force)Blocked: shell commands that match "git push * --force", where * stands for any text.
  • Bash(git push * -f)Blocked: shell commands that match "git push * -f", where * stands for any text.

How to use it

  1. 1

    Pick a job and a scope

    Choose the preset closest to the work, such as coding with tests or inbox triage with no sends. Then choose where the rules live: all your projects, this project for the whole team, or this project for you alone.

  2. 2

    Adjust the rules

    Turn guards on or off, add your own allow, ask and deny rules, and pick the mode sessions start in. Each rule gets one plain line that says what it does, and the checks flag risky or broken rules as you type.

  3. 3

    Save it and confirm

    Copy or download the JSON and save it at the path shown. If the file already exists, merge the permissions object into it. Claude Code reloads permission changes without a restart. Run /permissions to see every rule and the file it came from.

Questions

Where is the Claude Code settings.json file?

Your personal file is ~/.claude/settings.json and applies in every project. A project has .claude/settings.json, which you commit for the team, and .claude/settings.local.json, which is yours alone and stays out of git. Organizations can also deploy managed settings that override all three.

In what order does Claude Code check allow, ask and deny rules?

Deny first, then ask, then allow, and the first match wins no matter how specific the rules are. So a deny rule on Bash(aws *) blocks aws s3 ls even when an allow rule names it. Rules from every settings file merge into one list, so a deny in any file beats an allow in any other.

How do I allow all commands in Claude Code?

Set defaultMode to bypassPermissions in ~/.claude/settings.json, or start with claude --dangerously-skip-permissions. The docs say to use it only in an isolated container or VM, because it skips almost every prompt. Auto mode is the safer option: a classifier reviews each action, and deny and ask rules still apply.

What are the defaultMode values in Claude Code?

default (Manual, asks before edits and commands), acceptEdits, plan, auto, dontAsk and bypassPermissions. manual is an alias for default. auto and bypassPermissions take effect only from your user settings, not from a project or local file.

How do I stop Claude Code reading .env files?

Add Read(**/.env) and Read(**/.env.*) to permissions.deny. A Read deny rule also blocks edits to the same files. It covers Claude's file tools and commands such as cat, but not a script that opens files itself, so turn on the sandbox if you need a hard boundary.

Why does Claude Code still ask after I allowed a command?

Usually an ask rule in another settings file also matches, and ask is checked before allow. A compound command such as a && b also needs every part allowed. Allow rules also never pre-approve writes to protected paths such as .git and .claude.

How do I give Claude Code access to a folder outside my project?

List it in permissions.additionalDirectories, or add it for one session with --add-dir or /add-dir. Files there follow the same rules as your project folder. Folders listed in a project's .claude/settings.json apply only after you accept the workspace trust dialog.

Sources

Every path, key and command comes from the vendor docs below. We checked them on 2026-10-30.

More free tools

All free tools