Claude CodeIntermediateClaude Code
A deny rule beats any permission mode
Switching modes does not protect your sensitive files; a deny rule does, because it applies even when the mode auto-approves everything.
Allow/deny rules stack on top of the chosen mode, and deny always wins over allow. Put them in .claude/settings.json (shared with the team) or in .claude/settings.local.json (personal, kept out of git). A deny at enterprise level (managed-settings.json) cannot be removed by any user or project.
Example
// .claude/settings.json
{
"permissions": {
"allow": ["Bash(npm run:*)"],
"deny": ["Read(.env.production)", "Bash(rm:*)", "Bash(git push:*)"]
}
}