claude-code - 💡(How to fix) Fix [BUG] Skills and hooks not available in worktrees created by `claude -w` [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45054Fetched 2026-04-09 08:14:23
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×4commented ×2

Error Message

Error Messages/Logs

Root Cause

As a result:

  • Skills defined in .claude/skills/ are not loaded in the worktree session
  • Hook scripts referenced by relative paths (e.g. node .claude/hooks/foo.js) fail because the path resolves against the worktree directory, not the project root
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Skills and hooks not available in worktrees created by claude -w

What Should Happen?

When creating a worktree with claude -w <name>, Claude Code places it at .claude/worktrees/<name>. This causes the .claude/ directory discovery logic to resolve to .claude/worktrees/<name>/.claude/ (which only contains a copied settings.local.json) instead of the project root's .claude/.

As a result:

  • Skills defined in .claude/skills/ are not loaded in the worktree session
  • Hook scripts referenced by relative paths (e.g. node .claude/hooks/foo.js) fail because the path resolves against the worktree directory, not the project root

Error Messages/Logs

Steps to Reproduce

  1. Have a project at D:/Code/MyProject with skills in .claude/skills/ and hooks in .claude/hooks/
  2. Run claude -w feat-123 — worktree is created at .claude/worktrees/feat-123
  3. Open the worktree session — skills are missing, hooks fail to execute

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.96

Platform

Other

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

No response

extent analysis

TL;DR

The issue can be fixed by adjusting the directory discovery logic in Claude Code to correctly resolve the project root's .claude/ directory in worktree sessions.

Guidance

  • The problem arises because the .claude/ directory discovery logic resolves to .claude/worktrees/<name>/.claude/ instead of the project root's .claude/ when creating a worktree with claude -w <name>.
  • To verify the issue, check if skills defined in .claude/skills/ are loaded and hook scripts referenced by relative paths execute correctly in the worktree session.
  • A potential workaround could involve manually adjusting the settings.local.json file in the worktree's .claude/ directory to point to the correct locations of skills and hooks in the project root.
  • The root cause seems to be related to the directory resolution logic, which may need to be updated to handle worktree scenarios correctly.

Example

No code snippet is provided as the issue does not explicitly mention specific code that needs to be changed.

Notes

The provided information does not specify the exact changes needed to the directory discovery logic or settings.local.json, so any adjustments would need to be explored and tested carefully.

Recommendation

Apply workaround: Adjust the settings.local.json file in the worktree's .claude/ directory to point to the correct locations of skills and hooks in the project root, as this seems to be a regression and the previous working version is not specified.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING