Not loaded · from mattpocock-skills
Installs a PreToolUse hook in Claude Code to block dangerous git commands (push, reset --hard, clean, branch -D) before execution, preventing accidental destructive operations.
Claude Code won't load this skill
It ships in mattpocock-skills at skills/, but Claude Code only loads skills/<name>/SKILL.md and folders listed under skills in plugin.json. Installing the plugin doesn't add it.
设置一个 PreToolUse 钩子,在 Claude 执行危险的 git 命令之前将其拦截并阻止。
git push(包括 --force 在内的所有变体)git reset --hardgit clean -f / git clean -fdgit branch -Dgit checkout . / git restore .被阻止时,Claude 会看到一条消息,告知它无权访问这些命令。
询问用户:只为当前项目安装(.claude/settings.json),还是为所有项目安装(~/.claude/settings.json)?
随附脚本位于:scripts/block-dangerous-git.sh
根据适用范围将其复制到目标位置:
.claude/hooks/block-dangerous-git.sh~/.claude/hooks/block-dangerous-git.sh用 chmod +x 赋予可执行权限。
添加到相应的设置文件:
项目级(.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 数组——不要覆盖其他设置。
询问用户是否想从阻止列表中添加或移除某些模式。相应地编辑复制后的脚本。
运行一个快速测试:
echo '{"tool_input":{"command":"git push origin main"}}' | <path-to-script>
应以退出码 2 退出,并向 stderr 打印一条 BLOCKED 消息。
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
git-hooks, dangerous-commands, pre-tool-use, safety, git-protection
35 skills in this plugin
/ask-matt询问哪个技能或流程适合你当前的情况。它是本仓库中各技能的路由器。/claude-handoff把当前对话移交给一个全新的后台 agent,它会立即接手工作。/codebase-design用于设计深模块的共享词汇。当用户想设计或改进一个模块的接口、寻找深化机会、决定接缝放在何处、让代码更可测试或更易于 AI 导航,或当另一个技能需要深模块词汇时使用。/code-review审查自某个固定基点(commit、分支、tag 或 merge-base)以来的改动,沿两条轴进行——标准(代码是否遵循本仓库记录的编码规范?)和规格(代码是否符合源头工单/规格的要求?)。两项审查在并行子 agent 中运行,并把结果并排报告。当用户想审查一个分支、一个 PR、进行中的改动,或要求「审查自 X 以来」时使用。/diagnosing-bugs针对疑难 bug 和性能回归的诊断循环。当用户说「诊断」/「调试这个」,或报告某个东西坏了/抛异常/失败/变慢时使用。/domain-modeling构建并打磨项目的领域模型。当用户想要确定领域术语或通用语言、记录一项架构决策,或当其他技能需要维护领域模型时使用。Generated from the plugin's indexed repository (wenwuzhidao/mattpocock-skills-zh) — no native marketplace selected
npx claudepluginhub p/wenwuzhidao-mattpocock-skillsOther plugins' skills for the same job