branch-worktree-guardian

Enforce protected Git branch safety with feature worktrees and verification scripts.

1|Updated Oct 17, 2025
One-click install
npx skills add https://github.com/tarrragon/claude --skill branch-worktree-guardian
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: branch-worktree-guardian
Source: https://github.com/tarrragon/claude/tree/main/skills/branch-worktree-guardian
Command: npx skills add https://github.com/tarrragon/claude --skill branch-worktree-guardian

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Branch Worktree Guardian enforces safe development on Git by preventing edits on protected branches and guiding teams to create isolated worktrees for feature development, reducing conflicts and risky edits.

Core Features & Use Cases

  • Enforces editing on feature branches by validating current branch and suggesting or creating a dedicated worktree.
  • Provides scripts to create feature worktrees and verify branch status, enabling parallel development for multiple AI agents.
  • Integrates with hooks to automatically warn or block edits on protected branches during SessionStart and tool usage.

Quick Start

Use the included scripts to verify your environment and, if needed, create a new feature branch and worktree. Example: python .claude/skills/branch-worktree-guardian/scripts/create_feature_worktree.py --branch feat/new-feature --worktree ../project-new-feature

Frequently Asked Questions about branch-worktree-guardian

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent accidental edits on protected Git branches?

Git branch protection prevents accidental edits by enforcing feature worktrees and validating branch status. A hook mechanism automatically warns or blocks edits on protected branches during session start and tool usage.

What is a Git worktree and how does it help with parallel feature development?

A Git worktree is an isolated working directory linked to a repository, enabling parallel feature development. It allows multiple AI agents to work on isolated worktrees simultaneously to avoid conflicts on main branches.

How do I create a feature worktree using Python scripts?

Create a feature worktree by running the Python script create_feature_worktree.py with arguments for the branch and worktree path. This script establishes an isolated worktree and feature branch for safe development.

Can I use branch verification hooks for multi-agent development workflows?

Yes, branch verification hooks support multi-agent development workflows by automatically checking branch status during session start and tool use. This ensures AI agents operate within isolated worktrees and prevents parallel conflicts.

What are the limitations of using Git worktrees for branch protection?

Git worktrees for branch protection require Python to run verification scripts and depend on hook integration to enforce rules. Worktrees created outside the provided scripts may bypass the automated safety checks during development.