[DOCS] Add 'allow + hooks' pattern to hooks documentation

Resolved 💬 2 comments Opened Mar 21, 2026 by yurukusa Closed Mar 22, 2026

Documentation improvement: "allow + hooks" pattern for selective permission control

Problem

Users frequently report that allow and ask permissions conflict (#6527, 94 reactions). The workaround — using allow for all commands and PreToolUse hooks for selective blocking — is well-established but not documented.

Proposed addition

Add a section to https://code.claude.com/docs/en/hooks under "Common patterns" explaining:

{
  "permissions": { "allow": ["Bash(*)"] },
  "hooks": {
    "PreToolUse": [{
      "matcher": "Bash",
      "hooks": [{ "type": "command", "command": "~/.claude/hooks/safety-guard.sh" }]
    }]
  }
}

This pattern gives users:

  • Fast execution (no permission prompts for safe commands)
  • Hard blocks on dangerous commands (exit code 2)
  • No conflict between allow and ask

Evidence

I've answered 34 GitHub Issues this week where this pattern was the solution:

  • #6527 (allow+ask conflict, 94 reactions)
  • #36873 (wildcard matching)
  • #36884 (Edit/Write on Windows)
  • #36900 (git -C flag)
  • #36920 (CLAUDE.md enforcement)
  • #36970 (pipeline guardrail skip)

Impact

This would reduce the volume of permission-related issues significantly.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗