Agent skill · Audited from source
git-guardrails-claude-code
skill · vinvcn/mattpocock-skills-zh-cnMIT licenceAudited 29 Oct 2026 · source 72a124f48772
Is it safe? Yes — SAFE, grade B (89/100). We read this skill's source at commit 72a124f48772 and found no filesystem, network or shell access and no hard-coded secrets. What it does: 设置 Claude Code hooks,在危险 git commands(push、reset --hard、clean、branch -D 等)执行前阻止它们。适用于用户想防止破坏性 git 操作、添加 git safety hooks,或在 Claude Code 中阻止 git push/reset 时。
Cite
Cite this page
ModelsAtlas. “git-guardrails-claude-code (vinvcn/mattpocock-skills-zh-cn)”. Retrieved 29 Oct 2026. https://modelsatlas.com/skills/vinvcn/git-guardrails-claude-code
Trust audit
Audit 0.4.1 · source read 29 Oct 2026
SAFE means nothing in the source contradicts what the skill says it does. Grade B is shared by 13,985 of 14,816 audited skills.
What the source does
- FilesystemNone observedNo reads or writes in the source
- NetworkNone observedNo outbound calls in the source
- ShellNone observedNo commands run in the source
- DependenciesPinnedNothing floats
- SecretsNone foundNo keys in source
Five audit layers
| Layer | What we check | Result | Findings |
|---|---|---|---|
L0 Provenance | Repo owner, licence, archive status, activity | PASS | 0 |
L1 Static source | Secrets, path traversal, supply chain, hidden code | PASS | 0 |
L2 Instructions | Prompt injection, authority framing, hidden directives | PASS | 0 |
L3 Inventory | The files and declarations match the source | PASS | 0 |
L4 Sandbox | Run in isolation and watch behaviour | SKIPPED why | 0 |
Gates applied: no behavioural pass.
Findings (0)
No findings at any severity. We re-audit when the source changes.
Audit 0.4.1 · source sha 72a124f48772 · 29 Oct 2026Report an issue or request a re-scan
Provenance
Who published it, and what the verdict is pinned to
- Publishervinvcn GitHub userOwner of the repository this skill is read from
- Source foldervinvcn/mattpocock-skills-zh-cn/skills/misc/git-guardrails-claude-codeThe exact folder we audited
- LicenceMITAs the repository states it
- Commit pinned for this verdict72a124f48772A new audit runs when the source changes
- Repository statusNot archivedPushed today
- Sandboxed runNot runSkills are read, not executed; layer L4 is skipped
What it tells the agent
Full source on GitHub ↗Its description: 设置 Claude Code hooks,在危险 git commands(push、reset --hard、clean、branch -D 等)执行前阻止它们。适用于用户想防止破坏性 git 操作、添加 git safety hooks,或在 Claude Code 中阻止 git push/reset 时。
---
name: git-guardrails-claude-code
description: 设置 Claude Code hooks,在危险 git commands(push、reset --hard、clean、branch -D 等)执行前阻止它们。适用于用户想防止破坏性 git 操作、添加 git safety hooks,或在 Claude Code 中阻止 git push/reset 时。
---
# 设置 Git Guardrails
设置一个 PreToolUse hook,在 Claude 执行危险 git commands 前拦截并阻止它们。
## 会被阻止的命令
- `git push`(包括 `--force` 在内的所有 variants)
- `git reset --hard`
- `git clean -f` / `git clean -fd`
- `git branch -D`
- `git checkout .` / `git restore .`
被阻止时,Claude 会看到一条 message,说明它无权访问这些 commands。
## 步骤
### 1. 询问安装范围
询问用户:只为**当前 project** 安装(`.claude/settings.json`),还是为**所有 projects** 安装(`~/.claude/settings.json`)?
### 2. 复制 hook 脚本
bundled script 位于:[scripts/block-dangerous-git.sh](scripts/block-dangerous-git.sh)
根据 scope 复制到目标位置:
- **Project**: `.claude/hooks/block-dangerous-git.sh`
- **Global**: `~/.claude/hooks/block-dangerous-git.sh`
用 `chmod +x` 让它可执行。
### 3. 把 hook 加入 settings
添加到对应 settings file:
**Project** (`.claude/settings.json`):
```json
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}
```
**Global** (`~/.claude/settings.json`):
```json
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "~/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}
```
如果 settings file 已存在,把 hook merge 到现有 `hooks.PreToolUse` array 中,不要覆盖其他 settings。
### 4. 询问是否定制
询问用户是否要在 blocked list 中添加或移除 patterns。相应编辑复制后的 script。
### 5. 验证
运行快速测试:
```bash
echo '{"tool_input":{"command":"git push origin main"}}' | <path-to-script>
```
应以 code 2 退出,并向 stderr 打印 BLOCKED message。Excerpt, first 1,841 characters of SKILL.md, verbatim from the audited commit. It is text from someone else’s repository, quoted so you can judge it before your agent reads it.
Install
Pinned to the audited commit 72a124f
git clone https://github.com/vinvcn/mattpocock-skills-zh-cn git -C mattpocock-skills-zh-cn checkout 72a124f48772
The author documents no install command, so this uses the repository directly. Our verdict covers commit 72a124f48772 only.
Works in which agents?
What its own text says, not a test
| Agent | Status | More |
|---|---|---|
| Claude Code | Mentioned in its text, not tested | Skills for Claude Code · About Claude Code |
Audit history
Every audit, every source change
- ✓SAFE B 89 / 100
first audit · source
72a124f48772
README badge
For maintainers · shows the latest audit
[](https://modelsatlas.com/skills/vinvcn/git-guardrails-claude-code/)
The badge shows our verdict and grade for this skill, and links back to this page. It changes when the audit does.
Similar skills
All coding & review skills →vinvcn/mattpocock-skills-zh-cn
将 mattpocock/skills 的内容翻译、刷新或复核到简体中文本地化仓库 vinvcn/mattpocock-skills-zh-CN 时使用这个项目级 skill。适用于 skill files、README content、CLAUDE.md、GLOSSARY.md、docs,以及其他需要保留行为关键 identifiers 的上游用户可见内容。
vinvcn/mattpocock-skills-zh-cn
构建并打磨项目的领域模型。适用于讨论 codebase 术语、编写或编辑 GLOSSARY.md,或记录或编辑 ADR。
vinvcn/mattpocock-skills-zh-cn
面向棘手缺陷和性能回退的诊断循环。适用于用户说 “diagnose” / “debug this”,或报告某些东西 broken、throwing、failing、slow 时。
vinvcn/mattpocock-skills-zh-cn
用于设计深模块的共享词汇。适用于用户想设计或改进模块接口、寻找深化机会、决定 seam 放在哪里、让代码更容易测试或更适合 AI 导航,或其他技能需要深模块词汇时。
vinvcn/mattpocock-skills-zh-cn
从固定点(commit、branch、tag 或 merge-base)开始,按 Standards(代码是否符合本仓库记录的编码标准?)和 Spec(代码是否符合来源 issue/spec 的要求?)两个轴线审查变更。两个审查会在并行子代理中运行,并并排报告。适用于用户想审查 branch、PR、进行中的变更,或要求“review since X”时。
vinvcn/mattpocock-skills-zh-cn
把当前对话交接给一个全新的 background agent,让它立即接手工作。
Add this badge to your README
[](https://modelsatlas.com/skills/vinvcn/git-guardrails-claude-code/)
<a href="https://modelsatlas.com/skills/vinvcn/git-guardrails-claude-code/"><img src="https://modelsatlas.com/skills/vinvcn/git-guardrails-claude-code/badge.svg" alt="ModelsAtlas: SAFE B"></a>
Questions about git-guardrails-claude-code
What does the git-guardrails-claude-code skill do?
Is git-guardrails-claude-code safe to install?
What can git-guardrails-claude-code access on my machine?
Which assistants does git-guardrails-claude-code work with?
How current is this page?
Sources
- github.com/vinvcn/mattpocock-skills-zh-cn/tree/main/skills/misc/ — the audited source at commit 72a124f48772 and every finding aboveObserved · 29 Oct 2026
Spotted something wrong? Report a correction · Methodology
Keep going in your AI
Opens with this page as the source. We add nothing else to the prompt.
- What does the git-guardrails-claude-code skill do?
- Is git-guardrails-claude-code safe to install?
- What can git-guardrails-claude-code access on my machine?