git-safety

git-safety is a skill for Claude Code from VoidTechnology/voidtech-claude-plugins. It costs 61 tokens per session (908 once invoked), scanned B, original, Apache-2.0.

A setup guide for Git safety hooks that stop selected risky Git commands before they run. Git is a version-control system; these commands can publish changes, erase uncommitted work, or delete branches and files.

In plain words
What is it for?
It is for installing and configuring pre-command checks that block dangerous Git operations while preserving existing hook settings.
Why use it?
It adds a review point before operations such as pushing, hard resets, cleaning files, or deleting branches. The guide supports project-level or user-wide installation for Claude Code or OMP.

Skill for Claude Code

Written for Claude Code: ${CLAUDE_PLUGIN_ROOT} variable. Also seen: reads .claude/ paths; mentions Claude Code.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the voidtech-engineering plugin — 14 skills, 1 agent shipped together

Good fit It is for installing and configuring pre-command checks that block dangerous Git operations while preserving existing hook settings.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add VoidTechnology/voidtech-claude-plugins
Claude Code
/plugin install voidtech-engineering

Made for: Claude Code.

Or install voidtech-engineering, the plugin that ships this one along with the rest of its 14 skills, 1 agent.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for git-safety

README.md
[![agentmods](https://agentmods.dev/badge/skills/voidtechnology/voidtech-claude-plugins/git-safety/github.svg)](https://agentmods.dev/skills/voidtechnology/voidtech-claude-plugins/git-safety)
Your own site
<a href="https://agentmods.dev/skills/voidtechnology/voidtech-claude-plugins/git-safety"><img src="https://agentmods.dev/badge/skills/voidtechnology/voidtech-claude-plugins/git-safety/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for git-safety

Your own site · 80×15
<a href="https://agentmods.dev/skills/voidtechnology/voidtech-claude-plugins/git-safety"><img src="https://agentmods.dev/badge/skills/voidtechnology/voidtech-claude-plugins/git-safety.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 908 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00061 $0.00908
Opus 5.5 $0.00024 $0.00363
Sonnet 5.5 $0.00012 $0.00182
Haiku 4.5 $0.00006 $0.00091

Measured 1mo ago against content hash f7a185469091, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

git-safety scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/block-dangerous-git-omp.mjs, scripts/block-dangerous-git.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

| Claude Code | `.claude/settings.json` + `.claude/hooks/` | `~/.claude/settings.json` + `~/.claude/hooks/` |
plugins/voidtech-engineering/skills/git-safety/SKILL.md · 84 lines

How it starts

The opening of the file, as written. The whole thing — 84 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Vendored from mattpocock/skills · MIT © 2026 Matt Pocock · upstream 6eeb81b · 已汉化并完成 VoidTech 插件内自包含适配。LICENSE 见 ../_vendor-licenses/mattpocock-LICENSE

配置 Git 安全钩子

为当前宿主配置执行前钩子,拦截并阻止危险 Git 命令。只安装用户选择的作用范围,不默认写入全局配置。

会被拦截的命令

  • git push(所有变体,包括 --force)
  • git reset --hard
  • git clean -f / git clean -fd
  • git branch -D
  • git checkout . / git restore .

命令被拦截时,agent 会收到一条消息,说明该操作不在授权范围内。

步骤

1. 询问作用范围

询问用户仅为当前项目安装,还是为所有项目安装。目标位置取决于宿主:

宿主 项目级 全局级
Claude Code .claude/settings.json + .claude/hooks/ ~/.claude/settings.json + ~/.claude/hooks/
OMP .omp/hooks/pre/block-dangerous-git.mjs ~/.omp/agent/hooks/pre/block-dangerous-git.mjs

2. 安装当前宿主的钩子

Claude Code

随附脚本位于 scripts/block-dangerous-git.sh。使用 ${CLAUDE_PLUGIN_ROOT}/skills/git-safety/scripts/block-dangerous-git.sh 作为源路径,复制到所选范围的 hooks/,并执行 chmod +x。

把 command hook 合并进所选 settings.json 的 hooks.PreToolUse 数组,不得覆盖已有设置:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-dangerous-git.sh"
          }
        ]
      }
    ]
  }
}

全局级只把 command 改为 "\"$HOME\"/.claude/hooks/block-dangerous-git.sh"。

OMP

通过 skill://git-safety/scripts/block-dangerous-git-omp.mjs 读取随附的 OMP Extension Hook,并把内容原样写入用户选择的目标文件。不要从 OMP 插件缓存猜路径,不要修改插件安装目录。OMP 按约定自动发现 hooks/pre/*.mjs,无需额外 settings 项;新钩子从下次会话开始生效。

3. 询问是否定制

询问用户是否要添加或移除拦截模式;只编辑复制后的文件,不修改插件随附模板。

4. 验证

Claude Code 先确认 jq 可用,再用危险命令 fixture 验证退出码 2:

echo '{"tool_input":{"command":"git push origin main"}}' | <path-to-script>

OMP 直接导入复制后的模块并验证危险命令被识别、只读命令被允许:

node --input-type=module -e "import { isDangerousGitCommand as blocked } from '<path-to-hook>'; if (!blocked('git push origin main') || blocked('git status')) process.exit(1)"

Read the full file on GitHub · 84 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 84 lines · 61 tokens per session scan B f7a185469091

Subscribe to this mod's changes

git-safety is a skill published in the GitHub repository VoidTechnology/voidtech-claude-plugins (2 stars, last pushed 5d ago), licensed Apache-2.0. It adds 61 tokens to every session and 908 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories