PluginBench
Skill
Pass
Audit score 90

ce-worktree

everyinc/compound-engineering-plugin

Create isolated git worktrees for parallel development without disturbing your main checkout.

What is ce-worktree?

Sets up isolated git worktrees to work on branches, PRs, or commits in separate directories. Use this when you need a clean, isolated workspace for new features or to work on an existing branch without affecting your primary checkout.

  • Detects existing worktree isolation and works in place if already isolated
  • Creates new branches in isolated worktrees for fresh work
  • Attaches worktrees to existing branches, PRs, or commits
  • Enforces one-branch-per-worktree rule to prevent conflicts
  • Manages `.worktrees/` directory with proper gitignore configuration
  • Falls back to native harness worktree tools when available

How to install ce-worktree

npx skills add https://github.com/everyinc/compound-engineering-plugin --skill ce-worktree
Prerequisites
  • Git repository with a configured remote (origin recommended)
  • Write permissions in the repository directory
  • Bash or POSIX shell environment
Claude Code
Cursor
Windsurf
Cline

How to use ce-worktree

  1. 1.Call the skill with either a new branch name or an existing ref (branch, PR, or commit)
  2. 2.The skill detects if you're already in an isolated worktree and works in place if so
  3. 3.For new work: specify a meaningful branch name; the skill creates it from origin's default branch
  4. 4.For existing refs: provide the PR number, branch name, or commit hash
  5. 5.The skill reports the worktree path and current branch when ready
  6. 6.Navigate to the reported path and begin work

Use cases

Good for
  • Start a new feature branch in isolation while keeping main checkout clean
  • Attach a worktree to an open PR to review and iterate on changes
  • Work on multiple branches simultaneously without switching contexts
  • Isolate a specific commit for investigation without affecting current work
  • Prepare a detached worktree for fork-safe PR checkout workflows
Who it's for
  • Developers working with multiple branches in parallel
  • Teams using git worktrees for isolated development
  • Code reviewers examining PRs in separate workspaces
  • Anyone needing clean separation between concurrent work streams

ce-worktree FAQ

What if I'm already in a worktree?

The skill detects existing isolation and works in place, avoiding nested worktrees that would be invisible to the harness.

Can I check out the same branch in two worktrees?

No. Git enforces one-branch-per-worktree. If the branch is already checked out elsewhere, the skill reports its location and lets you decide whether to work there or create a detached worktree at the same commit.

What happens if git worktree add fails?

The skill reports the failure and asks for confirmation before proceeding, offering options like working in the current checkout or resolving the permission issue.

How are worktrees organized?

Worktrees are stored in a `.worktrees/` directory at the repo root, which is automatically added to `.gitignore` to keep them out of version control.

Does this work with PRs?

Yes. For PRs, the skill fetches the PR head as a local branch and creates a worktree for it, enabling fork-safe workflows with proper push-tracking back to the PR.

Full instructions (SKILL.md)

Source of truth, from everyinc/compound-engineering-plugin.


name: ce-worktree description: Set up isolated git worktrees — create a new branch for fresh work, or attach a worktree to an existing branch, PR, or commit. Use when starting isolated work or isolating an existing ref.

Worktree Isolation

Ensure the current work happens in an isolated workspace, without disturbing the user's main checkout. Most coding harnesses now create a worktree by default at session start, so the common case is that isolation already exists.

Done when: the caller is working in an isolated tree — existing or newly created — and its path and branch have been reported, or a blocker has been reported instead.

Order of operations: detect existing isolation -> prefer a native worktree tool -> fall back to plain git. Never create a worktree the harness cannot see.

Two modes, set by the caller's need:

  • New work (default). No ref named — create a fresh branch from a base (trunk). This is what ce-work and ce-code-review use when the user picks the worktree option.
  • Isolate an existing ref. The caller names a PR head, branch, or commit — attach the worktree to that ref instead of creating a new branch. A branch can be checked out in only one worktree at a time. If the named ref is already checked out anywhere (most commonly as the primary checkout's current branch), do not create a second worktree — report that it is already checked out at <path> and let the caller act (work there in place; or, only if a clean separate tree is essential, create a detached worktree at the same commit).

Step 0: Detect existing isolation

Compare the resolved absolute git dir against the resolved absolute common git dir. Git mixes absolute and relative forms depending on the current directory (from a subdirectory of a normal checkout, --git-dir comes back absolute while --git-common-dir may be relative), so a raw string compare yields a false "already isolated":

git rev-parse --absolute-git-dir                     # absolute git dir for this worktree
(cd "$(git rev-parse --git-common-dir)" && pwd -P)   # absolute shared (common) git dir

Equal -> normal checkout; continue to Step 1.

Different -> a linked worktree or a submodule. Distinguish with git rev-parse --show-superproject-working-tree:

  • Non-empty -> submodule; treat it as a normal checkout and continue to Step 1.
  • Empty -> already isolated. Report the worktree path (git rev-parse --show-toplevel) and current branch, then work in place — a worktree-from-worktree lands in the wrong tree and is invisible to the harness that made the current one. In isolate-an-existing-ref mode, check that ref out here (unless it is already current) rather than nesting a worktree.

Step 1: Prefer the harness's native worktree tool

If the harness provides a native worktree primitive — for example an EnterWorktree / WorktreeCreate tool, a /worktree command, or a --worktree flag — use it and stop. Native tools place, track, and clean up the worktree so the harness can manage it. A behind-the-back git worktree add creates phantom state the harness cannot see, navigate to, or clean up.

Step 2: Git fallback

Only when there is no native tool and Step 0 found no existing isolation.

  1. Run from the repo root: cd "$(git rev-parse --show-toplevel)". The paths below are repo-root-relative, but the skill runs from the user's current directory — without this, .worktrees/<branch> and the .gitignore edit land in a subdirectory (e.g. src/.worktrees/...).
  2. Choose a meaningful branch name from the work description (e.g. feat/login, fix/email-validation) — never an opaque auto-generated one. Base: origin's default branch, else main.
  3. Ensure .worktrees/ is gitignored before creating anything: git check-ignore -q .worktrees/ — with the trailing slash, so an existing directory-only .worktrees/ rule is honored even before the directory exists (without the slash the probe misses it and dirties a correctly-configured repo). Not ignored -> add a .worktrees/ line to .gitignore.
  4. Refresh the base with git fetch origin <from-branch>. This is non-fatal — no origin remote, a differently-named remote, or a local-only branch is not an abort; continue with the local ref.
  5. Create the worktree, per mode:
    • New work: git worktree add -b <branch-name> .worktrees/<branch-name> origin/<from-branch> (use the local <from-branch> ref if origin/<from-branch> does not exist).
    • Existing branch or tag: git worktree add .worktrees/<slug> <target-ref>.
    • PR: check it out on a local branch — git fetch origin pull/<n>/head:pr-<n> then git worktree add .worktrees/pr-<n> pr-<n>. Never a detached FETCH_HEAD: that orphans the fix loop's commits instead of updating the PR. (For push-tracking back to the PR, create it detached — git worktree add --detach .worktrees/pr-<n> — then cd in and run gh pr checkout <n>, which is fork-safe.)
    • If git reports the ref is already checked out elsewhere, apply the one-branch-one-worktree rule above — do not force a second worktree.
  6. cd into it, then report the path and branch.

If git worktree add fails with a sandbox or permission error, the requested isolation does not exist. Do not proceed in the current checkout — the user chose isolation specifically to avoid it. Report the failure and ask, offering options such as "work in the current checkout" vs "stop and resolve the permission issue", using the host's blocking question tool already in the current tool list (match by capability, not by a host-specific name). Presence in the current tool list is proof the tool exists; never call a user-facing question tool to discover whether it exists. If a matching tool is listed but unloaded, use the host's tool-discovery primitive to load that capability — do not search for another host's tool name. Only when no such tool is in the list or a real question call errors, present the numbered options in chat and wait for the reply. Never skip the confirmation, and do not retry alternative paths automatically.

Related skills

More from everyinc/compound-engineering-plugin and the wider catalog.

COcoding-tutor logo

coding-tutor

everyinc/compound-engineering-plugin

Personalized coding tutorials that evolve with your knowledge, using your actual codebase and spaced repetition.

2.5k installs
COcompound-docs logo

compound-docs

everyinc/compound-engineering-plugin

Capture solved problems as categorized documentation with YAML frontmatter for fast lookup

1.5k installsAudited
DHdhh-rails-style logo

dhh-rails-style

everyinc/compound-engineering-plugin

This skill should be used when writing Ruby and Rails code in DHH's distinctive 37signals style. It applies when writing Ruby code, Rails applications, creating models, controllers, or any Ruby file. Triggers on Ruby/Rails code generation, refactoring requests, code review, or when the user mentions DHH, 37signals, Basecamp, HEY, or Campfire style. Embodies REST purity, fat models, thin controllers, Current attributes, Hotwire patterns, and the "clarity over cleverness" philosophy.

709 installs
FRfrontend-design logo

frontend-design

everyinc/compound-engineering-plugin

Build web interfaces with genuine design quality, not AI slop. Use for any frontend work - landing pages, web apps, dashboards, admin panels, components, interactive experiences. Activates for both greenfield builds and modifications to existing applications. Detects existing design systems and respects them. Covers composition, typography, color, motion, and copy. Verifies results via screenshots before declaring done.

625 installsAudited
GEgemini-imagegen logo

gemini-imagegen

everyinc/compound-engineering-plugin

This skill should be used when generating and editing images using the Gemini API (Nano Banana Pro). It applies when creating images from text prompts, editing existing images, applying style transfers, generating logos with text, creating stickers, product mockups, or any image generation/manipulation task. Supports text-to-image, image editing, multi-turn refinement, and composition from multiple reference images.

625 installs
GIgit-worktree logo

git-worktree

everyinc/compound-engineering-plugin

This skill manages Git worktrees for isolated parallel development. It handles creating, listing, switching, and cleaning up worktrees with a simple interactive interface, following KISS principles.

626 installs