agentleFS
abhattacherjeeabhattacherjee/claude-code-skills/worktree/SKILL.md

worktree

Skill1 starsChanged 2 months agoMITView on GitHub

Creates isolated git worktrees for parallel Claude Code sessions, each on its own branch. Use when: (1) /worktree command, (2) user wants to work on multiple branches simultaneously, (3) user has multiple Claude Code sessions conflicting on the same branch, (4) user asks to set up parallel development.

40 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use coverage, backlog 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.
  • 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

  • vertz-devSkill

    backlog

    Manages deferred/blocked work items as GitHub Issues with labels and blocker tracking

    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

  • SentrySkill

    e2e

    Run E2E tests for Sentry JavaScript SDK test applications

    Also in 3 projects that use this

  • nicolasestremSkill

    cleanup

    Clean up code, remove dead code, and optimize project structure

    Also in 3 projects that use this

  • MongoDBSkill

    jira

    Use this skill for any Jira operation in the DOCSP project — creating, viewing, searching, updating, transitioning, commenting on, or linking tickets. Also handles follow-up ticket creation to manage scope creep. TRIGGER when: user mentions a DOCSP-XXXXX ticket number or any Jira ticket URL; user asks to view, open, check, update, transition, close, comment on, link, or search tickets; user references \"the ticket\", \"the Jira\", or \"open a ticket\". SKIP: GitHub issues; non-Jira platforms; questions unrelated to ticket operations.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 5 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 35 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When invoked, follow these steps:

    line 27
  2. Very specific:

    Run the list command to show existing worktrees and available branches.

    line 30
  3. Very specific:

    Use AskUserQuestion with options based on what list returned:

    line 33
  4. Distinctive:

    Create worktree for an existing feature branch

    line 34
  5. Distinctive:

    Create a new feature branch + worktree

    line 35
  6. Distinctive:

    Remove an existing worktree

    line 36
  7. Distinctive:

    Run the appropriate script command.

    line 39
  8. Very specific:

    Use git worktree remove (or the script's remove command) to clean up when done

    line 62

“Common” is measured: kept by at least 6 in 10 of the 35 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

Git Worktree for Parallel Sessions

Problem

Multiple Claude Code sessions sharing one working directory fight over the same branch. Git worktrees give each session its own directory and branch while sharing the same repo.

Quick Reference

# From the repo root:
~/.claude/skills/worktree/scripts/setup-worktree.sh list                                  # Show worktrees + branches
~/.claude/skills/worktree/scripts/setup-worktree.sh create feature/story-10.11             # Existing branch
~/.claude/skills/worktree/scripts/setup-worktree.sh create --new story-10.12-new-feature   # New branch from develop
~/.claude/skills/worktree/scripts/setup-worktree.sh remove feature/story-10.11             # Clean up
~/.claude/skills/worktree/scripts/setup-worktree.sh --help                                 # Full usage

Workflow

When invoked, follow these steps:

Step 1: Show current state

Run the list command to show existing worktrees and available branches.

Step 2: Ask the user what they want

Use AskUserQuestion with options based on what list returned:

  • Create worktree for an existing feature branch
  • Create a new feature branch + worktree
  • Remove an existing worktree

Step 3: Execute

Run the appropriate script command. The script handles:

  • Creating the worktree directory as a sibling (e.g., ../repo-name--branch-suffix/)
  • Fetching from remote if needed
  • Running npm install in backend/frontend/mcp-events-server if node_modules is missing

Step 4: Tell the user what to do next

The script outputs the exact cd + claude command. Relay this clearly.

Naming Convention

Worktree directories are created as siblings of the repo root:

parent-dir/
  repo-name/                          # Main working directory
  repo-name--story-10.11-view/        # Worktree for feature/story-10.11-view
  repo-name--story-10.12-new/         # Worktree for feature/story-10.12-new

Notes

  • Each worktree has its own node_modules — the script installs them automatically
  • A branch checked out in one worktree CANNOT be checked out in another (git enforces this)
  • Worktrees share the same .git history — commits are visible across all worktrees
  • Use git worktree remove (or the script's remove command) to clean up when done

See Also

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.