Last active
March 2, 2026 17:12
-
-
Save panozzaj/4b64f9f362f8da757ffdad5fcef90054 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| For CLAUDE.md and rules it looks upwards, finding every CLAUDE.md or ./claude/rules, or .claude/skills dirs. | |
| Hooks are a bit more complex it looks like, where it looks at root, etc. | |
| Possibly worst-case, you could symlink or make a little script that pulls in the right files based on project/technology, etc.? | |
| . | |
| ├── .claude | |
| │ └── settings.local.json | |
| ├── .gitignore | |
| └── dir1 | |
| ├── .claude | |
| │ ├── rules | |
| │ │ └── testing.md --> For testing, use RSpec with --apple flag. | |
| │ ├── settings.json | |
| │ └── skills | |
| │ └── skill1 | |
| │ └── SKILL.md | |
| └── dir2 | |
| ├── .claude | |
| │ ├── rules | |
| │ │ └── testing.md --> For testing, use RSpec with --banana flag. | |
| │ ├── settings.json | |
| │ └── skills | |
| │ └── skill2 | |
| │ └── SKILL.md | |
| └── dir3 | |
| ├── .claude | |
| │ ├── rules | |
| │ │ └── testing.md --> For testing, use RSpec with --cherry flag. | |
| │ ├── settings.json | |
| │ └── skills | |
| │ └── skill3 | |
| │ └── SKILL.md | |
| └── foo.txt | |
| --- | |
| ╭─── Claude Code v2.1.63 ────────────────────────────────────────────────────────────────────────────────────────────────╮ | |
| │ ~/…/2026-03-02-claude-hooks-test/dir1/dir2/dir3 │ │ | |
| ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ | |
| ❯ how do we do testing on this project? | |
| ⏺ Based on the project rules, there are testing instructions at three directory levels, all specifying RSpec but with different flags: | |
| - dir1/ — rspec --apple | |
| - dir1/dir2/ — rspec --banana | |
| - dir1/dir2/dir3/ (current directory) — rspec --cherry | |
| Since you're currently in dir1/dir2/dir3, the most specific rule applies: use RSpec with the --cherry flag. | |
| ... | |
| No, hooks do not load recursively from nested directories. | |
| Claude Code only loads hooks from these scopes (concatenated, not replaced): | |
| 1. Managed (server-managed) | |
| 2. Project — .claude/settings.json at the project root only | |
| 3. User — ~/.claude/settings.json | |
| 4. Local — .claude/settings.local.json at the project root | |
| So for your setup, only the root-level .claude/settings.local.json hooks (the jj_snapshot one) would actually run. The settings.json files I created in dir1/, dir1/dir2/, and | |
| dir1/dir2/dir3/ would be ignored — Claude Code doesn't walk subdirectories looking for additional .claude/settings.json files. | |
| There's also a known bug (#10367) where hooks fail entirely when Claude Code is invoked from a subdirectory rather than the project root. | |
| If you want all three hooks to run, they'd need to be combined into the single root-level .claude/settings.json (or settings.local.json). | |
| --- | |
| ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── | |
| ❯ /sk | |
| ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── | |
| /skill3 Skill from dir3 level (project) | |
| /skill2 Skill from dir2 level (project) | |
| /skill1 Skill from dir1 level (project) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment