Hook

Pre-Bash Git Safety

Block dangerous git operations without explicit confirmation.

安裝

manual
add to ~/.claude/settings.json hooks.PreToolUse

把這段加入 Claude Code MCP 設定,或直接透過 CLI 執行。

介紹

PreToolUse hook on Bash. Blocks force push without --force-with-lease, reset --hard, branch -D, and rm -rf in dangerous paths.

常見使用情境

  • Prevent destroying main
  • Catch reset --hard
  • Block rm -rf home

標籤

securitygitsafety