# validate-branch-name

> Validate Git Flow branch naming conventions before checkout. Ensures branches follow the pattern: feature/*, release/v*.*.*, hotfix/*. Prevents creation of

- Source: https://doutorai.pt/en/components/hooks__validate-branch-name
- Type: Automations
- Category: Git
- Downloads: 191
- Site: Doutor AI (https://doutorai.pt/en) - AI tools for small businesses

An open-source community component, curated and adapted by Doutor AI.

## What it does and how to use it

A **hook** that automates git actions at key moments (before/after a tool runs, on save, etc.), without you having to think about it.

1. Install the hook (command above).
2. It runs automatically on the defined events.
3. Adjust the rules in the settings file if you want to fine-tune it.

## Install (Claude Code)

```bash
mkdir -p .claude/hooks && curl -fsSL https://doutorai.pt/data/lib/hooks__validate-branch-name.md -o .claude/hooks/validate-branch-name.json
```

Paste this command into the terminal, in your project folder, and the component installs automatically.

## Content

```
{
  "description": "Validate Git Flow branch naming conventions before checkout. Ensures branches follow the pattern: feature/*, release/v*.*.*, hotfix/*. Prevents creation of branches that don't follow Git Flow standards.",
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/validate-branch-name.py"
          }
        ]
      }
    ]
  }
}
```

## Related components

- [agents-md-loader](https://doutorai.pt/en/components/hooks__agents-md-loader): Automatically loads AGENTS.md configuration file content at session start to ensure Claude Code follows project-specific agent behavior. Onl
- [ai-bash-guard](https://doutorai.pt/en/components/hooks__ai-bash-guard): AI-powered bash command security guard. Before any Bash command runs, a lightweight Claude subagent evaluates it for destructive or irrevers
- [auto-git-add](https://doutorai.pt/en/components/hooks__auto-git-add): Automatically stage modified files with git add after editing. Helps maintain a clean git workflow by staging changes as they're made.
- [backup-before-edit](https://doutorai.pt/en/components/hooks__backup-before-edit): Create automatic backup of files before any Edit operation for safety. This hook creates a timestamped backup copy (filename.backup.timestam
- [build-on-change](https://doutorai.pt/en/components/hooks__build-on-change): Automatically trigger build processes when source files change. Detects common build tools and runs appropriate build commands.
- [change-logger](https://doutorai.pt/en/components/hooks__change-logger-2): Log every file mutation to CSV for demo prep. Records timestamp, tool, file path, action, and details for Edit, MultiEdit, Write, and Bash o

## Save hours every week with AI, no hassle

**Doutor AI** gives you 1,859 ready-to-copy AI prompts, by industry and in plain English - plus a complete technical library for those who want to go further. [See plans →](https://doutorai.pt/en/pricing)

---
Content by Doutor AI (https://doutorai.pt/en). When quoting, please cite the source: https://doutorai.pt/en/components/hooks__validate-branch-name
