Permission Rules: Syntax & Wildcards
While modes set the baseline, rules allow you to fine-tune exactly what Claude can and cannot do.
Basic Syntax
Rules follow the format Tool or Tool(specifier).
| Example | Matches |
|---|---|
Bash |
All Bash commands |
Bash(npm run build) |
Exactly that command |
Read(./.env) |
Reads the local .env file |
WebFetch(domain:example.com) |
Web fetches for that domain |
Wildcards
* can match one or more tokens.
Bash(npm run *): Matches anynpm runcommand.Bash(git * main): Matchesgit checkout main,git merge main, etc.Bash(ls*): Matchesls,lsof, andls -la.
Word Boundaries
Bash(ls *) vs Bash(ls*):
Bash(ls *)matchesls -la(note the space), but notlsof.Bash(ls*)matches both.
Note: For Bash rules, Claude automatically strips process wrappers like
timeout,nice, andnohupbefore matching.