[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79G0QGA9WH3R1EEF36P3EYG":3,"skill-same:01M79G0QGA9WH3R1EEF36P3EYG":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":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M79G0QGA9WH3R1EEF36P3EYG","git-guardrails-claude-code",null,"设置 Claude Code 钩子，在危险的 git 命令（push、reset --hard、clean、branch -D 等）执行前将其阻止。当用户想要防止破坏性 git 操作、添加 git 安全钩子，或在 Claude Code 中阻止 git push\u002Freset 时使用。","15102045545\u002Fskills-cn","15102045545","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F168414493?v=4","01M79FZ671W8T1KPST7GRYEG3T","xiaokeer","01M79FZ67MMMDE1RZYSQGCPWK9",1,"MIT","https:\u002F\u002Fgithub.com\u002F15102045545\u002Fskills-cn\u002Fblob\u002Fmaster\u002Fskills\u002Fmisc\u002Fgit-guardrails-claude-code\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: git-guardrails-claude-code\ndescription: 设置 Claude Code 钩子，在危险的 git 命令（push、reset --hard、clean、branch -D 等）执行前将其阻止。当用户想要防止破坏性 git 操作、添加 git 安全钩子，或在 Claude Code 中阻止 git push\u002Freset 时使用。\n---\n\n# 设置 Git 防护措施\n\n设置一个 PreToolUse 钩子，在 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. 复制钩子脚本\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. 将钩子添加到设置\n\n将以下内容添加到相应的设置文件中：\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如果设置文件已存在，请将钩子合并到现有的 `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 钩子，在 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. 复制钩子脚本\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. 将钩子添加到设置\n\n将以下内容添加到相应的设置文件中：\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如果设置文件已存在，请将钩子合并到现有的 `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},"master","a7a44e6effe5a404eb8b622483896d79904f0c69","skills\u002Fmisc\u002Fgit-guardrails-claude-code",0,"https:\u002F\u002Fgithub.com\u002F15102045545\u002Fskills-cn","https:\u002F\u002Fgithub.com\u002F15102045545","软件开发工程师","2026-07-23 11:44:15",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add 15102045545\u002Fskills-cn --skill git-guardrails-claude-code",{"tool":38,"command":39},"bunx","bunx skills add 15102045545\u002Fskills-cn --skill git-guardrails-claude-code",{"tool":41,"command":42},"pnpm","pnpm dlx skills add 15102045545\u002Fskills-cn --skill git-guardrails-claude-code","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002F15102045545\u002Fskills-cn\u002Fblob\u002Fmaster\u002Fskills\u002Fmisc\u002Fgit-guardrails-claude-code\u002FSKILL.md",true,[46,52],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"agents\u002Fopenai.yaml","REFERENCE","参考文档",109,"https:\u002F\u002Fgithub.com\u002F15102045545\u002Fskills-cn\u002Fblob\u002Fmaster\u002Fskills\u002Fmisc\u002Fgit-guardrails-claude-code\u002Fagents\u002Fopenai.yaml",{"path":53,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":56,"sourceHtmlUrl":57},"scripts\u002Fblock-dangerous-git.sh","SCRIPT","脚本",494,"https:\u002F\u002Fgithub.com\u002F15102045545\u002Fskills-cn\u002Fblob\u002Fmaster\u002Fskills\u002Fmisc\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},"01M79G19FBV713ADE9Q95Y4D8E","writing-great-skills","出色编写和编辑技能的参考资料——让技能具备可预测性的词汇与原则。","https:\u002F\u002Fgithub.com\u002F15102045545\u002Fskills-cn\u002Fblob\u002Fmaster\u002Fskills\u002Fproductivity\u002Fwriting-great-skills\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},"01M79G1888W4AQP8N9D2X0XYV4","teach","在此工作区内向用户教授新的技能或概念。","https:\u002F\u002Fgithub.com\u002F15102045545\u002Fskills-cn\u002Fblob\u002Fmaster\u002Fskills\u002Fproductivity\u002Fteach\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},"01M79G15Z3NX0EJBP03A6VC3GJ","handoff","将当前对话压缩成交接文档，以便另一个智能体接手。","https:\u002F\u002Fgithub.com\u002F15102045545\u002Fskills-cn\u002Fblob\u002Fmaster\u002Fskills\u002Fproductivity\u002Fhandoff\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},"01M79G14SKDFSWTADQZMQSCN9Q","grilling","围绕计划、决策或想法对用户进行不留情面的深度追问。当用户想对自己的思路进行压力测试，或使用任何“深度追问”触发措辞时使用。","https:\u002F\u002Fgithub.com\u002F15102045545\u002Fskills-cn\u002Fblob\u002Fmaster\u002Fskills\u002Fproductivity\u002Fgrilling\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},"01M79G12NEZDVFGG45SP50P37Q","grill-me","通过不留情面的深度追问打磨计划或设计。","https:\u002F\u002Fgithub.com\u002F15102045545\u002Fskills-cn\u002Fblob\u002Fmaster\u002Fskills\u002Fproductivity\u002Fgrill-me\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},"01M79G1198KAG4PE1YADT2G30R","obsidian-vault","使用 wikilink 和索引笔记搜索、创建和管理 Obsidian 仓库中的笔记。当用户想要在 Obsidian 中查找、创建或整理笔记时使用。","https:\u002F\u002Fgithub.com\u002F15102045545\u002Fskills-cn\u002Fblob\u002Fmaster\u002Fskills\u002Fpersonal\u002Fobsidian-vault\u002FSKILL.md",[],[]]