[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71Q7ZRSB66FPCTPPSXBR3SM":3,"skill-same:01M71Q7ZRSB66FPCTPPSXBR3SM":76},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":37,"linkOnly":38,"markdownContent":39,"markdownBody":40,"frontMatter":41,"refName":42,"commitSha":43,"skillDirectory":44,"forksCount":45,"repositoryHtmlUrl":46,"repositoryHomepageUrl":47,"ownerHtmlUrl":48,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":49,"install":50,"resources":63},"01M71Q7ZRSB66FPCTPPSXBR3SM","git-guardrails-claude-code",null,"设置 Claude Code hooks，在危险 git commands（push、reset --hard、clean、branch -D 等）执行前阻止它们。适用于用户想防止破坏性 git 操作、添加 git safety hooks，或在 Claude Code 中阻止 git push\u002Freset 时。","vinvcn\u002Fmattpocock-skills-zh-CN","vinvcn","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F120928190?v=4","01M71Q60C4V98DEXHGN2VXFSZB","01M71Q60D6PRAJHKQRY33ZNE59",5679,"MIT","https:\u002F\u002Fgithub.com\u002Fvinvcn\u002Fmattpocock-skills-zh-CN\u002Fblob\u002Fmain\u002Fskills\u002Fmisc\u002Fgit-guardrails-claude-code\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[23,24,25,26,27,28,29,30,31,32,33,34,35,36],"code","git","Guardrails","git guardrails claude code","git guardrails","push","Safety","git push","branch","claude code hooks","hooks","clean","commands","reset","2026-11-10 13:02:02",false,"---\nname: git-guardrails-claude-code\ndescription: 设置 Claude Code hooks，在危险 git commands（push、reset --hard、clean、branch -D 等）执行前阻止它们。适用于用户想防止破坏性 git 操作、添加 git safety hooks，或在 Claude Code 中阻止 git push\u002Freset 时。\n---\n\n# 设置 Git Guardrails\n\n设置一个 PreToolUse hook，在 Claude 执行危险 git commands 前拦截并阻止它们。\n\n## 会被阻止的命令\n\n- `git push`（包括 `--force` 在内的所有 variants）\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 会看到一条 message，说明它无权访问这些 commands。\n\n## 步骤\n\n### 1. 询问安装范围\n\n询问用户：只为**当前 project** 安装（`.claude\u002Fsettings.json`），还是为**所有 projects** 安装（`~\u002F.claude\u002Fsettings.json`）？\n\n### 2. 复制 hook 脚本\n\nbundled script 位于：[scripts\u002Fblock-dangerous-git.sh](scripts\u002Fblock-dangerous-git.sh)\n\n根据 scope 复制到目标位置：\n\n- **Project**: `.claude\u002Fhooks\u002Fblock-dangerous-git.sh`\n- **Global**: `~\u002F.claude\u002Fhooks\u002Fblock-dangerous-git.sh`\n\n用 `chmod +x` 让它可执行。\n\n### 3. 把 hook 加入 settings\n\n添加到对应 settings file：\n\n**Project** (`.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**Global** (`~\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 file 已存在，把 hook merge 到现有 `hooks.PreToolUse` array 中，不要覆盖其他 settings。\n\n### 4. 询问是否定制\n\n询问用户是否要在 blocked list 中添加或移除 patterns。相应编辑复制后的 script。\n\n### 5. 验证\n\n运行快速测试：\n\n```bash\necho '{\"tool_input\":{\"command\":\"git push origin main\"}}' | \u003Cpath-to-script>\n```\n\n应以 code 2 退出，并向 stderr 打印 BLOCKED message。\n","# 设置 Git Guardrails\n\n设置一个 PreToolUse hook，在 Claude 执行危险 git commands 前拦截并阻止它们。\n\n## 会被阻止的命令\n\n- `git push`（包括 `--force` 在内的所有 variants）\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 会看到一条 message，说明它无权访问这些 commands。\n\n## 步骤\n\n### 1. 询问安装范围\n\n询问用户：只为**当前 project** 安装（`.claude\u002Fsettings.json`），还是为**所有 projects** 安装（`~\u002F.claude\u002Fsettings.json`）？\n\n### 2. 复制 hook 脚本\n\nbundled script 位于：[scripts\u002Fblock-dangerous-git.sh](scripts\u002Fblock-dangerous-git.sh)\n\n根据 scope 复制到目标位置：\n\n- **Project**: `.claude\u002Fhooks\u002Fblock-dangerous-git.sh`\n- **Global**: `~\u002F.claude\u002Fhooks\u002Fblock-dangerous-git.sh`\n\n用 `chmod +x` 让它可执行。\n\n### 3. 把 hook 加入 settings\n\n添加到对应 settings file：\n\n**Project** (`.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**Global** (`~\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 file 已存在，把 hook merge 到现有 `hooks.PreToolUse` array 中，不要覆盖其他 settings。\n\n### 4. 询问是否定制\n\n询问用户是否要在 blocked list 中添加或移除 patterns。相应编辑复制后的 script。\n\n### 5. 验证\n\n运行快速测试：\n\n```bash\necho '{\"tool_input\":{\"command\":\"git push origin main\"}}' | \u003Cpath-to-script>\n```\n\n应以 code 2 退出，并向 stderr 打印 BLOCKED message。\n",{"name":5,"description":7},"main","c5c5e87cc1df26aeb7dba345ad9f846434d2b3d4","skills\u002Fmisc\u002Fgit-guardrails-claude-code",441,"https:\u002F\u002Fgithub.com\u002Fvinvcn\u002Fmattpocock-skills-zh-CN","https:\u002F\u002Fskills.sh\u002Fvinvcn\u002Fmattpocock-skills-zh-CN","https:\u002F\u002Fgithub.com\u002Fvinvcn","2026-11-10 17:40:42",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add vinvcn\u002Fmattpocock-skills-zh-CN --skill git-guardrails-claude-code",{"tool":56,"command":57},"bunx","bunx skills add vinvcn\u002Fmattpocock-skills-zh-CN --skill git-guardrails-claude-code",{"tool":59,"command":60},"pnpm","pnpm dlx skills add vinvcn\u002Fmattpocock-skills-zh-CN --skill git-guardrails-claude-code","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fvinvcn\u002Fmattpocock-skills-zh-CN\u002Fblob\u002Fmain\u002Fskills\u002Fmisc\u002Fgit-guardrails-claude-code\u002FSKILL.md",true,[64,70],{"path":65,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":68,"sourceHtmlUrl":69},"agents\u002Fopenai.yaml","REFERENCE","参考文档",112,"https:\u002F\u002Fgithub.com\u002Fvinvcn\u002Fmattpocock-skills-zh-CN\u002Fblob\u002Fmain\u002Fskills\u002Fmisc\u002Fgit-guardrails-claude-code\u002Fagents\u002Fopenai.yaml",{"path":71,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":74,"sourceHtmlUrl":75},"scripts\u002Fblock-dangerous-git.sh","SCRIPT","脚本",507,"https:\u002F\u002Fgithub.com\u002Fvinvcn\u002Fmattpocock-skills-zh-CN\u002Fblob\u002Fmain\u002Fskills\u002Fmisc\u002Fgit-guardrails-claude-code\u002Fscripts\u002Fblock-dangerous-git.sh",[77,99,109,119,129,138],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":94,"publishedAt":37},"01M71Q8F3M8YFP6WYVYQP61KBT","writing-for-agents","为 agent 编写文档。适用于创建或编辑 skills，或修改 AGENTS.md 或 CLAUDE.md 时。","https:\u002F\u002Fgithub.com\u002Fvinvcn\u002Fmattpocock-skills-zh-CN\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Fwriting-for-agents\u002FSKILL.md",[83,88,91],{"categoryNo":84,"categoryName":85,"taxonomyType":86,"taxonomyTypeDesc":87},"01JBSEEDCAT000000000000018","写作与文案","SCENARIO","使用场景",{"categoryNo":89,"categoryName":90,"taxonomyType":86,"taxonomyTypeDesc":87},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":92,"categoryName":93,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000036","内容创作者",[95,96,97,98],"for","writing for agents","writing","文档",{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":37},"01M71Q8DHRPYE6R648CQ7NAHYN","wait-what","停一下：刚才那条消息没有说清楚，重新表述一遍。","https:\u002F\u002Fgithub.com\u002Fvinvcn\u002Fmattpocock-skills-zh-CN\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Fwait-what\u002FSKILL.md",[],[106,107,108],"wait","wait what","true",{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":37},"01M71Q8C8CBSRJRP8Y0JRZ7RJ7","to-questionnaire","把你无法完整回答的 decision 转成一份交给他人填写的 questionnaire。","https:\u002F\u002Fgithub.com\u002Fvinvcn\u002Fmattpocock-skills-zh-CN\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Fto-questionnaire\u002FSKILL.md",[],[116,117,118,108],"questionnaire","to questionnaire","decision",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":128,"publishedAt":37},"01M71Q8ASS9A6P84PSC02YFKHB","teach","在这个工作区中教用户一个新技能或概念。","https:\u002F\u002Fgithub.com\u002Fvinvcn\u002Fmattpocock-skills-zh-CN\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Fteach\u002FSKILL.md",[125],{"categoryNo":126,"categoryName":127,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000039","教师与教育",[121,108],{"skillNo":130,"name":131,"nameZh":6,"description":132,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":133,"categories":134,"keywords":135,"publishedAt":37},"01M71Q89C2C2QRR3J3H64ZKH0P","handoff","把当前对话压缩成交接文档，让另一个代理接手。","https:\u002F\u002Fgithub.com\u002Fvinvcn\u002Fmattpocock-skills-zh-CN\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Fhandoff\u002FSKILL.md",[],[131,108,136,137,98],"对话","压缩",{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":144,"publishedAt":37},"01M71Q883CXWF0BGDQC3Y8TJZ2","grilling","围绕计划、decision 或 idea 持续追问用户。适用于用户想对自己的思路做压力测试，或使用任何 “grill” 触发措辞时。","https:\u002F\u002Fgithub.com\u002Fvinvcn\u002Fmattpocock-skills-zh-CN\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Fgrilling\u002FSKILL.md",[],[140,145,146,118,147],"idea","grill","testing"]