Skip to content
Back to skills

Protect Main Branch

ASecurity

Keeps agents off main and master: a git hook reads the current branch at commit time and parses the refs being pushed at push time. The hook refuses a violation only where it is installed. As skill text alone this is advice, and nothing stops one.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 13, 2026
ai-agentsgit

Works with

  • cli

Security analysis

A100/100

Scanned November 10, 2026

npx -y skills add open-coder-ai/chock-catalog --skill protect-main-branch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Protect Main Branch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Protect Main Branch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/open-coder-ai-protect-main-branch/badge)](https://www.skillsdirectory.com/skills/open-coder-ai-protect-main-branch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: protect-main-branch
description: "Keeps agents off main and master: a git hook reads the current branch at commit time and parses the refs being pushed at push time. The hook refuses a violation only where it is installed. As skill text alone this is advice, and nothing stops one."
metadata:
  chock.artifact: hook
  chock.enforcement: block
  chock.coverage_without_chock: advisory
---

# Protect Main Branch

Keeps agents off main and master: a git hook reads the current branch at commit time and parses the refs being pushed at push time. The hook refuses a violation only where it is installed. As skill text alone this is advice, and nothing stops one.

```
on(commit|push): block(forbidden_ref) refs=main|master
Direct commits/pushes to a protected branch (main|master) are blocked. Create a feature branch and open a pull request.
```

This skill is advisory: the client reading it has no mechanism to enforce it. The same policy compiled by `chock` blocks at commit and at push. See https://github.com/open-coder-ai/chock

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.