Skip to content

Commit 004d888

Browse files
committed
refactor: migrate worktree commands from wt/* to claude/* branch prefix
All worktree commands, skills, and guides now use claude/* as the default branch prefix, matching Claude Code's actual worktree behavior. Updated both .claude/commands/ and cli-tool/components/ versions.
1 parent 1641c62 commit 004d888

10 files changed

Lines changed: 1642 additions & 1604 deletions

File tree

.claude/commands/worktree-check.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Then list any existing worktrees and exit.
2525
### Step 2: Show Branch Info
2626

2727
1. Get current branch: `git branch --show-current`
28-
2. Verify it follows the `wt/*` naming convention
28+
2. Verify it follows the `claude/*`, `claude-daniel/*`, or `review/*` naming convention
2929
3. Show how many commits ahead of origin/main: `git rev-list --count origin/main..HEAD`
3030

3131
### Step 3: Read Task
@@ -47,7 +47,7 @@ Present a clean summary:
4747
```
4848
Worktree Status
4949
──────────────────────────────────
50-
Branch: wt/<name>
50+
Branch: claude/<name>
5151
Task: <task description from .worktree-task.md>
5252
Commits: <N> ahead of main
5353
Modified: <N> files

.claude/commands/worktree-cleanup.md

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
allowed-tools: Bash(git:*), Bash(rm:*), Bash(ls:*), Bash(pwd:*), Bash(grep:*)
3-
argument-hint: --all | --branch wt/name | --dry-run
3+
argument-hint: --all | --branch claude/name | --dry-run
44
description: Clean up merged worktrees and their branches
55
---
66

@@ -12,6 +12,15 @@ Remove worktrees and branches that have been merged: $ARGUMENTS
1212

1313
You are in the **main repository** (not a worktree). Clean up finished worktrees.
1414

15+
### Branch Patterns
16+
17+
This project uses the following branch prefixes for worktrees:
18+
- `claude/*` — Claude Code auto-created worktrees
19+
- `claude-daniel/*` — User-created worktrees
20+
- `review/*` — Component review worktrees
21+
22+
All three prefixes must be checked in every step below.
23+
1524
### Step 1: Validate Environment
1625

1726
1. Verify this is the main working tree (first entry in `git worktree list`)
@@ -23,33 +32,43 @@ You are in the **main repository** (not a worktree). Clean up finished worktrees
2332

2433
Parse `$ARGUMENTS` for options:
2534

26-
- `--all` — clean up ALL merged `wt/*` worktrees and branches
27-
- `--branch wt/<name>` — clean up a specific worktree/branch
35+
- `--all` — clean up ALL merged worktrees and branches
36+
- `--branch <prefix>/<name>` — clean up a specific worktree/branch
2837
- `--dry-run` — show what would be cleaned up without doing anything
38+
- `--force-all` — remove ALL worktrees regardless of merge status (asks confirmation per worktree)
2939
- No arguments — list worktrees and ask which to clean up
3040

3141
### Step 3: Identify Worktrees
3242

3343
1. List all worktrees: `git worktree list`
34-
2. List all `wt/*` branches: `git branch --list 'wt/*'`
35-
3. For each `wt/*` branch, check if it's been merged into main:
44+
2. List all matching branches:
3645
```bash
37-
git branch --merged origin/<main-branch> | grep 'wt/'
46+
git branch --list 'claude/*' 'claude-daniel/*' 'review/*'
47+
```
48+
3. For each matching branch, check if it's been merged into main:
49+
```bash
50+
git branch --merged origin/<main-branch> | grep -E '^\s+(claude/|claude-daniel/|review/)'
3851
```
3952
4. Also check remote branches:
4053
```bash
41-
git branch -r --merged origin/<main-branch> | grep 'origin/wt/'
54+
git branch -r --merged origin/<main-branch> | grep -E 'origin/(claude/|claude-daniel/|review/)'
55+
```
56+
5. For squash-merged branches (not detected by `--merged`), check if the branch diff is empty against main:
57+
```bash
58+
# A branch is effectively merged if its changes already exist in main
59+
git diff origin/main...<branch> --stat
4260
```
61+
If the diff is empty or very small (only whitespace), consider it merged.
4362

4463
### Step 4: Display Status
4564

46-
Show a table of all `wt/*` worktrees/branches:
65+
Show a table of all worktrees/branches:
4766

4867
```
49-
| Branch | Worktree Path | Merged? | Action |
50-
|--------|--------------|---------|--------|
51-
| wt/login-page | ../worktrees/repo/wt-login-page | Yes | Will remove |
52-
| wt/auth-bug | ../worktrees/repo/wt-auth-bug | No | Skipped (not merged) |
68+
| # | Worktree | Branch | Merged? | Dirty? | Action |
69+
|---|---------|--------|---------|--------|--------|
70+
| 1 | eager-mendeleev | claude/eager-mendeleev | Yes | Clean | Will remove |
71+
| 2 | agent-a7e312d0 | review/code-reviewer-2026-04-01 | No | Clean | Skipped |
5372
```
5473

5574
### Step 5: Confirm and Execute
@@ -58,7 +77,7 @@ If `--dry-run` was specified, show the table and stop.
5877

5978
Otherwise, use AskUserQuestion to confirm cleanup (unless `--all` was specified with only merged branches).
6079

61-
For each **merged** worktree/branch to clean up:
80+
For each worktree/branch to clean up:
6281

6382
1. Remove the worktree:
6483
```bash
@@ -68,13 +87,13 @@ For each **merged** worktree/branch to clean up:
6887

6988
2. Delete the local branch:
7089
```bash
71-
git branch -d wt/<name>
90+
git branch -d <branch>
7291
```
73-
Use `-d` (not `-D`) — this is safe because it only deletes merged branches.
92+
Use `-d` (not `-D`) for merged branches. For `--force-all` unmerged branches, use `-D` only after explicit user confirmation.
7493

75-
3. Delete the remote branch:
94+
3. Delete the remote branch (if it exists):
7695
```bash
77-
git push origin --delete wt/<name>
96+
git push origin --delete <branch>
7897
```
7998
If the remote branch doesn't exist, ignore the error silently.
8099

@@ -102,4 +121,4 @@ Skipped: <N> unmerged branch(es)
102121

103122
If any unmerged branches were skipped, list them and suggest:
104123
- Merge the PR first, then run cleanup again
105-
- Or use `git worktree remove <path>` and `git branch -D wt/<name>` manually if the work is truly abandoned
124+
- Or use `git worktree remove <path>` and `git branch -D <branch>` manually if the work is truly abandoned

.claude/commands/worktree-deliver.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ You are inside a worktree. Package up the work and deliver it as a PR.
1515

1616
1. Verify this is a worktree (not the main working tree) using `git worktree list`
1717
2. Get current branch: `git branch --show-current`
18-
3. Verify branch follows `wt/*` pattern. If not, warn the user and ask if they want to continue.
18+
3. Verify branch follows `claude/*`, `claude-daniel/*`, or `review/*` pattern. If not, warn the user and ask if they want to continue.
1919
4. Read `.worktree-task.md` if it exists to get the original task description
2020

2121
### Step 2: Review Changes
@@ -112,7 +112,7 @@ gh pr create --base <main-branch> --title "<PR title>" --body "$(cat <<'EOF'
112112
<git diff --stat summary>
113113
114114
---
115-
Created from worktree `wt/<name>` using `/worktree-deliver`
115+
Created from worktree `claude/<name>` using `/worktree-deliver`
116116
EOF
117117
)"
118118
```

.claude/commands/worktree-init.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ If `$ARGUMENTS` is empty, use AskUserQuestion to ask the user to describe their
2828

2929
For each task description:
3030
- Trim whitespace
31-
- Generate a kebab-case branch name: `wt/<kebab-case-task>` (max 50 chars, alphanumeric and hyphens only)
32-
- Generate a worktree directory path: `../worktrees/<repo-name>/wt-<kebab-case-task>`
31+
- Generate a kebab-case branch name: `claude/<kebab-case-task>` (max 50 chars, alphanumeric and hyphens only)
32+
- Generate a worktree directory path: `../worktrees/<repo-name>/claude-<kebab-case-task>`
3333

3434
### Step 3: Create Worktrees
3535

@@ -38,13 +38,13 @@ For each task:
3838
1. Create the parent directory if needed: `mkdir -p ../worktrees/<repo-name>`
3939
2. Create the worktree:
4040
```bash
41-
git worktree add -b wt/<name> ../worktrees/<repo-name>/wt-<name> origin/<main-branch>
41+
git worktree add -b claude/<name> ../worktrees/<repo-name>/claude-<name> origin/<main-branch>
4242
```
4343
3. Write a `.worktree-task.md` file inside the new worktree with this content:
4444
```markdown
4545
# Worktree Task
4646

47-
**Branch:** wt/<name>
47+
**Branch:** claude/<name>
4848
**Task:** <original task description>
4949
**Created:** <ISO date>
5050
**Source repo:** <path to main repo>
@@ -67,7 +67,7 @@ Display a clear summary table:
6767
```
6868
| # | Task | Branch | Path |
6969
|---|------|--------|------|
70-
| 1 | ... | wt/... | ../worktrees/repo/wt-... |
70+
| 1 | ... | claude/... | ../worktrees/repo/claude-... |
7171
```
7272

7373
Then display ready-to-copy commands for Ghostty panels. For each worktree:

cli-tool/components/commands/git-workflow/worktree-check.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Then list any existing worktrees and exit.
2525
### Step 2: Show Branch Info
2626

2727
1. Get current branch: `git branch --show-current`
28-
2. Verify it follows the `wt/*` naming convention
28+
2. Verify it follows the `claude/*`, `claude-daniel/*`, or `review/*` naming convention
2929
3. Show how many commits ahead of origin/main: `git rev-list --count origin/main..HEAD`
3030

3131
### Step 3: Read Task
@@ -47,7 +47,7 @@ Present a clean summary:
4747
```
4848
Worktree Status
4949
──────────────────────────────────
50-
Branch: wt/<name>
50+
Branch: claude/<name>
5151
Task: <task description from .worktree-task.md>
5252
Commits: <N> ahead of main
5353
Modified: <N> files

cli-tool/components/commands/git-workflow/worktree-cleanup.md

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
allowed-tools: Bash(git:*), Bash(rm:*), Bash(ls:*), Bash(pwd:*), Bash(grep:*)
3-
argument-hint: --all | --branch wt/name | --dry-run
3+
argument-hint: --all | --branch claude/name | --dry-run
44
description: Clean up merged worktrees and their branches
55
---
66

@@ -12,6 +12,15 @@ Remove worktrees and branches that have been merged: $ARGUMENTS
1212

1313
You are in the **main repository** (not a worktree). Clean up finished worktrees.
1414

15+
### Branch Patterns
16+
17+
This project uses the following branch prefixes for worktrees:
18+
- `claude/*` — Claude Code auto-created worktrees
19+
- `claude-daniel/*` — User-created worktrees
20+
- `review/*` — Component review worktrees
21+
22+
All three prefixes must be checked in every step below.
23+
1524
### Step 1: Validate Environment
1625

1726
1. Verify this is the main working tree (first entry in `git worktree list`)
@@ -23,33 +32,43 @@ You are in the **main repository** (not a worktree). Clean up finished worktrees
2332

2433
Parse `$ARGUMENTS` for options:
2534

26-
- `--all` — clean up ALL merged `wt/*` worktrees and branches
27-
- `--branch wt/<name>` — clean up a specific worktree/branch
35+
- `--all` — clean up ALL merged worktrees and branches
36+
- `--branch <prefix>/<name>` — clean up a specific worktree/branch
2837
- `--dry-run` — show what would be cleaned up without doing anything
38+
- `--force-all` — remove ALL worktrees regardless of merge status (asks confirmation per worktree)
2939
- No arguments — list worktrees and ask which to clean up
3040

3141
### Step 3: Identify Worktrees
3242

3343
1. List all worktrees: `git worktree list`
34-
2. List all `wt/*` branches: `git branch --list 'wt/*'`
35-
3. For each `wt/*` branch, check if it's been merged into main:
44+
2. List all matching branches:
3645
```bash
37-
git branch --merged origin/<main-branch> | grep 'wt/'
46+
git branch --list 'claude/*' 'claude-daniel/*' 'review/*'
47+
```
48+
3. For each matching branch, check if it's been merged into main:
49+
```bash
50+
git branch --merged origin/<main-branch> | grep -E '^\s+(claude/|claude-daniel/|review/)'
3851
```
3952
4. Also check remote branches:
4053
```bash
41-
git branch -r --merged origin/<main-branch> | grep 'origin/wt/'
54+
git branch -r --merged origin/<main-branch> | grep -E 'origin/(claude/|claude-daniel/|review/)'
55+
```
56+
5. For squash-merged branches (not detected by `--merged`), check if the branch diff is empty against main:
57+
```bash
58+
# A branch is effectively merged if its changes already exist in main
59+
git diff origin/main...<branch> --stat
4260
```
61+
If the diff is empty or very small (only whitespace), consider it merged.
4362

4463
### Step 4: Display Status
4564

46-
Show a table of all `wt/*` worktrees/branches:
65+
Show a table of all worktrees/branches:
4766

4867
```
49-
| Branch | Worktree Path | Merged? | Action |
50-
|--------|--------------|---------|--------|
51-
| wt/login-page | ../worktrees/repo/wt-login-page | Yes | Will remove |
52-
| wt/auth-bug | ../worktrees/repo/wt-auth-bug | No | Skipped (not merged) |
68+
| # | Worktree | Branch | Merged? | Dirty? | Action |
69+
|---|---------|--------|---------|--------|--------|
70+
| 1 | eager-mendeleev | claude/eager-mendeleev | Yes | Clean | Will remove |
71+
| 2 | agent-a7e312d0 | review/code-reviewer-2026-04-01 | No | Clean | Skipped |
5372
```
5473

5574
### Step 5: Confirm and Execute
@@ -58,7 +77,7 @@ If `--dry-run` was specified, show the table and stop.
5877

5978
Otherwise, use AskUserQuestion to confirm cleanup (unless `--all` was specified with only merged branches).
6079

61-
For each **merged** worktree/branch to clean up:
80+
For each worktree/branch to clean up:
6281

6382
1. Remove the worktree:
6483
```bash
@@ -68,13 +87,13 @@ For each **merged** worktree/branch to clean up:
6887

6988
2. Delete the local branch:
7089
```bash
71-
git branch -d wt/<name>
90+
git branch -d <branch>
7291
```
73-
Use `-d` (not `-D`) — this is safe because it only deletes merged branches.
92+
Use `-d` (not `-D`) for merged branches. For `--force-all` unmerged branches, use `-D` only after explicit user confirmation.
7493

75-
3. Delete the remote branch:
94+
3. Delete the remote branch (if it exists):
7695
```bash
77-
git push origin --delete wt/<name>
96+
git push origin --delete <branch>
7897
```
7998
If the remote branch doesn't exist, ignore the error silently.
8099

@@ -102,4 +121,4 @@ Skipped: <N> unmerged branch(es)
102121

103122
If any unmerged branches were skipped, list them and suggest:
104123
- Merge the PR first, then run cleanup again
105-
- Or use `git worktree remove <path>` and `git branch -D wt/<name>` manually if the work is truly abandoned
124+
- Or use `git worktree remove <path>` and `git branch -D <branch>` manually if the work is truly abandoned

cli-tool/components/commands/git-workflow/worktree-deliver.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ You are inside a worktree. Package up the work and deliver it as a PR.
1515

1616
1. Verify this is a worktree (not the main working tree) using `git worktree list`
1717
2. Get current branch: `git branch --show-current`
18-
3. Verify branch follows `wt/*` pattern. If not, warn the user and ask if they want to continue.
18+
3. Verify branch follows `claude/*`, `claude-daniel/*`, or `review/*` pattern. If not, warn the user and ask if they want to continue.
1919
4. Read `.worktree-task.md` if it exists to get the original task description
2020

2121
### Step 2: Review Changes
@@ -112,7 +112,7 @@ gh pr create --base <main-branch> --title "<PR title>" --body "$(cat <<'EOF'
112112
<git diff --stat summary>
113113
114114
---
115-
Created from worktree `wt/<name>` using `/worktree-deliver`
115+
Created from worktree `claude/<name>` using `/worktree-deliver`
116116
EOF
117117
)"
118118
```

cli-tool/components/commands/git-workflow/worktree-init.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ If `$ARGUMENTS` is empty, use AskUserQuestion to ask the user to describe their
2828

2929
For each task description:
3030
- Trim whitespace
31-
- Generate a kebab-case branch name: `wt/<kebab-case-task>` (max 50 chars, alphanumeric and hyphens only)
32-
- Generate a worktree directory path: `../worktrees/<repo-name>/wt-<kebab-case-task>`
31+
- Generate a kebab-case branch name: `claude/<kebab-case-task>` (max 50 chars, alphanumeric and hyphens only)
32+
- Generate a worktree directory path: `../worktrees/<repo-name>/claude-<kebab-case-task>`
3333

3434
### Step 3: Create Worktrees
3535

@@ -38,13 +38,13 @@ For each task:
3838
1. Create the parent directory if needed: `mkdir -p ../worktrees/<repo-name>`
3939
2. Create the worktree:
4040
```bash
41-
git worktree add -b wt/<name> ../worktrees/<repo-name>/wt-<name> origin/<main-branch>
41+
git worktree add -b claude/<name> ../worktrees/<repo-name>/claude-<name> origin/<main-branch>
4242
```
4343
3. Write a `.worktree-task.md` file inside the new worktree with this content:
4444
```markdown
4545
# Worktree Task
4646

47-
**Branch:** wt/<name>
47+
**Branch:** claude/<name>
4848
**Task:** <original task description>
4949
**Created:** <ISO date>
5050
**Source repo:** <path to main repo>
@@ -67,7 +67,7 @@ Display a clear summary table:
6767
```
6868
| # | Task | Branch | Path |
6969
|---|------|--------|------|
70-
| 1 | ... | wt/... | ../worktrees/repo/wt-... |
70+
| 1 | ... | claude/... | ../worktrees/repo/claude-... |
7171
```
7272

7373
Then display ready-to-copy commands for Ghostty panels. For each worktree:

0 commit comments

Comments
 (0)