Permission Rules - Claude Code
Granular allow/ask/deny rules per tool with wildcard patterns.
Permission rules are how you codify "yes, always run pnpm test" and "no, never touch this directory" without answering prompts each session.
What it does
Each rule pairs a tool pattern with an action: allow, ask, or deny. Patterns can match Bash commands, file paths, MCP servers, and more - with wildcards for flexibility. Rules live in settings.json (project-level) or settings.local.json (per-user) and combine with admin-managed rules for teams.
When to use it
- Allowlisting common commands (
npm run *,git status,ls *). - Denying sensitive paths (production config, secret files).
- Locking Claude to a specific MCP server for a given project.
- Building up a session-to-session baseline of trusted patterns.
Gotchas
- Order matters. More specific rules should come before broad ones.
- Wildcards can over-grant. Audit your allow list periodically.
- Project rules commit to the repo, so don't put user-specific prefs there. Use
settings.local.json.
Official docs: https://code.claude.com/docs/en/permissions.md
Technical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools - delivered free every week.
Was this helpful?




