agentleFS
oprogramadorrealoprogramadorreal/optimus-claude/skills/worktree/SKILL.md

worktree

Skill75 starsChanged 2 months agoMITView on GitHub

Creates a git worktree for isolated parallel development — new branch in a separate directory with project setup and test baseline. Enables multiple Claude Code sessions on different tasks simultaneously. May append .worktrees/ to .gitignore (left unstaged); never commits or pushes. Multi-repo aware. Use when you need to work on something else without disturbing current work.

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

  • 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, 0 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 47 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Create a git worktree under .worktrees/ on a new branch, with project setup and a test baseline.

    line 9
  2. Very specific:

    Read $CLAUDE_PLUGIN_ROOT/skills/worktree/references/worktree-setup.md and run its worktree detection guard.

    line 19
  3. Very specific:

    Follow the Setup procedure from worktree-setup.md with <branch-name> and <original-branch>.

    line 38
  4. Very specific:

    If Setup modified .gitignore, add after "Main workspace": .gitignore updated to ignore .worktrees/ (left unstaged.

    line 54
  5. Very specific:

    Never commit or push in the main workspace.

    line 56

“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

Create a git worktree under .worktrees/ on a new branch, with project setup and a test baseline. The main workspace stays on its original branch, so each worktree can host an independent Claude Code session.

Workflow

1. Target repo

If git rev-parse --is-inside-work-tree does not return true, read $CLAUDE_PLUGIN_ROOT/skills/init/references/multi-repo-detection.md and apply it. When it returns true, resolve the repository root with git rev-parse --show-toplevel, including in a linked worktree or subdirectory. In a multi-repo workspace, run all git commands inside the target child repo: use the repo the user specified; if ambiguous, use AskUserQuestion — header "Target repo", question "Which repo should the worktree be created for?", one option per repo.

2. Detection guard

Read $CLAUDE_PLUGIN_ROOT/skills/worktree/references/worktree-setup.md and run its worktree detection guard. If already inside a linked worktree, tell the user:

Already running inside a worktree (`<worktree-path>`).
To create another worktree, run this skill from the main workspace instead.

Then stop — never create nested worktrees.

3. Branch

Note the current branch as <original-branch>. Derive the task description from the invocation argument or the conversation; if neither gives enough signal, ask what the user will work on — follow up until you have a concrete description, not a category. Read $CLAUDE_PLUGIN_ROOT/skills/commit/references/branch-naming.md for the <type>/<slug> convention and collision handling, then create the branch without switching:

git branch <branch-name>

4. Create worktree

Follow the Setup procedure from worktree-setup.md with <branch-name> and <original-branch>. On failure, follow its Failure handling, delete the unused branch (git branch -d <branch-name>), then stop.

5. Report

## Worktree Created

Working directory: `.worktrees/<worktree-dir>`
Branch: `<branch-name>` (from `<original-branch>`)
Main workspace: `<original-branch>` (unchanged)
Tests: passing / failing (pre-existing — N failures) / no test command detected

Open it: `code .worktrees/<worktree-dir>` (VSCode), or start a new session of the current coding agent in that directory.
Cleanup when done: `git worktree remove .worktrees/<worktree-dir>`

If Setup modified .gitignore, add after "Main workspace": .gitignore updated to ignore .worktrees/ (left unstaged; existing index preserved). In a multi-repo workspace, prefix all report paths with the target repo directory.

Never commit or push in the main workspace; it must end on <original-branch>.

Recommend starting a fresh session inside the new worktree to begin the work there.

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.