# Worktrees

> Worktrees is an open-source agent skill for developer tools. Sets up isolated git worktrees so parallel agent tasks don't collide. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/zerotechdebt/ffflow/tree/main/plugin/skills/worktrees
- **Repository:** https://github.com/zerotechdebt/ffflow
- **GitHub stars:** 6
- **License:** Apache-2.0
- **Skill name:** worktrees
- **Collection:** https://github.com/zerotechdebt/ffflow
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill gives the agent a set of conventions and git commands for running several tasks side by side in separate git worktrees. Worktrees are placed under a worktrees/ folder at the project root, which should be gitignored, and branches follow a task-numbered naming pattern so each branch can be traced back to its plan.

The skill covers creating a worktree on a new or existing branch, checking whether the current directory is a worktree, listing and pruning entries, and removing them. It also sets cleanup rules: worktrees for merged tasks are offered for removal, while stalled or failed ones are kept until the user decides, and uncommitted work is never removed automatically.

For projects using compose-based runtimes, it describes how each worktree gets its own compose project, database name and port offset, and how to stop services and drop volumes before removal. It also lists common troubleshooting steps and anti-patterns to avoid. It expects git and, for the runtime section, the FFFlow justfile setup.

## When your agent uses it

> Isolated worktree management for parallel work — naming convention, creation, cleanup, troubleshooting.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/zerotechdebt/ffflow/tree/HEAD/plugin/skills/worktrees)
- [License: Apache-2.0](https://github.com/zerotechdebt/ffflow/tree/HEAD/plugin/skills/worktrees)

## Features

- **Worktree placement convention:** Defines where worktrees live in the project tree and why they stay out of the temp directory and the git folder.
- **Branch naming pattern:** Gives a task-numbered branch naming scheme that ties each branch to its originating plan.
- **Create and remove commands:** Lists the git worktree commands for adding, removing, listing and pruning worktrees.
- **Cleanup discipline:** Specifies when worktrees should be removed after merge and when they should be retained for inspection.
- **Per-worktree runtime isolation:** Explains how compose projects, ports and database names are derived per worktree when a compose runtime is configured.
- **Troubleshooting guide:** Covers common worktree errors such as branches already checked out and port allocation conflicts.

## Good for

- Set up a separate worktree for a new task branch
- Run several coding tasks in parallel without file conflicts
- Clean up worktrees after their pull requests are merged
- Find and prune worktrees whose directories were deleted
- Start isolated database and app services for a worktree

## Install

### Claude Code

This skill ships in the `fff` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add zerotechdebt/ffflow
/plugin install fff@ffflow
```

Or copy only this skill to `~/.claude/skills/worktrees`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/worktrees &&
cp -R "$tmp/plugin/skills/worktrees" ~/.claude/skills/worktrees &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/worktrees` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/worktrees` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/worktrees &&
cp -R "$tmp/plugin/skills/worktrees" ~/.agents/skills/worktrees &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/worktrees` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/worktrees` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/worktrees &&
cp -R "$tmp/plugin/skills/worktrees" ~/.cursor/skills/worktrees &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/worktrees` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/zerotechdebt/ffflow.git --path plugin/skills/worktrees
```

Or copy the folder to `~/.gemini/skills/worktrees` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/worktrees`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/worktrees &&
cp -R "$tmp/plugin/skills/worktrees" ~/.copilot/skills/worktrees &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/worktrees` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git
```

Then copy `ffflow/plugin/skills/worktrees` into your agent's skills folder as `worktrees`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Where does this skill put worktrees?

By default under a worktrees/ folder at the project root, which should be added to .gitignore.

### Does it remove worktrees automatically?

No. It says not to auto-remove, and removal of worktrees with uncommitted changes requires user confirmation.

### What naming pattern does Worktrees use for branches?

Branches follow task/<plan>/task-<N>-<short-title>, for example task/password-rules/task-2-signup-integration.

### Does Worktrees need any scripts?

The skill itself ships no scripts; it relies on git commands, and the runtime section refers to justfile recipes in another skill.

### How do I install Worktrees in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/worktrees to use it in all your projects, or to .claude/skills/worktrees in one project. Or install the fff plugin, which includes it: /plugin marketplace add zerotechdebt/ffflow, then /plugin install fff@ffflow.

### Does Worktrees run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Worktrees?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to Worktrees?

The closest alternatives to Worktrees are Git worktree, Worktrees, Wt, Harness read write base repo path in worktree stale tree and Git clean worktrees.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Git worktree](https://ai-powered.com/skills/git-worktree): Git worktree is an open-source agent skill for developer tools.
- [Worktrees](https://ai-powered.com/skills/worktrees-richardgill-4): Worktrees is an open-source agent skill for developer tools.
- [Wt](https://ai-powered.com/skills/wt-timvw): Wt is an open-source agent skill for developer tools.
- [Harness read write base repo path in worktree stale tree](https://ai-powered.com/skills/harness-read-write-base-repo-path-in-worktree-stale-tree): Harness read write base repo path in worktree stale tree is an open-source agent skill for developer tools.
- [Git clean worktrees](https://ai-powered.com/skills/git-clean-worktrees): Git clean worktrees is an open-source agent skill for developer tools.
- [Create worktree](https://ai-powered.com/skills/create-worktree): Create worktree is an open-source agent skill for developer tools.
- [Git workflow](https://ai-powered.com/skills/git-workflow-nabwinsaud): Git workflow is an open-source agent skill for developer tools.
- [Vibe workstream orchestration](https://ai-powered.com/skills/vibe-workstream-orchestration): Vibe workstream orchestration is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/worktrees
