Skip to content

Commit 69d5412

Browse files
derekallmanclaude
andcommitted
docs: make CLAUDE.md worktree-compatible
- Switch pre-commit hook install from symlink to `git config core.hooksPath` (works in worktrees where .git is a file, not a directory) - Add Worktrees section to Git Workflow: branch semantics, data/ symlink requirement, .venv setup, relative path rule Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent dabbac1 commit 69d5412

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

CLAUDE.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@ cargo test -p hotcoco -p hotcoco-cli # 3. Tes
177177

178178
The hook excludes `hotcoco-pyo3` from tests (it's a cdylib with no Rust tests). Clippy runs on the full workspace to match CI.
179179

180-
To install the hook (one-time setup):
180+
To install the hook (one-time setup — works in both main repo and worktrees):
181181

182182
```bash
183-
ln -sf ../../.github/hooks/pre-commit .git/hooks/pre-commit
183+
git config core.hooksPath .github/hooks
184184
```
185185

186186
If formatting fails, run `cargo fmt --all` to fix, then re-commit. If clippy fails, fix the warning before committing. Never suppress clippy warnings with allows. Never skip the hook with `--no-verify`.
@@ -194,6 +194,16 @@ If formatting fails, run `cargo fmt --all` to fix, then re-commit. If clippy fai
194194
- Main branch: `main`.
195195
- **Standard pre-commit sequence:** `/simplify``/review``/ship``/commit`. Run all four in order when a feature is done.
196196

197+
### Worktrees
198+
199+
Sessions may run in a git worktree (e.g. `.claude/worktrees/<name>/`). Worktrees share the same `.git` history but have their own branch and working directory.
200+
201+
- **Commits land on the worktree branch**, not `main`. When the user says "push", they likely mean push to `main`. Use `git -C <main-repo> cherry-pick <hash>` then push from the main repo, or ask to confirm.
202+
- **`data/` is gitignored** and won't exist in a fresh worktree. Scripts that need COCO data (`parity.py`, `bench.py`) require a symlink: `ln -s /Users/derek/coco-rust/data data`
203+
- **`.venv`** is created per-worktree by `just setup`. Run it once in a new worktree.
204+
- **Pre-commit hook** uses `git config core.hooksPath` (not a symlink), so it works in both the main repo and worktrees.
205+
- **All paths in skills and scripts must be relative** — never hardcode the main repo path.
206+
197207
### Before every commit — communication surfaces
198208

199209
Run `/ship` before committing. It enforces these gates in order:

0 commit comments

Comments
 (0)