using-git-worktrees

Using Git Worktrees

Using Git Worktrees is an agent skill from Superpowers: before feature work, your agent makes sure it is in an isolated git worktree, sets up the project and checks that the tests pass.

Checked by CookiesForAI on : license and last change of the skill re-read from GitHub.

Written by

Install Using Git Worktrees

Install only this skill with the skills CLI

Terminal
npx skills add obra/superpowers --skill using-git-worktrees

Or, in Claude Code, install the whole Superpowers plugin from Anthropic's official marketplace

Agent chat
/plugin install superpowers@claude-plugins-official

Or paste this into your coding agent: Install the agent skill using-git-worktrees from github.com/obra/superpowers. Checked by CookiesForAI on : license and last change of the skill re-read from GitHub. A skill can include scripts that run on your computer, so read its source first.

What Using Git Worktrees does

Using Git Worktrees is one of the skills in Superpowers, Jesse Vincent's open-source method for AI coding agents. It loads before feature work that needs isolation from the current workspace, and before executing an implementation plan. It first checks whether the agent is already in a linked worktree, with a guard for git submodules, and if so it creates nothing new. In a normal checkout it asks for your consent, unless your instructions already state a preference.

To create the workspace under Using Git Worktrees, the agent prefers a native tool from its harness, such as an EnterWorktree tool or a /worktree command, and falls back to git worktree add only when none exists. For the fallback it uses a directory named in your instructions, then an existing .worktrees/ or worktrees/ folder, then .worktrees/ by default. It checks that the folder is git-ignored, and adds it to .gitignore and commits if not.

Using Git Worktrees then runs the project setup it detects (npm install, cargo build, pip or poetry install, go mod download) and runs the tests to confirm a clean baseline. If the tests fail, it reports the failures and asks whether to continue. If a sandbox blocks worktree creation, it tells you and works in the current directory instead.

When to use Using Git Worktrees

  • You want your agent to build a feature without touching the branch you are working on.
  • You want each piece of work to start from a clean checkout with passing tests.
  • You are about to have an agent carry out an implementation plan.

Which agents Using Git Worktrees works in

Jesse Vincent documents Using Git Worktrees for Claude Code, Codex (app and CLI), Cursor, Gemini CLI, GitHub Copilot CLI, OpenCode, Antigravity, Devin CLI, Factory Droid, Grok Build CLI, Kimi Code, Pi, Qwen Code, Hermes Agent, Muse. The open skills CLI also installs it into 78 agents, including Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode (we listed it with the CLI on ). See where each agent looks for skills.

Superpowers is written in Claude Code's vocabulary (subagent dispatch, todos, the Skill tool) and ships tool mappings for Codex, Gemini CLI, Pi, Antigravity, Hermes Agent and Muse. Installed as the full plugin, a session-start hook loads Using Superpowers so the agent reaches for skills on its own; one skill installed with the skills CLI gets no hook and may point to sibling skills you do not have.

Using Git Worktrees license

Using Git Worktrees is published under MIT.

More from Jesse Vincent

Lists that include using-git-worktrees