Skip to content
BENIBIX Learn

Permission Rule

AI⌨️ Claude CodeClaude Code Concepts

Also known as Claude Code permission rules, allow rule, deny rule

A line that says yes, ask or no to a tool.

Think of it like

It is like a house list. Always fine, ask me first, and never.

Example

Jack is tired of approving npm test. He adds one allow rule for it, and one deny rule so Claude can never read his .env file.

Why it matters

The mode sets the broad rule. Rules give exact control over each tool.

Definition

A permission rule tells Claude Code to allow a tool, ask about it, or deny it. A rule names a tool and can add a pattern, such as Bash(npm test) or Read(./.env). Rules live in the permissions block of a settings file, and /permissions lets you see and change them. They are checked in a fixed order: deny first, then ask, then allow. The first rule that matches decides.

Example code

json
{"permissions": {"allow": ["Bash(npm test)"], "deny": ["Read(./.env)"]}}
Allow the test command. Never read the secrets file.
Deny, then ask, then allow. The first match decides.

Common mistake

Expecting allow to beat deny. Deny is checked first, so a deny rule always wins.

Key takeaways

  1. 1
    Allow, ask, deny. Three kinds.
  2. 2
    Tool and pattern. Bash(npm test).
  3. 3
    Deny first. First match wins.

Compare

Learn it properly