Skip to main content
ClaudeWave
Skill822 repo starsupdated 5d ago

git-guardrails-claude-code

This Claude Code skill adds safety guardrails to potentially destructive Git operations like reset --hard, force push, and branch deletion. It intercepts risky commands, explains the specific dangers and data loss risks, and suggests safer alternatives while attempting to preserve uncommitted local work before allowing execution.

Install in Claude Code
Copy
git clone --depth 1 https://github.com/Haohao-end/openagent /tmp/git-guardrails-claude-code && cp -r /tmp/git-guardrails-claude-code/api/internal/core/skills/catalog/git-guardrails-claude-code ~/.claude/skills/git-guardrails-claude-code
Then start a new Claude Code session; the skill loads automatically.

skill.md

# git-guardrails

这是一个给危险 git 操作加护栏的技能。

## 适用场景

- 可能出现 `reset --hard`、`checkout --`、强制推送等操作
- 用户要求改历史、删分支或回退提交
- 需要先确认是否会破坏未保存工作

## 工作方式

1. 先判断命令是否不可逆。
2. 如果有破坏性,明确告知风险并给出更安全替代方案。
3. 尽量保留用户未完成的本地工作。