PluginBench
Skill
Review
Audit score 70

ce-worktree

everyinc/compound-engineering-plugin

Set up isolated git worktrees for parallel work without disturbing your main checkout.

What is ce-worktree?

Creates isolated git worktrees to enable parallel development on separate branches. Use when starting isolated work or when ce-work/ce-code-review offers a worktree option. Always detects existing isolation first to avoid redundant creation.

  • Detects whether you're already in an isolated worktree and works in place if so
  • Prefers native harness worktree tools (EnterWorktree, WorktreeCreate, /worktree commands) over git fallback
  • Creates worktrees under .worktrees/ directory with meaningful branch names from work descriptions
  • Ensures .worktrees/ is gitignored before creation to prevent accidental commits
  • Handles permission/sandbox errors with blocking user confirmation before proceeding
  • Provides git commands for listing, switching, and removing worktrees

How to install ce-worktree

npx skills add https://github.com/everyinc/compound-engineering-plugin --skill ce-worktree
Prerequisites
  • Git repository with remote origin configured (or local branches as fallback)
  • Write permissions to the repository directory
  • Harness support for worktree operations (Claude Code, Cursor, Codex, etc.)
Claude Code
Cursor
Windsurf
Cline

How to use ce-worktree

  1. 1.Check if you're already in an isolated worktree using git rev-parse commands; if so, work in place
  2. 2.If not isolated, check whether your harness provides a native worktree tool and use it if available
  3. 3.If no native tool exists, navigate to the repo root with cd $(git rev-parse --show-toplevel)
  4. 4.Verify .worktrees/ is in .gitignore; add it if missing
  5. 5.Run git fetch origin <base-branch> to refresh the base branch (non-fatal if it fails)
  6. 6.Create the worktree with git worktree add -b <branch-name> .worktrees/<branch-name> origin/<base-branch>
  7. 7.Switch into the new worktree with cd .worktrees/<branch-name>
  8. 8.If git worktree add fails with permission errors, use your harness's blocking question tool to confirm next steps

Use cases

Good for
  • Review a pull request while keeping your current checkout free for other work
  • Run multiple features in parallel without the overhead of branch-switching
  • Isolate experimental work from your main development branch
  • Maintain separate worktrees for different team members working on the same repo
Who it's for
  • Developers working on multiple features or branches simultaneously
  • Code reviewers who need to examine PRs without disrupting active work
  • Teams using compound-engineering workflows with ce-work or ce-code-review

ce-worktree FAQ

What if I'm already in a worktree?

Step 0 detects this by comparing absolute git directories. If you're already isolated, the skill reports your worktree path and current branch, then works in place without creating a redundant worktree.

Why prefer native harness tools over git worktree?

Native tools let the harness track, navigate to, and clean up worktrees. A behind-the-back git worktree add creates phantom state the harness cannot manage.

What happens if git worktree add fails?

The skill uses a blocking question tool (AskUserQuestion, request_user_input, etc.) to ask whether to work in the current checkout or stop and resolve the permission issue. It never silently continues in the current checkout.

How do I remove a worktree?

Use git worktree remove .worktrees/<branch-name>. If you're currently in that worktree, cd out first, then remove it.

Can I use worktrees for single-task work?

No — worktrees are best for parallel work or PR reviews. For single-task work on a branch, use the current checkout to avoid overhead.

Full instructions (SKILL.md)

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


name: ce-worktree description: Set up isolated git worktrees. Use when starting isolated work, or when ce-work/ce-code-review offers a worktree option; detect existing isolation first.

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 — detect that first and do not create a redundant one.

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

Step 0: Detect existing isolation

Before creating anything, check whether the current directory is already a linked worktree. Compare the resolved absolute git dir against the resolved absolute common git dir — resolve each to an absolute path first and compare those, not the raw git rev-parse output. 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

If the two absolute paths are equal, this is a normal checkout — continue to Step 1.

If they differ, you are in a linked worktree or a submodule. Distinguish them:

git rev-parse --show-superproject-working-tree
  • Non-empty output -> you are in a submodule; treat it as a normal checkout and continue to Step 1.
  • Empty output -> you are already in an isolated worktree. Report the worktree path (git rev-parse --show-toplevel) and current branch, and work in place. Do not create another worktree — a worktree-from-worktree lands in the wrong tree and is invisible to the harness that made the current one.

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. The .worktrees/ and .gitignore paths below are repo-root-relative, but the skill runs from the user's current directory, which may be a subdirectory — so move to the root first: cd "$(git rev-parse --show-toplevel)". Without this, .worktrees/<branch> and the .gitignore edit would land in the subdirectory (e.g. src/.worktrees/..., src/.gitignore) instead of at the repo root.
  2. Choose a meaningful branch name from the work description (e.g. feat/login, fix/email-validation) — avoid opaque auto-generated names. Pick a base branch (default: origin's default branch, else main).
  3. Ensure .worktrees/ is gitignored before creating anything, so worktree contents are never committed: check git check-ignore -q .worktrees/with the trailing slash, so an existing directory-only .worktrees/ rule is honored even before the directory exists (git check-ignore .worktrees without the slash would miss it and dirty a correctly-configured repo). If it is not ignored, add a .worktrees/ line to .gitignore.
  4. Best-effort refresh the base branch without disturbing the current checkout: git fetch origin <from-branch>. This is non-fatal — if it errors (no origin remote, a differently-named remote, or a local-only branch), do not abort; continue to the next step and use the local ref.
  5. Create the worktree from the remote base when available, else the local ref: git worktree add -b <branch-name> .worktrees/<branch-name> origin/<from-branch>. If origin/<from-branch> does not exist, use the local <from-branch> ref instead.
  6. Switch into it: cd .worktrees/<branch-name>.

If git worktree add fails with a sandbox or permission error, the requested isolation could not be created. This needs a blocking user decision before touching the current checkout — do not silently continue there (the user chose isolation specifically to avoid it, especially when ce-work / ce-code-review routed here for the worktree option). Report the failure and ask via the platform's blocking question tool: AskUserQuestion in Claude Code (call ToolSearch with select:AskUserQuestion first if its schema isn't loaded), request_user_input in Codex, ask_question in Antigravity CLI (agy), ask_user in Pi (via the pi-ask-user extension) — offering options such as "work in the current checkout" vs "stop and resolve the permission issue". If no blocking tool exists in the harness or the call errors, present the numbered options in chat and wait for the reply; never skip the confirmation. Only work in the current checkout on explicit confirmation, and do not retry alternative paths automatically.

Other worktree operations

Use git directly — no wrapper is needed:

git worktree list                          # list worktrees
git worktree remove .worktrees/<branch>    # remove a worktree
cd .worktrees/<branch>                     # switch to a worktree
cd "$(git rev-parse --show-toplevel)"      # return to the current checkout root

When to create a worktree

Create one (Step 1/2) only when you are not already isolated and you need a separate workspace:

  • Reviewing a PR while keeping the current checkout free for other work
  • Running multiple features in parallel without branch-switching overhead

Do not create a worktree for single-task work that can happen on a branch in the current checkout — and never when Step 0 shows you are already in one.

Integration

ce-work and ce-code-review offer this skill as an option. When the user selects "worktree" in those flows, run Step 0 first: if the work is already isolated, proceed in place; otherwise create one (native tool preferred) with a meaningful branch name derived from the work description.

Troubleshooting

"Worktree already exists": the path is in use. Switch to it (cd .worktrees/<branch>) or remove it (git worktree remove .worktrees/<branch>) before recreating.

"Cannot remove worktree: it is the current worktree": cd out of the worktree first, then git worktree remove.

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