You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use git worktrees in /fix skill and align pre-commit validation (#8411)
Switch the /fix skill from branch-switching to git worktrees so the main
repo stays on its current branch while fixes are developed in isolated
worktree directories at ../website-worktrees/fix-<issue-number>.
Also align the pre-commit validation step with CLAUDE.md — let the
pre-commit hook handle rubocop/brakeman instead of running them manually.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
The first phase is purely planning. You must **NOT** make any changes to git state (switching branches, creating branches etc). You should presume that other work is SIMULTANEOUSLY happening WHILE you are planning.
25
+
The first phase is purely planning. You must **NOT** make any changes to git state (switching branches, creating branches, creating worktrees, etc). You should presume that other work is SIMULTANEOUSLY happening WHILE you are planning.
26
26
27
27
Once the plan has been **APPROVED** by the user you should check the current git state:
28
28
29
-
- Run `git status` to check for uncommitted changes and the current branch.
30
-
- If there are **uncommitted or staged changes**, STOP and ask the user how to proceed. Do NOT checkout another branch, stash, or discard anything.
31
-
- If you are **not on main**, STOP and ask the user how to proceed. Do NOT switch branches or reset.
29
+
- Run `git status` to check for uncommitted changes.
30
+
- If there are **uncommitted or staged changes**, STOP and ask the user how to proceed. Do NOT stash or discard anything.
32
31
33
32
Never destroy or discard existing work.
34
33
35
-
If the plan has been approved, and you are on a clean main branch, continue with your work.
34
+
If the plan has been approved and the working tree is clean, continue with your work.
36
35
37
36
## Workflow
38
37
@@ -50,7 +49,7 @@ Read the relevant `docs/context/` files for the area of the codebase involved.
50
49
51
50
### Step 2: Plan the fix
52
51
53
-
**Do NOT create a branch yet.** Stay on the current branch while planning.
52
+
**Do NOT create a branch or worktree yet.** Stay on the current branch while planning.
54
53
55
54
Use /plan to enter plan mode. Explore the codebase thoroughly:
56
55
@@ -62,37 +61,40 @@ Use /plan to enter plan mode. Explore the codebase thoroughly:
62
61
63
62
Design a complete fix before writing any code.
64
63
65
-
### Step 3: Create a feature branch
64
+
### Step 3: Create a worktree
66
65
67
-
Only create the branch**after the plan is approved**. The issue number has been extracted above (works whether the argument was a full URL like `https://github.com/exercism/website/issues/8370` or just `8370`).
66
+
Only create the worktree**after the plan is approved**. The issue number has been extracted above (works whether the argument was a full URL like `https://github.com/exercism/website/issues/8370` or just `8370`).
**Important:** After creating the worktree, `cd` into it immediately. All subsequent work (file edits, bash commands, tests) happens inside the worktree. The main repo stays untouched on its current branch.
76
+
75
77
### Step 4: Implement the fix
76
78
77
-
After the plan is approved and the branch is created, implement the changes:
79
+
After the plan is approved and the worktree is created, implement the changes:
78
80
79
81
- Follow existing patterns and conventions in the codebase
80
82
- Business logic belongs in `/app/commands/` using the Mandate pattern
81
83
- Keep controllers thin — delegate to commands
82
84
- Add or update tests as appropriate (Minitest, FactoryBot)
83
85
- Keep changes minimal and focused on the issue
84
86
85
-
### Step 5: Run pre-commit validation
87
+
### Step 5: Run tests
86
88
87
-
Run all three checks. All must pass before committing:
89
+
Run the relevant tests for the changes you made:
88
90
89
91
```bash
90
-
bundle exec rubocop --except Metrics
91
-
yarn test
92
-
bundle exec rails test:zeitwerk
92
+
bundle exec rails test<test-file-or-directory>
93
93
```
94
94
95
-
If any check fails, fix the issues and re-run until all pass.
95
+
If you made front-end changes, also run `yarn test` before committing.
96
+
97
+
Rubocop and brakeman will be checked automatically by the pre-commit hook when you commit — you do not need to run them manually.
0 commit comments