Agent skill · Audited from source

git-guardrails-claude-code

skill · vinvcn/mattpocock-skills-zh-cnMIT licenceAudited 29 Oct 2026 · source 72a124f48772

★ 5,389pushed today
✓SAFEGrade B · 89/100 · 29 Oct 2026 · 72a124f
5,389repo stars · whole vinvcn/mattpocock-skills-zh-cn

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 时。

Ask an AI about this pageGChatGPTCClaudePPerplexityGeGeminiXGrok
More
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

Trust score89/100✓SAFE B
0 critical0 high0 medium0 low0 info

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

LayerWhat we checkResultFindings
L0 ProvenanceRepo owner, licence, archive status, activityPASS0
L1 Static sourceSecrets, path traversal, supply chain, hidden codePASS0
L2 InstructionsPrompt injection, authority framing, hidden directivesPASS0
L3 InventoryThe files and declarations match the sourcePASS0
L4 SandboxRun in isolation and watch behaviourSKIPPED why0

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

Download folder ↗
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

AgentStatusMore
Claude CodeMentioned in its text, not testedSkills for Claude Code · About Claude Code
“Mentioned” means the skill’s text names the agent. We have not run it there.

Audit history

Every audit, every source change

  1. ✓SAFE B 89 / 100

    first audit · source 72a124f48772

README badge

For maintainers · shows the latest audit

ModelsAtlas: SAFE BMODELSATLASSAFE · B
[![ModelsAtlas: SAFE B](https://modelsatlas.com/skills/vinvcn/git-guardrails-claude-code/badge.svg)](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.

edit-article✓SAFE

vinvcn/mattpocock-skills-zh-cn

将 mattpocock/skills 的内容翻译、刷新或复核到简体中文本地化仓库 vinvcn/mattpocock-skills-zh-CN 时使用这个项目级 skill。适用于 skill files、README content、CLAUDE.md、GLOSSARY.md、docs,以及其他需要保留行为关键 identifiers 的上游用户可见内容。

★ 5.4kGrade B
domain-modeling✓SAFE

vinvcn/mattpocock-skills-zh-cn

构建并打磨项目的领域模型。适用于讨论 codebase 术语、编写或编辑 GLOSSARY.md,或记录或编辑 ADR。

★ 5.4kGrade B
diagnosing-bugs✓SAFE

vinvcn/mattpocock-skills-zh-cn

面向棘手缺陷和性能回退的诊断循环。适用于用户说 “diagnose” / “debug this”,或报告某些东西 broken、throwing、failing、slow 时。

★ 5.4kGrade B
codebase-design✓SAFE

vinvcn/mattpocock-skills-zh-cn

用于设计深模块的共享词汇。适用于用户想设计或改进模块接口、寻找深化机会、决定 seam 放在哪里、让代码更容易测试或更适合 AI 导航,或其他技能需要深模块词汇时。

★ 5.3kGrade B
code-review✓SAFE

vinvcn/mattpocock-skills-zh-cn

从固定点(commit、branch、tag 或 merge-base)开始,按 Standards(代码是否符合本仓库记录的编码标准?)和 Spec(代码是否符合来源 issue/spec 的要求?)两个轴线审查变更。两个审查会在并行子代理中运行,并并排报告。适用于用户想审查 branch、PR、进行中的变更,或要求“review since X”时。

★ 5.3kGrade B
claude-handoff✓SAFE

vinvcn/mattpocock-skills-zh-cn

把当前对话交接给一个全新的 background agent,让它立即接手工作。

★ 5.2kGrade B

Add this badge to your README

[![ModelsAtlas: SAFE B](https://modelsatlas.com/skills/vinvcn/git-guardrails-claude-code/badge.svg)](https://modelsatlas.com/skills/vinvcn/git-guardrails-claude-code/)

Questions about git-guardrails-claude-code

What does the git-guardrails-claude-code skill do?
Matt Pocock skills 的简体中文本地化:人工审核每一次更新,定期同步上游,支持 Claude、Codex 和 DSH 插件。
Is git-guardrails-claude-code safe to install?
The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean skill reads B.
What can git-guardrails-claude-code access on my machine?
The audit observed no filesystem, network or shell use at all in its source.
Which assistants does git-guardrails-claude-code work with?
Its documentation mentions claude-code. That is what the text claims, not a compatibility test we ran.
How current is this page?
The grade is for one exact copy of the source (72a124f48772), read on 2026-10-29. The repository is watched, and a new audit runs when it changes — this is the first audit.

Sources

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.