[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AV07RHKG2DXNAXJ78WAFMS":3,"skill-same:01M7AV07RHKG2DXNAXJ78WAFMS":58},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M7AV07RHKG2DXNAXJ78WAFMS","git-guardrails-claude-code",null,"设置 Claude Code hooks，在危险的 git 命令（push、reset --hard、clean、branch -D 等）执行前拦截它们。当用户想防止破坏性 git 操作、添加 git 安全 hook，或在 Claude Code 中阻止 git push\u002Freset 时使用。","muscaestar\u002Fskills","muscaestar","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F34506351?v=4","01M7ATZNAAQJBTZZXCPKAWJQTH","Musca","01M7ATZNBG6JAV06HKBCBPM152",0,"MIT","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fgit-guardrails-claude-code\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: git-guardrails-claude-code\ndescription: 设置 Claude Code hooks，在危险的 git 命令（push、reset --hard、clean、branch -D 等）执行前拦截它们。当用户想防止破坏性 git 操作、添加 git 安全 hook，或在 Claude Code 中阻止 git push\u002Freset 时使用。\ncommit_version: 321658273cb1d20b76026717d027d505790106d4\n---\n\n# 设置 Git 护栏\n\n设置一个 PreToolUse hook，在 Claude 执行危险 git 命令之前拦截并阻止它们。\n\n## 会被阻止的命令\n\n- `git push`（所有变体，包括 `--force`）\n- `git reset --hard`\n- `git clean -f` \u002F `git clean -fd`\n- `git branch -D`\n- `git checkout .` \u002F `git restore .`\n\n被阻止时，Claude 会看到一条消息，告诉它无权执行这些命令。\n\n## 步骤\n\n### 1. 询问范围\n\n问用户：安装到**仅本项目**（`.claude\u002Fsettings.json`）还是**所有项目**（`~\u002F.claude\u002Fsettings.json`）？\n\n### 2. 复制 hook 脚本\n\n随附脚本位于：[scripts\u002Fblock-dangerous-git.sh](scripts\u002Fblock-dangerous-git.sh)\n\n按范围复制到目标位置：\n\n- **项目**：`.claude\u002Fhooks\u002Fblock-dangerous-git.sh`\n- **全局**：`~\u002F.claude\u002Fhooks\u002Fblock-dangerous-git.sh`\n\n用 `chmod +x` 赋予可执行权限。\n\n### 3. 把 hook 加入 settings\n\n添加到对应的 settings 文件：\n\n**项目**（`.claude\u002Fsettings.json`）：\n\n```json\n{\n  \"hooks\": {\n    \"PreToolUse\": [\n      {\n        \"matcher\": \"Bash\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"\\\"$CLAUDE_PROJECT_DIR\\\"\u002F.claude\u002Fhooks\u002Fblock-dangerous-git.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n**全局**（`~\u002F.claude\u002Fsettings.json`）：\n\n```json\n{\n  \"hooks\": {\n    \"PreToolUse\": [\n      {\n        \"matcher\": \"Bash\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"~\u002F.claude\u002Fhooks\u002Fblock-dangerous-git.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n如果 settings 文件已存在，把 hook 合并进现有的 `hooks.PreToolUse` 数组。不要覆盖其他设置。\n\n### 4. 询问定制需求\n\n问用户是否想在阻止列表中增加或移除任何模式。相应编辑复制后的脚本。\n\n### 5. 验证\n\n跑一个快速测试：\n\n```bash\necho '{\"tool_input\":{\"command\":\"git push origin main\"}}' | \u003Cpath-to-script>\n```\n\n应以退出码 2 退出，并向 stderr 打印一条 BLOCKED 消息。\n","# 设置 Git 护栏\n\n设置一个 PreToolUse hook，在 Claude 执行危险 git 命令之前拦截并阻止它们。\n\n## 会被阻止的命令\n\n- `git push`（所有变体，包括 `--force`）\n- `git reset --hard`\n- `git clean -f` \u002F `git clean -fd`\n- `git branch -D`\n- `git checkout .` \u002F `git restore .`\n\n被阻止时，Claude 会看到一条消息，告诉它无权执行这些命令。\n\n## 步骤\n\n### 1. 询问范围\n\n问用户：安装到**仅本项目**（`.claude\u002Fsettings.json`）还是**所有项目**（`~\u002F.claude\u002Fsettings.json`）？\n\n### 2. 复制 hook 脚本\n\n随附脚本位于：[scripts\u002Fblock-dangerous-git.sh](scripts\u002Fblock-dangerous-git.sh)\n\n按范围复制到目标位置：\n\n- **项目**：`.claude\u002Fhooks\u002Fblock-dangerous-git.sh`\n- **全局**：`~\u002F.claude\u002Fhooks\u002Fblock-dangerous-git.sh`\n\n用 `chmod +x` 赋予可执行权限。\n\n### 3. 把 hook 加入 settings\n\n添加到对应的 settings 文件：\n\n**项目**（`.claude\u002Fsettings.json`）：\n\n```json\n{\n  \"hooks\": {\n    \"PreToolUse\": [\n      {\n        \"matcher\": \"Bash\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"\\\"$CLAUDE_PROJECT_DIR\\\"\u002F.claude\u002Fhooks\u002Fblock-dangerous-git.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n**全局**（`~\u002F.claude\u002Fsettings.json`）：\n\n```json\n{\n  \"hooks\": {\n    \"PreToolUse\": [\n      {\n        \"matcher\": \"Bash\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"~\u002F.claude\u002Fhooks\u002Fblock-dangerous-git.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n如果 settings 文件已存在，把 hook 合并进现有的 `hooks.PreToolUse` 数组。不要覆盖其他设置。\n\n### 4. 询问定制需求\n\n问用户是否想在阻止列表中增加或移除任何模式。相应编辑复制后的脚本。\n\n### 5. 验证\n\n跑一个快速测试：\n\n```bash\necho '{\"tool_input\":{\"command\":\"git push origin main\"}}' | \u003Cpath-to-script>\n```\n\n应以退出码 2 退出，并向 stderr 打印一条 BLOCKED 消息。\n",{"name":5,"description":7,"commit_version":24},"321658273cb1d20b76026717d027d505790106d4","main","d198f74688d91ee205dcb8e96649a988a256ea4d","matt\u002Fgit-guardrails-claude-code","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills","https:\u002F\u002Fgithub.com\u002Fmuscaestar","muscaestar.xyz","2026-10-19 17:04:10",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add muscaestar\u002Fskills --skill git-guardrails-claude-code",{"tool":38,"command":39},"bunx","bunx skills add muscaestar\u002Fskills --skill git-guardrails-claude-code",{"tool":41,"command":42},"pnpm","pnpm dlx skills add muscaestar\u002Fskills --skill git-guardrails-claude-code","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fgit-guardrails-claude-code\u002FSKILL.md",true,[46,52],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"agents\u002Fopenai.yaml","REFERENCE","参考文档",110,"https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fgit-guardrails-claude-code\u002Fagents\u002Fopenai.yaml",{"path":53,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":56,"sourceHtmlUrl":57},"scripts\u002Fblock-dangerous-git.sh","SCRIPT","脚本",507,"https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fgit-guardrails-claude-code\u002Fscripts\u002Fblock-dangerous-git.sh",[59,66,73,80,87,94],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7AV2CSM2X530JCZZZMB9G25","skills-link","管理 muscaestar\u002Fskills 仓库的 skill 安装。当用户想安装\u002F卸载某个 skill、查看已装清单、把 skill 装到全局或某个项目、或问\"这个 skill 装了没有\"时使用。也用于向用户解释三层结构与全局\u002F项目双范围安装策略。","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fown\u002Fskills-link\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7AV2B8WFCKB3B8KVBYPVA3N","writing-shape","写作之 exploit：把原始素材塑形成一篇文章，逐段进行。","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fwriting-shape\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7AV2A090EYE2BY7G33GW05X","writing-fragments","写作之 explore：开采原始碎片，还没有结构。","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fwriting-fragments\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7AV281H5H6TDYGPFNH3ZM29","writing-for-agents","为 agents 编写文档。在创建或编辑技能，或修改 AGENTS.md 或 CLAUDE.md 时使用。","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fwriting-for-agents\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M7AV24MDVDQV8C67Y65DA9KC","writing-beats","写作之 exploit；把原始素材组装成一段由节拍（beat）构成的旅程，在每个节拍倚赖某个术语之前先把它落地。","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fwriting-beats\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M7AV22KNP7VXV3XHPX8JF0KB","wizard","生成一个交互式 bash 向导，引导人类完成只有他们才能执行的步骤。当需要配置基础设施、设置凭据或 CI secret、摸索不熟悉的第三方仪表盘，或执行一次性的迁移或切换时使用。不要为 agent 自己能执行的步骤调用本技能。","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fwizard\u002FSKILL.md",[],[]]