---
title: "using-git-worktrees skill: an isolated worktree for agent work"
canonical_url: https://cookiesforai.app/skills/obra/using-git-worktrees
last_updated: 2026-10-02T01:58:30+02:00
type: skill
summary: "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."
install: "/plugin install superpowers@claude-plugins-official"
related:
  - "https://cookiesforai.app/skills/getsentry/code-review"
  - "https://cookiesforai.app/skills/openai/gh-address-comments"
  - "https://cookiesforai.app/skills/openai/gh-fix-ci"
  - "https://cookiesforai.app/skills/getsentry/iterate-pr"
  - "https://cookiesforai.app/skills/obra/brainstorming"
  - "https://cookiesforai.app/skills/obra/diagnosing-superpowers"
  - "https://cookiesforai.app/skills/obra/dispatching-parallel-agents"
  - "https://cookiesforai.app/skills/obra/executing-plans"
---

# 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.

| Fact | Value |
|---|---|
| Publisher | Jesse Vincent |
| Source | https://github.com/obra/superpowers/tree/HEAD/skills/using-git-worktrees |
| License | MIT |
| Repository stars | 293,976 on 2026-10-02 |
| Skill name | using-git-worktrees |
| Category | Code review and Git |
| Skill last changed | 2026-07-24 |
| Page updated | 2026-10-02 |
| Facts checked | 2026-10-02 |

## Install

In Claude Code, install the whole Superpowers plugin from Anthropic's official marketplace:

```
/plugin install superpowers@claude-plugins-official
```

Or install only this skill with the skills CLI:

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

## Ask your coding agent

A skill can include scripts that run on your computer, so read its source first: https://github.com/obra/superpowers/tree/HEAD/skills/using-git-worktrees

```text
Install the agent skill using-git-worktrees from github.com/obra/superpowers.
```

## What it 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 it

- 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 it works in

Jesse Vincent documents it 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 (listed with the CLI on 2026-10-01).

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.

## License

MIT.

## Related

### Related skills for code review and git

- [Code review](https://cookiesforai.app/skills/getsentry/code-review): code-review is Sentry's agent skill for reviewing pull requests by Sentry's engineering practices: runtime errors, performance, side effects, compatibility, security, design, tests and the tone of feedback.
- [GitHub address comments](https://cookiesforai.app/skills/openai/gh-address-comments): gh-address-comments is OpenAI's agent skill for pull request review feedback: the agent fetches every comment and review thread on the open PR, numbers them, and fixes only the ones you pick.
- [GitHub fix CI](https://cookiesforai.app/skills/openai/gh-fix-ci): gh-fix-ci is OpenAI's agent skill for failing pull request checks: the agent uses the GitHub CLI to find failing GitHub Actions runs, pulls the logs, summarizes the failure and proposes a fix plan.
- [Iterate on PR](https://cookiesforai.app/skills/getsentry/iterate-pr): iterate-pr is Sentry's agent skill that keeps working on a GitHub pull request until CI passes and high and medium priority review comments are fixed, using bundled scripts and the gh CLI.

### More from Jesse Vincent

- [Brainstorming](https://cookiesforai.app/skills/obra/brainstorming): Brainstorming is an agent skill from Superpowers that makes your coding agent work out what you want and agree a design with you before it writes any code.
- [Diagnosing Superpowers](https://cookiesforai.app/skills/obra/diagnosing-superpowers): Diagnosing Superpowers is an agent skill from Superpowers that reads a session's transcripts when work went wrong and reports what happened, with every finding tied to a file and line.
- [Dispatching Parallel Agents](https://cookiesforai.app/skills/obra/dispatching-parallel-agents): Dispatching Parallel Agents is an agent skill from Superpowers: when several problems are independent, your agent sends a focused subagent to each at once, then checks the results together.
- [Executing Plans](https://cookiesforai.app/skills/obra/executing-plans): Executing Plans is an agent skill from Superpowers in which your agent works through a written plan itself, task by task with tests, then gets one fresh review of the whole branch.

