# Branch Guard

> Use this skill when the user wants to commit, push, create a branch, or verify whether the current branch is protected before making git changes in Codex.

- Skill: `koyonx/branch-guard` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add koyonx/branch-guard`
- Raw SKILL.md: https://api.skillmd.com/api/skills/koyonx/branch-guard/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: koyonx (https://skillmd.com/u/koyonx)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/koyonx/branch-guard

---


# Branch Guard

## Overview

Use this skill before any commit or push workflow.
It checks whether the current branch is protected and can reject risky direct commits or pushes.

## Workflow

1. Run `scripts/check_branch.sh --command "<planned git command>"`.
2. If the current branch is protected, stop and create a feature branch first.
3. If the branch is safe, continue with the requested git workflow.
4. When branch policy is project-specific, read `.branch-guard.json` from the git root.

## Protected Branch Config

See `references/config.md` for the config file shape.

## Resources

- Script: `scripts/check_branch.sh`
- Reference: `references/config.md`

