agentleFS
NoaiRoxNoaiRox/specialist-agent/skills/worktree/SKILL.md

worktree

Skill2 starsChanged 9 months agoMITView on GitHub

Use when you need workspace isolation for parallel tasks, risky changes, or multi-feature development without branch switching.

  • Installs packages
  • 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 10 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

  • SentrySkill

    e2e

    Run E2E tests for Sentry JavaScript SDK test applications

    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

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 3 are distinctive, and 2 are 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.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create isolated workspaces for parallel development.

    line 11
  2. Distinctive:

    NOT for: simple single-file changes (just use a branch)

    line 22
  3. Very specific:

    When @orchestrator dispatches parallel agents:

    line 111
  4. Distinctive:

    Clean up when done: - Remove worktrees and branches after merge

    line 148
  5. Very specific:

    Gitignore the worktrees directory: - Add .claude/worktrees/ to .gitignore

    line 150

“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

/worktree - Git Worktree Isolation

Create isolated workspaces for parallel development. Each task gets its own directory - no branch switching, no stashing, no conflicts.

Target: $ARGUMENTS

When to Use

  • Working on multiple features simultaneously
  • Risky refactoring that might break things
  • Long-running tasks that shouldn't block other work
  • Testing a fix while keeping current work intact
  • Running parallel agents on different tasks
  • NOT for: simple single-file changes (just use a branch)

Workflow

Step 1: Directory Selection

Choose where to create worktrees:

Priority order:
1. Existing worktrees directory (if configured)
2. .claude/worktrees/ (default for Specialist Agent)
3. ../project-worktrees/ (sibling directory)
4. Ask user

Step 2: Create Worktree

# Create new branch and worktree
git worktree add .claude/worktrees/$ARGUMENTS -b worktree/$ARGUMENTS

# Verify creation
git worktree list

Step 3: Setup Workspace

# Enter worktree
cd .claude/worktrees/$ARGUMENTS

# Install dependencies (auto-detect)
if [ -f "package-lock.json" ]; then npm ci
elif [ -f "yarn.lock" ]; then yarn install --frozen-lockfile
elif [ -f "pnpm-lock.yaml" ]; then pnpm install --frozen-lockfile
elif [ -f "bun.lockb" ]; then bun install
fi

# Verify clean baseline
git status

Step 4: Work in Isolation

The worktree is a full copy of the repo.
- Changes here do NOT affect the main worktree
- You can run tests, builds, anything
- Commits go to the worktree/$ARGUMENTS branch

Step 5: Merge or Discard

When done:

# Option 1: Merge back
cd /path/to/main/repo
git merge worktree/$ARGUMENTS

# Option 2: Create PR from worktree branch
gh pr create --base main --head worktree/$ARGUMENTS

# Option 3: Discard
git worktree remove .claude/worktrees/$ARGUMENTS
git branch -D worktree/$ARGUMENTS

Worktree Management

List Active Worktrees

git worktree list

Remove a Worktree

git worktree remove .claude/worktrees/$NAME
git branch -D worktree/$NAME

Clean All Worktrees

git worktree prune

Integration with @orchestrator

When @orchestrator dispatches parallel agents:

@orchestrator
├── Worktree: feature-a → @builder (component)
├── Worktree: feature-b → @builder (service)
└── Worktree: feature-c → @tester (tests)

Each agent works in its own worktree.
No file conflicts possible.
Merge when all complete.

Verification Protocol

Before claiming worktree is ready:

  1. git worktree list shows the new worktree
  2. Working directory is clean (git status shows no untracked files from setup)
  3. Dependencies are installed (if applicable)
  4. Tests pass in the worktree (baseline)

Anti-Rationalization

ExcuseReality
"Just stash and switch branches"Stashing loses context and is error-prone. Worktrees keep everything intact.
"I'll remember what I was working on"You won't. Worktrees preserve state explicitly.
"Too much disk space"Worktrees share .git objects. Overhead is minimal.
"Merging will be hard"Merging is the same as any branch. Worktrees don't add merge complexity.
"I'll just do tasks sequentially"Sequential is slower. Parallel worktrees = parallel development.

Rules

  1. Always name worktrees descriptively - worktree/auth-refactor not worktree/temp
  2. Install dependencies after creation - Auto-detect package manager
  3. Verify baseline before working - Tests must pass in fresh worktree
  4. Clean up when done - Remove worktrees and branches after merge
  5. Never work in .git/ - Worktrees are directories, not git internals
  6. Gitignore the worktrees directory - Add .claude/worktrees/ to .gitignore

Output

──── /worktree ────
Action: [create | list | remove | merge]
Name: $ARGUMENTS
Path: .claude/worktrees/$ARGUMENTS
Branch: worktree/$ARGUMENTS

Status: Ready
Dependencies: Installed
Baseline tests: Passing

Active worktrees:
  1. /main/repo (main branch)
  2. .claude/worktrees/$ARGUMENTS (worktree/$ARGUMENTS)

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.