From chad-tools
Add branch protection hooks to the current repo. Blocks pushes to main/master and force pushes via Claude Code. Use when setting up a production repo or when the user says "protect this repo" or "add branch guardrails".
How this skill is triggered — by the user, by Claude, or both
Slash command
/chad-tools:protect-branchThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Add branch protection to the current repo's Claude Code config:
Add branch protection to the current repo's Claude Code config:
.claude/settings.json exists in the repo root.claude/settings.json with this content:{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "bash -c 'CMD=$(cat | jq -r \".tool_input.command // empty\"); if echo \"$CMD\" | grep -qE \"git push.*(main|master)\"; then echo \"BLOCKED: Use a feature branch and PR.\" >&2; exit 2; fi; if echo \"$CMD\" | grep -qE \"git push (-f|--force)\"; then echo \"BLOCKED: Force push requires explicit approval.\" >&2; exit 2; fi'"
}
]
}
]
}
}
npx claudepluginhub metcalfc/claude-plugin --plugin chad-toolsInstalls PreToolUse hooks that block destructive git/shell commands (force-push to protected branches, git reset --hard with unstaged work, rm -rf outside worktree). Useful before unattended runs or after a near-miss.
Sets up PreToolUse hooks in Claude Code to block dangerous git commands (push, reset --hard, clean, branch -D). Useful when you want to prevent accidental destructive git operations.
Installs PreToolUse hooks that block dangerous git commands (push, reset --hard, clean, branch -D, checkout ., restore .) before execution.