Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add devcxl/mattpocock-skills-zh --skill git-guardrails-claude-codegit clone --depth 1 https://github.com/devcxl/mattpocock-skills-zhWrote 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.
[](https://agentmods.dev/skills/devcxl/mattpocock-skills-zh/git-guardrails-claude-code)<a href="https://agentmods.dev/skills/devcxl/mattpocock-skills-zh/git-guardrails-claude-code"><img src="https://agentmods.dev/badge/skills/devcxl/mattpocock-skills-zh/git-guardrails-claude-code/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.
<a href="https://agentmods.dev/skills/devcxl/mattpocock-skills-zh/git-guardrails-claude-code"><img src="https://agentmods.dev/badge/skills/devcxl/mattpocock-skills-zh/git-guardrails-claude-code.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector warn
SkillSpector: 3 findings, up to high
These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →
- high Tool Misuse · line 13 Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
- high Agent Snooping · line 24 Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.Fix: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variabl
- high Agent Snooping · line 61 Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.Fix: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variabl
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00075 | $0.00671 |
| Opus 5 | $0.00037 | $0.00336 |
| Sonnet 5 | $0.00015 | $0.00134 |
| Haiku 4.5 | $0.00007 | $0.00067 |
Grade B, and why
git-guardrails-claude-code 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 10d ago.
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/settings.json`),还是**所有项目**安装(`~/.claude/settings.json`)? What it actually says
设置 Git 护栏
设置一个 PreToolUse 钩子,在 Claude 执行危险 Git 命令之前拦截并阻止它们。
会被阻止的命令
git push(包括--force在内的所有变体)git reset --hardgit clean -f/git clean -fdgit branch -Dgit checkout ./git restore .
当命令被阻止时,Claude 会看到一条消息,告知它没有权限访问这些命令。
步骤
1. 询问安装范围
询问用户:是仅针对当前项目安装(.claude/settings.json),还是所有项目安装(~/.claude/settings.json)?
2. 复制钩子脚本
打包的脚本位于:scripts/block-dangerous-git.sh
根据安装范围将其复制到目标位置:
- 项目级:
.claude/hooks/block-dangerous-git.sh - 全局:
~/.claude/hooks/block-dangerous-git.sh
使用 chmod +x 使其可执行。
3. 将钩子添加到设置文件
添加到相应的设置文件中:
项目级(.claude/settings.json):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}
全局(~/.claude/settings.json):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "~/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}
如果设置文件已存在,将钩子合并到现有的 hooks.PreToolUse 数组中:不要覆盖其他设置。
4. 询问自定义
询问用户是否需要从阻止列表中添加或移除任何模式。根据需求编辑已复制的脚本。
5. 验证
运行一个快速测试:
echo '{"tool_input":{"command":"git push origin main"}}' | <path-to-script>
应退出并返回代码 2,并向 stderr 打印一条 BLOCKED 消息。
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.
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.
- 10d ago First seen · 96 lines · 75 tokens per session scan B 2299fe72bcce
git-guardrails-claude-code is a skill published in the GitHub repository devcxl/mattpocock-skills-zh (331 stars, last pushed 5d ago), licensed MIT. It adds 75 tokens to every session and 671 once invoked, about $0.0004 per session on Opus 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-30.
Other skills, from other repositories
chinese-git-workflow
A reference for configuring Git with Chinese code-hosting services such as Gitee, Coding.net, GitLab China, and CNB, including SSH, HTTPS, credentials, CI, and repository mirroring.
chinese-commit-conventions
A Chinese-language guide to Conventional Commits, a format for writing consistent Git commit messages, plus related changelog, commit-checking, and commit-helper configuration.
using-git-worktrees
A guide to using Git worktrees, which let you keep multiple branches in separate folders at the same time.
finishing-a-development-branch
A process for finishing a completed development branch. A branch is a separate line of code changes that can later be merged or submitted as a pull request.
dsh-git-commit
A Git commit guide for writing standardised commit messages and performing basic checks before committing code. Git commits are saved checkpoints in a project’s history.
dsh-changelog
A release-note writing guide for maintaining a CHANGELOG, a file that records what changed in each software version. It follows Keep a Changelog categories and semantic versioning rules.