/i:git-guardrails-claude-codefrom i
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
Ships in i. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Sets up a PreToolUse hook that intercepts and blocks dangerous git commands before Claude executes them.
git push (all variants including --force)git reset --hardgit clean with -f / --force (any cluster, e.g. -xdf)git branch -D, and --delete combined with --forcegit checkout . / git restore . (any whole-tree pathspec: ., :/, *)git -c alias.<x>=… — an on-the-fly alias that could hide any of the aboveThe hook parses the command the way a shell would rather than searching for a string, so:
git -C . push, sudo git push, env X=1 git push,
/usr/bin/git push, cd x && git push, echo $(git push), sh -c "git push", eval "git push",
and $(git push) inside an unquoted heredoc are all blocked.echo "git push", git log --grep "git push", a quoted heredoc that
writes a script containing git push, and git clean -n are all allowed.python3 missing, unreadable or malformed input, an unexpected crash — exits 2
and blocks. A repo where the hook cannot run is a repo where no Bash command runs until it's fixed
or the hook is removed on purpose.When blocked, Claude sees a message naming what the command would have done, saying the user has prevented it, and telling it not to work around the block.
Say this to the user when installing; it's what decides whether they also need branch protection:
./deploy.sh), or a Makefile / package.json script that does.~/.gitconfig (git p where p = push).$GIT push, $CMD).Bash tool.It is a guardrail against mistakes by an agent, not a security boundary. Protected branches on the remote are the boundary.
bash and python3 on PATH. No jq.
Ask the user: install for this project only (.claude/settings.json) or all projects (~/.claude/settings.json)?
The bundled script is at: scripts/block-dangerous-git.sh
Copy it to the target location based on scope:
.claude/hooks/block-dangerous-git.sh~/.claude/hooks/block-dangerous-git.shMake it executable with chmod +x.
Add to the appropriate settings file:
Project (.claude/settings.json):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}
Global (~/.claude/settings.json):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "~/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}
If the settings file already exists, merge the hook into the existing hooks.PreToolUse array. Don't overwrite other settings.
Ask if the user wants to add or remove anything from the blocked list. The rules live in the
check_git function of the copied script, one if sub == ... block per subcommand; each returns the
reason string Claude will see. Add or remove a block there — don't reintroduce a string match on the
raw command, which is what this script exists to avoid.
Run the bundled self-test against the copied script — it drives the hook with 46 bypass attempts, 28 ordinary commands, and malformed inputs, and fails on any mismatch:
cp <this-skill>/scripts/test-block-dangerous-git.py <hook-dir>/
python3 <hook-dir>/test-block-dangerous-git.py
Then spot-check the three behaviours by hand:
H=<path-to-script>
echo '{"tool_input":{"command":"git -C . push"}}' | bash $H; echo "rc=$? (want 2)"
echo '{"tool_input":{"command":"echo \"git push\""}}' | bash $H; echo "rc=$? (want 0)"
echo 'not json' | bash $H; echo "rc=$? (want 2: fails closed)"
If the user customised the pattern list in step 4, add a case for each change to the test file before trusting it.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub intuscare/intus-skills --plugin i39 skills in this plugin
/builditTake a Jira ticket key from branch to pushed branch in one pass: /i:workon, /i:test-first, /i:ncommit, /i:implement, /i:ncommit, /i:push. Use when asked to build / do / take on a ticket end to end./claude-handoffHand the current conversation off to a fresh background agent that picks up the work immediately./codebase-designShared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.Other plugins' skills for the same job