jupes/agent-forge-harness / .agents/skills/git-guardrails-claude-code
git-guardrails-claude-code
VerifiedInstall or review a Claude Code hook for blocking selected Git commands. Use when the user requests Git safety guardrails.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.6 KB |
| references/block-dangerous-git.sh.md | markdown | 1.8 KB |
references/block-dangerous-git.sh.md
View on GitHub# block-dangerous-git.sh Reference
This is a non-executable reference copy of the upstream `block-dangerous-git.sh` hook script for the `git-guardrails-claude-code` skill.
Do not place this markdown file in Claude Code hook settings. If the user explicitly asks to install the guardrail, copy only the shell script content into the chosen hook path and make that copied `.sh` file executable.
## Script
```bash
#!/bin/bash
INPUT=$(cat)
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command')
DANGEROUS_PATTERNS=(
"git push"
"git reset --hard"
"git clean -fd"
"git clean -f"
"git branch -D"
"git checkout \."
"git restore \."
"push --force"
"reset --hard"
)
for pattern in "${DANGEROUS_PATTERNS[@]}"; do
if echo "$COMMAND" | grep -qE "$pattern"; then
echo "BLOCKED: '$COMMAND' matches dangerous pattern '$pattern'. The user has prevented you from doing this." >&2
exit 2
fi
done
exit 0
```
## Hook input shape
The script reads a Claude Code hook payload from stdin and extracts:
```json
{
"tool_input": {
"command": "git push origin main"
}
}
```
The script depends on `jq` for JSON parsing and `grep -E` for pattern matching.
## Verification examples
Blocked command:
```bash
echo '{"tool_input":{"command":"git push origin main"}}' | .claude/hooks/block-dangerous-git.sh
```
Expected behavior:
- Exits with code `2`
- Prints `BLOCKED: 'git push origin main' matches dangerous pattern 'git push'. The user has prevented you from doing this.` to stderr
Allowed command:
```bash
echo '{"tool_input":{"command":"git status --short"}}' | .claude/hooks/block-dangerous-git.sh
```
Expected behavior:
- Exits with code `0`
- Prints no block message
## Customization notes
Edit `DANGEROUS_PATTERNS` in the installed script copy to match the user's policy. Keep broad destructive defaults unless the user explicitly requests a narrower set.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |