AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Git Guardrails

skill-canvas-xxx-agent-skills-git-guardrails · by ntwrcht

Installs Claude Code PreToolUse hooks that block dangerous git commands before execution. Use when setting up local or global guardrails for git push, force push, reset --hard, clean, branch deletion, checkout ., or restore .

No reviews yet
0 installs
35 views
0.0% view→install

Install

$ agentstack add skill-canvas-xxx-agent-skills-git-guardrails

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No 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.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-canvas-xxx-agent-skills-git-guardrails)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Git Guardrails? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

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 -f and git clean -fd.
  • git branch -D.
  • git checkout ..
  • git restore ..

Workflow

  1. Choose scope. Ask for project-only .claude/settings.json or global ~/.claude/settings.json unless the user already specified it.
  2. Copy the hook. Use [scripts/block-dangerous-git.sh](scripts/block-dangerous-git.sh). Copy it to .claude/hooks/block-dangerous-git.sh for project scope or ~/.claude/hooks/block-dangerous-git.sh for global scope.
  3. Make it executable. Run chmod +x .
  4. Merge settings. Add a hooks.PreToolUse entry with matcher Bash and command pointing at the hook. Keep existing hooks and settings.
  5. Customize if requested. Edit the copied script only for requested additions or removals.
  6. Verify. Pipe a blocked command payload into the hook and confirm exit code 2 with a BLOCKED: 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.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.