Skip to content

Commit 38a198a

Browse files
committed
docs: add instructions for creating a new git worktree branch with wt tool
This commit introduces a new documentation file that guides users on how to create a new git worktree branch using the 'wt' tool. It covers analyzing conversation context, generating descriptive branch names following naming conventions, executing the branch creation command with proper sourcing, and confirming success. The instructions aim to standardize branch creation workflows and improve user understanding of the process.
1 parent e21a308 commit 38a198a

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

.claude/commands/wt-branch.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
You are tasked with creating a new git worktree branch using the 'wt' tool based on the recent discussion context and/or user instructions.
2+
3+
## User Instructions
4+
5+
<instructions>
6+
$ARGUMENTS
7+
</instructions>
8+
9+
## Context
10+
11+
Analyze the recent conversation history to understand:
12+
- What feature, fix, or change is being worked on
13+
- Any specific naming preferences mentioned
14+
- The nature of the work (feature, fix, refactor, docs, etc.)
15+
16+
## Your Task
17+
18+
### Step 1: Analyze and Generate Branch Name
19+
20+
Based on the conversation context and user instructions, generate a descriptive branch name that:
21+
22+
1. **Follows strict naming conventions:**
23+
- Use ONLY alphanumeric characters and dashes
24+
- NO slashes, underscores, or special characters
25+
- Use lowercase with hyphens (kebab-case)
26+
- Be descriptive but concise (3-5 words max)
27+
- Include a prefix word if appropriate: `feature-`, `fix-`, `docs-`, `refactor-`, `test-`, etc.
28+
29+
2. **Reflects the work being done:**
30+
- Feature implementation: `feature-name-of-feature`
31+
- Bug fix: `fix-description-of-fix`
32+
- Documentation: `docs-what-docs-changed`
33+
- Refactoring: `refactor-what-refactored`
34+
- Tests: `test-what-tested`
35+
- Chore/maintenance: `chore-what-maintained`
36+
37+
3. **Examples:**
38+
- `feature-workflow-execution-api`
39+
- `fix-dsl-type-inference`
40+
- `docs-setup-guide`
41+
- `refactor-step-state-handling`
42+
- `test-array-step-tests`
43+
44+
### Step 2: Present the Plan
45+
46+
Show the user:
47+
1. The generated branch name
48+
2. A brief explanation of why this name was chosen
49+
3. The command that will be executed
50+
51+
### Step 3: Create the Branch
52+
53+
Execute the command using fish with proper sourcing:
54+
55+
```bash
56+
fish -c "source ~/.dotfiles/wt/wt.fish && wt branch <generated-name> --switch --force"
57+
```
58+
59+
**IMPORTANT:**
60+
- Always use `--switch` to automatically switch to the new worktree
61+
- Always use `--force` to skip confirmation prompts
62+
- Make sure to properly source the wt.fish file before calling wt
63+
- Branch name must only contain alphanumeric characters and dashes
64+
65+
### Step 4: Confirm Success
66+
67+
After execution, confirm that:
68+
1. The branch was created successfully
69+
2. The worktree was created
70+
3. The user is now in the new worktree (if --switch was used)
71+
72+
## Example
73+
74+
If the user is discussing implementing a new error handling system:
75+
76+
```
77+
Based on our discussion about implementing error handling for the workflow engine, I'll create a branch named:
78+
79+
feature-workflow-error-handling
80+
81+
This name reflects that we're adding a new feature (error handling) to the workflow system.
82+
83+
Creating branch and worktree...
84+
```
85+
86+
Then execute:
87+
```bash
88+
fish -c "source ~/.dotfiles/wt/wt.fish && wt branch feature-workflow-error-handling --switch --force"
89+
```

0 commit comments

Comments
 (0)