git-guardrails-claude-code
Skill5 starsChanged 4 months agoMITView on GitHub
ตั้งค่า hook ของ Claude Code เพื่อบล็อกคำสั่ง git อันตราย (push, reset --hard, clean, branch -D ฯลฯ) ก่อนที่มันจะถูกรัน ใช้เมื่อ user อยากป้องกัน git operation แบบทำลายล้าง อยากเพิ่ม git safety hook หรืออยากบล็อก git push/reset ใน Claude Code
- Deletes or force-pushes
- Commits and pushes
121 other projects use a version of this, 117 of them edited.
Adopted by
Most recently taken up by
- 5thlayer/skillworksedited, first seen Nov 8, 2026
- dfirmin/compassedited, first seen Nov 8, 2026
- op3616windows/skillsedited, first seen Nov 8, 2026
- kazemcodes/skill-treeedited, first seen Nov 8, 2026
- itsryanarmani/skillsedited, first seen Nov 8, 2026
- shkodnik1917/claude-brainlabedited, first seen Nov 8, 2026
Used with
Projects with it also use batch-grill-me, decision-mapping and 1 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
boyingliu01Skillbatch-grill-me
A relentless interview that asks every frontier question at once, round by round. Thin alias of `grilling` (#540) — upstream mattpocock/skills absorbed this protocol into grilling; XP-Gate keeps this name as the sprint-flow Phase 2 entry point so orchestration docs stay stable.
Also in 6 projects that use this
FabienDehopreSkilldecision-mapping
Turn a loose idea into a sequenced map of investigation tickets, then drive them to resolution one at a time.
Also in 4 projects that use this
HK-hubSkillprd-to-plan
Turn a PRD into a multi-phase implementation plan using tracer-bullet vertical slices, saved as a local Markdown file in ./plans/. Use when user wants to break down a PRD, create an implementation plan, plan phases from a PRD, or mentions "tracer bullets".
Also in 8 projects that use this
Other versions121 projects use a version of this.
Word for word · 0
None found.
Edited · 117
- mattpocock/skills★ 309k22% same
- vinvcn/mattpocock-skills-zh-CN★ 5.5k29% same
- devcxl/mattpocock-skills-zh★ 52228% same
- amazingloft999-droid/mattpocock-skills★ 42222% same
- InditexTech/weavejs★ 26622% same
- loulanyue/skills★ 23122% same
- tt-a1i/matt-skills-with-to-goal★ 19222% same
- aurorasoft2/Matt_Pocock_Skills★ 13322% same
- Tresnanda/kybern★ 8322% same
- VisualxIntelligence/mattpocok-skills★ 5522% same
107 more not listed
Wrote their own version · 4
- chrislacey89/skills★ 4same name
- wakqasahmed/ai-engineering-workflow-skills★ 2same name
- wakqasahmed/skills★ 2same name
- snowfluke/engineering-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository39 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- design-an-interfaceSkill
- qaSkill
- request-refactor-planSkill
- ubiquitous-languageSkill
- ask-mattSkill
- codebase-designSkill
- code-reviewSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- grill-with-docsSkill
- implementSkill
- improve-codebase-architectureSkill
- prototypeSkill
- researchSkill
- resolving-merge-conflictsSkill
- setup-matt-pocock-skillsSkill
- tddSkill
- to-specSkill
- to-ticketsSkill
- triageSkill
- wayfinderSkill
- claude-handoffSkill
- loop-meSkill
- setup-ts-deep-modulesSkill
- wizardSkill
- writing-beatsSkill
- writing-fragmentsSkill
- writing-shapeSkill
- migrate-to-shoehornSkill
- scaffold-exercisesSkill
- setup-pre-commitSkill
- edit-articleSkill
- obsidian-vaultSkill
- grillingSkill
- grill-meSkill
- handoffSkill
- teachSkill
- writing-great-skillsSkill
The file
Files
ตั้งค่า Git Guardrails
ตั้งค่า PreToolUse hook ที่คอยดักและบล็อกคำสั่ง git อันตรายก่อนที่ Claude จะรันมัน
อะไรบ้างที่ถูกบล็อก
git push(ทุก variant รวมถึง--force)git reset --hardgit clean -f/git clean -fdgit branch -Dgit checkout ./git restore .
เมื่อถูกบล็อก Claude จะเห็นข้อความบอกว่ามันไม่มีสิทธิ์เข้าถึงคำสั่งเหล่านี้
ขั้นตอน
1. ถาม scope
ถาม user: จะติดตั้งสำหรับ โปรเจกต์นี้เท่านั้น (.claude/settings.json) หรือ ทุกโปรเจกต์ (~/.claude/settings.json)?
2. copy script ของ hook
script ที่แนบมากับ skill นี้อยู่ที่: scripts/block-dangerous-git.sh
copy ไปไว้ที่ตำแหน่งปลายทางตาม scope:
- Project:
.claude/hooks/block-dangerous-git.sh - Global:
~/.claude/hooks/block-dangerous-git.sh
ทำให้มันรันได้ด้วย chmod +x
3. เพิ่ม hook ลงใน settings
เพิ่มลงในไฟล์ settings ที่ตรงกับ scope:
Project (.claude/settings.json):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}Global (~/.claude/settings.json):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "~/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}ถ้าไฟล์ settings มีอยู่แล้ว ให้ merge hook เข้าไปใน array hooks.PreToolUse เดิม — อย่าเขียนทับ setting อื่น
4. ถามเรื่องการปรับแต่ง
ถามว่า user อยากเพิ่มหรือลบ pattern จากรายการที่ถูกบล็อกไหม แล้วแก้ script ที่ copy มาให้ตรงตามนั้น
5. ตรวจสอบ
รัน test สั้น ๆ:
echo '{"tool_input":{"command":"git push origin main"}}' | <path-to-script>ควรจบด้วย exit code 2 และ print ข้อความ BLOCKED ออกทาง stderr
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

