CtrlK
BlogDocsLog inGet started
Tessl Logo

git-guardrails-claude-code

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.

97

1.19x
Quality

96%

Does it follow best practices?

Impact

100%

1.19x

Average score across 3 eval scenarios

SecuritybySnyk

The risk profile of this skill

The canonical home for this skill is git-guardrails-claude-code in mattpocock/skills

SKILL.md
Quality
Evals
Security

Evaluation results

100%

Add Git Safety Guardrails to a Developer Workstation

Global-scoped setup with settings merge

Criteria
Without this skill
With this skill

Script in global hooks dir

100%

100%

Global settings file used

100%

100%

Tilde path in command

100%

100%

PreToolUse array merged

100%

100%

Existing memory setting preserved

100%

100%

Existing formatter hook preserved

100%

100%

Bash matcher used

100%

100%

Command type field

100%

100%

Script executable

100%

100%

Merged contents logged

100%

100%

100%

26%

Protect a Shared Repository from Accidental Destructive Git Commands

Project-scoped hook setup and verification

Criteria
Without this skill
With this skill

Script in hooks dir

0%

100%

Script executable

100%

100%

PreToolUse hook key

100%

100%

Bash matcher

100%

100%

Command type field

100%

100%

CLAUDE_PROJECT_DIR in path

0%

100%

Verification command shown

100%

100%

Exit code 2 observed

100%

100%

BLOCKED in stderr

100%

100%

Settings file path correct

100%

100%

100%

22%

Tailored Git Safety Hook for a Regulated Repository

Custom blocked patterns and script editing

Criteria
Without this skill
With this skill

git tag -d added

100%

100%

git stash drop added

100%

100%

git push removed

71%

100%

Script in hooks dir

25%

100%

Script executable

33%

100%

Settings file written

100%

100%

Blocked pattern test shown

100%

100%

Allowed pattern test shown

100%

100%

CLAUDE_PROJECT_DIR in command

0%

100%

Script contents logged

100%

100%

Repository
SnowingFox/ai-skills
Evaluated
Agent
Claude Code
Model
Claude Sonnet 4.6

Table of Contents

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.