Skip to content
Agentmart
Submit a tool

using-git-worktrees

Chooses single-branch or wt-stack review topology and uses task-specific Git worktrees before changing files in a repository.

Skill by chadxz

IndexedMIT★ 3
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/chadxz-using-git-worktrees

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Chooses single-branch or wt-stack review topology and uses task-specific Git worktrees before changing files in a repository. Use for repository edits, non-trivial work with ordered review units, and workspaces managed by Conductor.build, Cursor, Codex.app, Claude Code, or other coding agents.

Use cases: productivity, agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 26, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/using-git-worktrees

What's inside

Skill name
using-git-worktrees
Description
Chooses single-branch or wt-stack review topology and uses task-specific Git worktrees before changing files in a repository. Use for repository edits, non-trivial work with ordered review units, and workspaces managed by Conductor.build, Cursor, Codex.app, Claude Code, or other coding agents.
License
MIT
Instructions
262 lines in SKILL.md · view on GitHub

Files (4)

  • SKILL.md
  • openai.yaml · agents/
  • resolve-worktree · scripts/
  • test-resolve-worktree · scripts/

SKILL.md (first lines)

# Using Git Worktrees

Use this before changing files in a Git repo. The goal is to keep each task in
its own working tree, branch, dependencies, and verification state.

Chad's repositories use the bare container layout owned by the
`cloning-repositories` skill: a bare repository at `<repo>/.git` with worktrees
directly under `<repo>/`, and the default branch worktree at `<repo>/main`. Read
that skill for clone commands and layout details. Do not use a normal checkout
at the repository root and do not put task worktrees under `.worktrees/`.

## When to use this

Use the workflow for file-changing work inside a Git repository. Skip it for
read-only tasks, discussion, research, or commands that do not modify repo
files.

## Start with the current state

Resolve an existing worktree before running status, diff, build, test, or
file-changing commands. Run the bundled read-only resolver from this skill's
directory:

```bash
scripts/resolve-worktree --cwd "$PWD" --mode write
```

When the task names a repository, branch, or pull request, pass it directly:

```bash
scripts/resolve-worktree \
  --repo ~/src/convergint/ee-monorepo \
  --branch agent/fix-sftp-tenant-validation \
  --mode write

scripts/resolve-worktree \
  --pr convergint/ee-monorepo#5678 \
  --mode write
```

The resolver never creates a branch or worktree. It reports the repository
container, selected worktree, branch, head SHA, dirty state, default-branch
status, mise trust state, and whether a pull request worktree matches the
current PR head. Use its absolute `worktree` value as the working directory for
every later command.

The resolver requires Bash and Git. JSON output requires `jq`, and pull request
resolution also requires `gh`.

Write mode refuses the default-branch worktree unless `--allow-main` is
explicitly provided. If no matching worktree exists, continue through the
topology decision below and create one only after choosing a single branch or
Stack. Re-run the resolver after creation to verify the selected checkout.

Treat unrelated dirty work as user-owned. Do not move, stage, revert, clean, or
overwrite another checkout's changes unless the user explicitly asks.

## Keep the default worktree current

Fetch the remote default branch before using it as the base for a new task
worktree. Also fetch whenever status, branch comparisons, or another command
shows that the default-branch worktree may be behind:

```bash
git -C <repo-container> fetch origin <default-branch>
git -C <main-worktree> status --short --branch
git -C <main-worktree> rev-list --left-right --count \
  <default-branch>...origin/<default-branch>
```

The counts are local-ahead and local-behind, in that order. When the default
worktree is clean and the counts are `0 N`, where `N` is greater than zero,
update it immediately without waiting for another request:

```bash
scripts/resolve-worktree \
  --repo <repo-container> \
  --main \
  --mode write \
  --allow-main

git -C <main-worktree> merge --ff-only origin/<default-branch>
```

`--allow-main` applies only to this synchronization. Do not make task changes in
the default worktree.

If the default worktree is dirty, ahead, or diverged, do not stash, reset,
rebase, merge, or overwrite it. Treat its state as user-owned and report why a
safe fast-forward was not possible. Base new work on the fetched remote default
branch when that lets the task continue without modifying the blocked worktree.

## Choose the necessary scope

Before choosing branches, state the observed failure and the behavior the user
needs after the fix. Find the boundary responsible for that failure and check
its existing configuration and supported interfaces first.

Choose the smallest safe change that delivers that behavior. For each proposed
migration, abstraction, helper script, release change, test harness, or
operating procedure, ask whether the requested fix would still work without it.
Leave out work that isn't needed for the outcome. Keep prerequisites required
for correctness, safety, or compatibility in scope and explain why they're
needed.

A dependency bot that can't look up a private Terraform provider may only need a
registry URL override and scoped credentials. Changing the application's
provider source, installation workflow, state, and release pipeline requires a
separate reason; sharing the same provider doesn't make those changes necessary.

If a narrow fix starts requiring a migration guide, a new wrapper, or several
layers of validation scaffolding, reconsider the boundary before adding more.
Prefer existing validation commands and a focused check of the failed behavior.
Complete the requested fix and surface useful broader improvements separately;
don't make them prerequisites or create follow-up work without a request.

## Choose the review topology

Decide how reviewers should receive the work before creating the first task

From chadxz/prompts, MIT.

More from chadxz/prompts

Signals

Stars
3
Forks
1
Open issues
0
Last commit (this folder)
Oct 16, 2026 (13 days ago)
Last release
Oct 15, 2026 (15 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from chadxz

Cite this page

using-git-worktrees skill. Agent Mart. https://agentmart.dev/skills/chadxz-using-git-worktrees (last updated 2026-10-24)