Install
$ agentstack add skill-canvas-xxx-agent-skills-git-guardrails ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Git Guardrails for Claude Code
Set up a Claude Code PreToolUse hook that blocks high-risk git commands before Claude executes them.
When to Use
Use this skill when the user wants Claude Code git safety hooks, local project guardrails, global guardrails, or protection from destructive commands such as push, force push, hard reset, clean, branch deletion, checkout dot, or restore dot.
This skill installs Claude Code hooks only. For ordinary repository policy, server-side git hooks, GitHub branch protection, or CI rules, provide separate guidance.
Artifacts
- Produces:
.claude/settings.json(hook entries merged in) - Consumes: nothing
Core Rule
Preserve existing Claude settings. Merge hook entries; never overwrite unrelated settings, hooks, or user scripts.
Blocked Commands
The bundled hook blocks:
git push, including force-push variants.git reset --hard.git clean -fandgit clean -fd.git branch -D.git checkout ..git restore ..
Workflow
- Choose scope. Ask for project-only
.claude/settings.jsonor global~/.claude/settings.jsonunless the user already specified it. - Copy the hook. Use [scripts/block-dangerous-git.sh](scripts/block-dangerous-git.sh). Copy it to
.claude/hooks/block-dangerous-git.shfor project scope or~/.claude/hooks/block-dangerous-git.shfor global scope. - Make it executable. Run
chmod +x. - Merge settings. Add a
hooks.PreToolUseentry with matcherBashand command pointing at the hook. Keep existing hooks and settings. - Customize if requested. Edit the copied script only for requested additions or removals.
- Verify. Pipe a blocked command payload into the hook and confirm exit code
2with aBLOCKED:stderr message.
Settings Snippets
Project command:
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-dangerous-git.sh"
Global command:
"command": "~/.claude/hooks/block-dangerous-git.sh"
Verification command:
printf '%s\n' '{"tool_input":{"command":"git push origin main"}}' |
Operating Rules
- Ask before choosing local versus global scope when unspecified.
- Read existing settings before editing them.
- Preserve unrelated JSON keys and hook entries.
- Do not weaken blocked patterns unless the user explicitly asks.
- Report the installed path, settings path, and verification result.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: ntwrcht
- Source: ntwrcht/blvck-skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.