Using Git Worktrees Skill logo

Using Git Worktrees Skill

Visit

Superpowers' worktree skill gives coding agents an isolated workspace: detect existing isolation, prefer native tools, then fall back to git worktree.

Share:
View alternatives

Using Git Worktrees is a skill from Superpowers (skill source). It runs when feature work needs isolation from your current checkout, typically after a design is approved and before a plan is executed, and makes sure the agent works in a separate workspace on its own branch with a clean test baseline.

Its principle: detect existing isolation first, then use native tools, then fall back to git. Never fight the harness.

Key Features

  • Step 0, detect: compare git rev-parse --git-dir with --git-common-dir to see whether the agent is already in a linked worktree, with a guard so git submodules are not mistaken for worktrees.
  • Consent: unless your instructions already state a preference, the agent asks before creating a worktree, and works in place if you decline.
  • Native first: if the harness has its own worktree tool (such as a /worktree command or an EnterWorktree-style tool), the agent uses it, because a manual worktree creates state the harness cannot see.
  • Git fallback: otherwise git worktree add <path> -b <branch> under .worktrees/ (preferred) or worktrees/, after git check-ignore confirms the directory is ignored.
  • Setup and baseline: auto-detects npm install, cargo build, pip install, poetry install or go mod download, then runs the tests and reports the baseline.
  • Sandbox fallback: if the sandbox blocks worktree creation, the agent says so and works in the current directory.

Use Cases

Pricing

Free and open source under the MIT license. Prime Radiant, the company behind Superpowers, sells commercial support to enterprises. The practical cost is tokens: process skills add questions, reviews and subagent runs.

Getting Started

Superpowers installs as one plugin, so this skill arrives with the rest of the library (15 skills in v6.4.1). In Claude Code run /plugin install superpowers@claude-plugins-official. Cursor uses /add-plugin superpowers, Gemini CLI uses gemini extensions install https://github.com/obra/superpowers, and the README lists commands for Codex, GitHub Copilot CLI, OpenCode, Pi and other harnesses. Skills trigger on their own; you can also ask for one by name. The workflow skills call it; you can also ask for "an isolated worktree for this feature".

Limitation: each worktree needs its own dependency install, which costs disk and time on large projects. Cleanup belongs to Finishing a Development Branch.

FAQ

Why ask before creating a worktree?

It changes your filesystem layout, so the skill treats it as your call unless you have already stated a preference.

What if tests fail at baseline?

The agent reports the failures and asks whether to proceed.

Alternatives

  • Conductor: a Mac app that runs parallel Claude Code instances in isolated copies.
  • Orca ADE: runs several coding agents side by side in worktrees.
  • cmux: a terminal built for juggling many agent sessions.

Conclusion

Small, careful and harness-aware. It keeps agent work off your main branch. More in the skills hub.

Comments

No comments yet. Be the first to comment!