Claude Marketplaces
SkillsMCP serversMarketplacesDigestTools
Submit

This week in Claude

Every Monday: Claude Code, Agent SDK, MCP, and the Anthropic platform moves worth your time.

Skills by category
Frontend DevelopmentBackend & APIsTesting & QASecurityDevOps & CI/CDGit & Pull RequestsDocumentationCode Review & QualityAI & Agent BuildingSkill Development
MCP servers by category
Sales & MarketingWeb & Browser AutomationDatabasesAI & LLM ToolsCloud & InfrastructureCommunication & MessagingDeveloper ToolsDesign & CreativeDocuments & KnowledgeSearch & Web Crawling
Marketplaces by category
AI Agents & OrchestrationLLM IntegrationDevelopment ToolsFrontend & UIBackend & APIsDatabasesTesting & Code QualityDevOps & CloudSecurity & ComplianceGit & Version Control
Claude Marketplaces

An independent directory of skills, plugins and MCP servers for Claude Code. Not affiliated with Anthropic.

Browse

  • Skills
  • MCP servers
  • Marketplaces
  • Weekly digest
  • Skill index
  • MCP index
  • Marketplace index

Site

  • About
  • Tools
  • Submit
  • Feedback
  • Privacy
  • llms.txt
  • Plugins reference

Maker

  • Snug
  • Agent Caffeine
  • knobs
  • Wax
  • Vectoys
  • mertduzgun.com
Made by mertduzgun.com
Skills/Frontend Development
vinvcn avatar

Git Guardrails Claude Code

vinvcn/mattpocock-skills-zh-cn

This sets up a pre-execution hook that blocks Claude Code from running destructive git commands like push, reset --hard, clean -f, and branch -D. You get to choose whether to install it per project or globally, and it intercepts the bash tool before anything dangerous runs. It's straightforward: the hook script checks the command against a blocklist and exits with code 2 if there's a match. Honestly, this is the kind of thing you want if you're letting Claude make changes in a repo where one wrong push could ruin someone's day. You can customize which patterns to block after installation.

installs
5.5K
GitHub stars
5.3K
last updated
Aug 21, 2026
View on GitHubSave

Install

$ npx -y skills add vinvcn/mattpocock-skills-zh-cn --skill git-guardrails-claude-code --agent claude-code

Installs into .claude/skills of the current project.

Files

设置 Git Guardrails

设置一个 PreToolUse hook,在 Claude 执行危险 git commands 前拦截并阻止它们。

会被阻止的命令

  • git push(包括 --force 在内的所有 variants)
  • git reset --hard
  • git clean -f / git clean -fd
  • git branch -D
  • git checkout . / git restore .

被阻止时,Claude 会看到一条 message,说明它无权访问这些 commands。

步骤

1. 询问安装范围

询问用户:只为当前 project 安装(.claude/settings.json),还是为所有 projects 安装(~/.claude/settings.json)?

2. 复制 hook 脚本

bundled script 位于:scripts/block-dangerous-git.sh

根据 scope 复制到目标位置:

  • Project: .claude/hooks/block-dangerous-git.sh
  • Global: ~/.claude/hooks/block-dangerous-git.sh

用 chmod +x 让它可执行。

3. 把 hook 加入 settings

添加到对应 settings file:

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 file 已存在,把 hook merge 到现有 hooks.PreToolUse array 中,不要覆盖其他 settings。

4. 询问是否定制

询问用户是否要在 blocked list 中添加或移除 patterns。相应编辑复制后的 script。

5. 验证

运行快速测试:

echo '{"tool_input":{"command":"git push origin main"}}' | <path-to-script>

应以 code 2 退出,并向 stderr 打印 BLOCKED message。

SKILL.md on GitHub

Sponsors

CodeRabbitSponsoredAI writes the code. CodeRabbit catches the slop.SnugThe clipboard manager you and your agent can use, safelyAgent CaffeineClose your lid, come back to finished workWaxBlock anything with supervision, without erasing your iPhoneknobsSee your site on any phone, any day, in any languagebelt - the only tool your agent needsSponsoredbelt cli automatically finds the best tools and skills for your agent. image, video, music, tts...Open StepsSponsoredFree an open-source skills that make AI coding agents easier to understand, verify, and control.AppSignalSponsoredMonitor with ease. Code with confidence.

Details

Repository
github.com/vinvcn/mattpocock-skills-zh-cn
Categories
Frontend Development, Git & Pull Requests
First seen
Jun 3, 2026

More from vinvcn/mattpocock-skills-zh-cn

All 39
  • Scaffold Exercises5.5K
  • Setup Pre Commit5.5K
  • Migrate To Shoehorn5.4K
  • Teach5.2K
  • Grilling4.4K
  • Domain Modeling4.2K
  • Code Review4.2K
  • Ask Matt4.2K
  • Diagnosing Bugs4.2K
  • Implement4.1K
  • Codebase Design4.1K
  • Research4K
  • Writing Shape3.6K
  • Writing Fragments3.6K
  • Writing Beats3.6K
  • Resolving Merge Conflicts3.5K
  • To Prd2.2K
  • Design An Interface2.1K
  • To Issues2.1K
  • Qa2.1K
  • Edit Article2.1K
  • Obsidian Vault2.1K
  • Request Refactor Plan2.1K
  • Ubiquitous Language2.1K

Recommended

More Frontend Development
1vinvcn avatarsetup-pre-commitvinvcn/mattpocock-skills-zh-cn在当前仓库设置 Husky pre-commit hooks,集成 lint-staged (Prettier)、类型检查和测试。适用于用户想添加 pre-commit hooks、设置 Husky、配置 lint-staged,或在提交时运行格式化、类型检查和测试时。5.5Kinstalls
2bencium avatarbencium-impact-designerbencium/bencium-marketplaceCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applicat5.4Kinstalls
3web-infra-dev avatarandroid-device-automationweb-infra-dev/midscene-skillsVision-driven Android device automation using Midscene. Operates entirely from screenshots — no DOM or accessibility labels required. Can interact with all visi5.4Kinstalls
4max-sixty avatarworktrunkmax-sixty/worktrunkGuidance for Worktrunk (the `wt` CLI) — git worktree management, hooks, and config. Load when editing .config/wt.toml or ~/.config/worktrunk/config.toml; adding5.4Kinstalls
5Vincentwei1021 avatarvideo-shotcraftVincentwei1021/video-shotcraftCreate cinematic product videos from shot recipe cards, a validated template, and code/audio assets (Remotion + real page screenshots + 2.5D camera moves + beat5.4Kinstalls
6affaan-m avatarprompt-optimizeraffaan-m/eccAnalyze raw prompts, identify intent and gaps, match ECC components (skills/commands/agents/hooks), and output a ready-to-paste optimized prompt. Advisory role 5.3Kinstalls