/sir-albert:git-guardrailsfrom Sir Albert
Install a PreToolUse hook that blocks dangerous git commands before they execute — force pushes, hard resets, branch deletions, working-tree nukes, and more. Use this skill whenever the user asks to set up git safety rules, git guardrails, protect a repo from destructive git commands, or mentions wanting to prevent accidental git disasters. Also use when someone says "install git hooks", "block dangerous git", "safe git setup", or anything about preventing force push, hard reset, or accidental branch deletion in Claude Code.
Ships in Sir Albert. 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.
This skill installs a PreToolUse hook in Claude Code that intercepts Bash commands before execution and blocks dangerous git operations. Unlike prompt-level instructions (which Claude can occasionally ignore under pressure), hooks are a hard technical gate — the command physically cannot run.
The default blocklist covers the operations that most commonly cause irreversible damage when an AI assistant runs them without thinking:
| Pattern | Why it's dangerous |
|---|---|
git push | Pushes untested or unreviewed code; --force rewrites remote history |
git reset --hard | Destroys uncommitted work with no recovery path |
git clean -f | Permanently deletes untracked files |
git checkout . | Silently discards all unstaged changes |
git restore . | Same effect as checkout — wipes working tree changes |
git branch -D | Force-deletes a branch even if unmerged |
git stash drop | Permanently destroys a stash entry |
git rebase (on shared branches) | Rewrites history, causes havoc when pushed |
The hook matches these patterns using simple substring/prefix checks in a shell script, so it's fast and transparent — you can read exactly what it does.
When the user asks you to install git guardrails, follow these steps:
The hook can live in two places:
.claude/settings.json) — only affects this repo. Good for
trying it out or when different projects need different rules.~/.claude/settings.json) — protects every repo you work in.Ask the user which they prefer. Default to project-local if they don't have a preference.
Copy scripts/block-dangerous-git.sh to the target location:
.claude/hooks/block-dangerous-git.sh~/.claude/hooks/block-dangerous-git.shMake it executable:
chmod +x <path>/block-dangerous-git.sh
Add the PreToolUse hook entry to the chosen settings file. The hook fires on every Bash tool call and checks whether the command matches a blocked pattern.
For project-local (.claude/settings.json):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": ".claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}
For global (~/.claude/settings.json), use the absolute path:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "~/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}
If the settings file already exists and has other hooks, merge the new entry into
the existing PreToolUse array — don't overwrite what's already there.
After installation, print a summary:
Git guardrails installed!
Blocked commands:
- git push (all variants)
- git reset --hard
- git clean -f / -fd
- git checkout .
- git restore .
- git branch -D
- git stash drop
- git rebase (interactive and non-interactive)
Location: .claude/hooks/block-dangerous-git.sh
Settings: .claude/settings.json
To customize, edit the BLOCKED_PATTERNS array in the hook script.
Ask the user if they want to adjust the defaults:
git push from the blocklist entirely, or refine it
to only block git push --force and git push.*main.git merge --no-ff or
git tag -d or something project-specific.ALLOWED_PATTERNS
array. For example, you could block all git push but allow
git push origin feature/.Walk the user through editing the BLOCKED_PATTERNS and ALLOWED_PATTERNS
arrays in the shell script. The format is simple — one pattern per line, using
bash pattern matching (not regex).
The script receives the tool input as JSON on stdin. It extracts the command
field, then checks it against two lists:
ALLOWED_PATTERNS — checked first. If the command matches any allowed pattern, it passes through even if it also matches a blocked pattern. This is how you create exceptions (e.g., "block all pushes except to my feature branch").
BLOCKED_PATTERNS — checked second. If the command matches any blocked
pattern, the script exits with a JSON "decision": "block" response and
a human-readable reason. Claude sees the block message and knows it cannot
run that command.
If neither list matches, the command runs normally.
cat .claude/settings.json | python3 -m json.tool
to validate.block-dangerous-git.sh and check
the pattern matching. The script uses case statements with glob patterns,
so git push* matches git push origin main --force..bak) or
remove the hook entry from settings. Don't delete the script — you'll want
it back.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub gal-tab/sir_albert --plugin sir-albert42 skills in this plugin
/board-of-advisorsAssemble a virtual "Board of Advisors" offering 4 distinct perspectives on a problem, decision, or strategy. Use when the user asks for "board of advisors", "multiple perspectives", "evaluate this decision from different angles", or "4 points of view"./brainstormUse when exploring angles, sharpening thinking, attacking a plan, running a panel of advisors, drilling an idea with relentless questions, zooming out on context, designing a solution, or receiving a context dump asking for your opinion or a recommendation. Triggers on: "brainstorm this", "grill this", "attack this", "zoom out", "play devil's advocate", "let's design this", "board of advisors", "sharpen this", "stress test this", "find holes in this", "fresh perspective", "4 perspectives", "want to build X", "want to understand what's happening", "look at this and advise", "what's really going on here", "here's the situation"./buildOther plugins' skills for the same job