Individual skill
git-guardrails-claude-code
设置 Claude Code 钩子,在危险 Git 命令(push、reset --hard、clean、branch -D 等)执行前将其拦截。当用户想要防止破坏性 Git 操作、添加 Git 安全钩子或在 Claude Code 中阻止 git push/reset 时使用。
skills/misc/git-guardrails-claude-code/SKILL.md
Source commit 30fc5dbf9380144598f3593e6c1e22c713a52c2a
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- No
- Repository scan complete
- No
- Skill scan complete
- No
- Observed behavior
- Not checked yet
- Last checked
- Nov 7, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 533
- Repository last updated
- Nov 3, 2026
- License
- MIT
Observed agent integration: No specific integration evidence. Standard SKILL.md installation does not imply verified compatibility.
- ai-agent Repository topic
- chinese Repository topic
- prompt-engineering Repository topic
- skills Repository topic
- translation Repository topic
- engineering Derived category
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
SKILL.mdcore · 2,372 bytesSKILL.mdcore · 2,372 bytesagents/openai.yamlasset · 110 bytesscripts/block-dangerous-git.shruns · 507 bytes
Read excerpt
# 设置 Git 护栏
设置一个 PreToolUse 钩子,在 Claude 执行危险 Git 命令之前拦截并阻止它们。
## 会被阻止的命令
- `git push`(包括 `--force` 在内的所有变体)
- `git reset --hard`
- `git clean -f` / `git clean -fd`
- `git branch -D`
- `git checkout .` / `git restore .`
当命令被阻止时,Claude 会看到一条消息,告知它没有权限访问这些命令。