agentleFS
DGouronDGouron/review-flow/.claude/skills/worktree/SKILL.md

worktree

Skill42 starsChanged 6 months agoMITView on GitHub

Git worktree management for working on multiple branches in parallel. Create, list, remove, and synchronize worktrees. Protects against direct pushes to master.

  • Deletes or force-pushes
  • Commits and pushes

59 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use worktree-merge, resolve-conflicts and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • leessjuSkill

    worktree-merge

    Squash-merge the current worktree branch into the main branch (or a specified target). Analyzes git history and source code to craft a comprehensive commit message.

    Also in 3 projects that use this

  • ralphkraussSkill

    resolve-conflicts

    Resolve git merge conflicts or re-apply changes from a stale branch onto current main. Use when user says "resolve conflicts", "merge conflicts", "rebase branch", "branch is behind", "re-apply changes", "port branch", or a branch is too far behind main to merge cleanly.

    Also in 5 projects that use this

  • hdcolaSkill

    pr-comments

    Fetch unresolved review comments from a GitHub PR or mark comments as resolved. Use this when managing PR review feedback, checking pending comments, or marking review threads as resolved. Supports GitHub URLs or explicit owner/repo/PR-number from anywhere, or PR number auto-detection from within a git repository.

    Also in 3 projects that use this

  • Google CloudSkill

    contributing

    Guides the developer workflow for contributing to Race Condition. Use when setting up pre-commit hooks, running tests before a PR, understanding code style requirements, or preparing a contribution.

    Also in 3 projects that use this

  • PydanticSkill

    coverage

    Fetch coverage diff from Codecov for the current branch or a specific PR. Shows uncovered lines, patch coverage, and overall coverage change.

    Also in 3 projects that use this

  • johnlindquistSkill

    diagram

    Maintain and synchronize Unified Impact Diagrams following Diagram Driven Development (DDD) methodology. Create, update, and manage diagrams that connect user value to technical implementation.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 47 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    NEVER: commit on master

    line 185
  2. Distinctive:

    ALWAYS: create a PR to merge into master

    line 186
  3. Very specific:

    ALWAYS: create worktrees in .claude/worktrees/

    line 188
  4. Distinctive:

    ALWAYS: use absolute paths in displayed commands

    line 189

“Common” is measured: kept by at least 6 in 10 of the 47 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Command /worktree - Git Worktree Management

Manages Git worktrees for working on multiple branches in parallel across different Claude Code sessions.

Absolute Security Rules

NEVER push directly to `master`!
NEVER commit directly to `master`!
Only allowed action on `master`: git pull origin master
Always create a PR to merge into `master`

Configuration

ParameterValue
Worktrees directory.claude/worktrees/
Main branchmaster
Default --from branchmaster

Subcommands

/worktree or /worktree list

Lists all existing worktrees with their branch and status.

/worktree add <name> [--from <branch>]

Creates a new worktree with a "home-base" branch.

  • By default, based on master
  • Path: .claude/worktrees/<name>

/worktree remove <name>

Removes a worktree (asks for confirmation if not clean).

/worktree sync [name]

Synchronizes the worktree with master (pull only).

/worktree connect <name>

Changes the current session's working directory to the specified worktree.

  • Verifies the worktree exists
  • Moves into <worktree_path>
  • Displays the worktree's git status

Worktree Architecture

claude-review-automation/             <- Main worktree (master)
├── src/
├── .claude/
│   └── worktrees/
│       ├── refactor/                 <- Refactor worktree
│       │   ├── src/
│       │   └── ...
│       ├── debug/                    <- Debug worktree
│       │   ├── src/
│       │   └── ...
│       └── feature-x/               <- Feature worktree
│           ├── src/
│           └── ...
└── ...

Concept: "Home-Base" Branches

Each worktree has a "home-base" branch that serves as a starting point.

BranchRole
refactor, debug, etc.Worktree home-base (synced with master)
feat/xxx-*, fix/xxx-*Working branches

Workflow inside a worktree:

# 1. You are on the home-base (e.g., refactor)
git status  # On the refactor branch

# 2. Create a feature branch for your ticket
git checkout -b feat/xxx-description

# 3. Work, commit...
git add .
git commit -m "feat(scope): description"

# 4. Push the feature branch (NEVER the home-base)
git push origin feat/xxx-description

# 5. Create a PR to master (via gh CLI)

# 6. Once merged, return to home-base and sync
git checkout refactor
git pull origin master

Synchronization Commands

Sync a worktree with master

# Inside the relevant worktree
git checkout <home-base>  # refactor, debug...
git fetch origin
git reset --hard origin/master

WARNING: This command overwrites the local home-base branch. This is intentional because it should never contain direct work.


Output Templates

Worktree List

WORKTREES

Repo: claude-review-automation

| Usage | Path | Home-base | Current Branch |
|-------|------|-----------|----------------|
| main | .../claude-review-automation | - | master |
| refactor | .../.claude/worktrees/refactor | refactor | refactor |

Tip - Open a session:
   cd <path> && claude

Sync with master:
   git checkout <home-base> && git pull origin master

Worktree Creation

WORKTREE CREATED

Name      : <name>
Path      : <path>
Home-base : <name> (based on master)

Warning - Install dependencies:
   cd <path> && yarn install

Tip - Start a session:
   cd <path> && claude

Reminder: NEVER push to master, always create a PR!

Worktree Connection

CONNECTED TO WORKTREE

Worktree : <name>
Path     : <path>
Branch   : <current_branch>
Status   : <clean|modified>

You are now in the <name> worktree

Sync with master: git pull origin master
Reminder: NEVER push to master, always create a PR!

Rules

  • NEVER push directly to master
  • NEVER commit on master
  • ALWAYS create a PR to merge into master
  • ONLY allowed action on master: git pull origin master
  • ALWAYS create worktrees in .claude/worktrees/
  • ALWAYS use absolute paths in displayed commands
  • ALWAYS remind to run yarn install after creation
  • VERIFY that the branch is not already checked out in another worktree

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.