Skills/commands duplicated when running in a git worktree
Resolved 💬 2 comments Opened Feb 20, 2026 by igerber Closed Feb 20, 2026
Bug Description
When running Claude Code inside a git worktree, all skills from .claude/commands/ appear twice in the system prompt.
Reproduction
- Have a repository with
.claude/commands/tracked in git (containing one or more custom skills). - Create a worktree:
git worktree add ../my-worktree some-branch - Launch Claude Code inside the worktree directory.
- Every skill from
.claude/commands/appears twice in the available skills list in the system prompt.
Root Cause
Claude Code appears to load commands from both the worktree's .claude/commands/ path and the main repository's .claude/commands/ path without deduplicating by name. In a worktree, these resolve to different filesystem paths but contain identical content (since the worktree shares the same git objects).
Expected Behavior
Skills should be deduplicated by name, or Claude Code should only load from the current working tree's .claude/commands/ directory.
Environment
- Started around Feb 18-19, 2026
- macOS (Darwin 24.6.0)
- Reproducible with any repo that has
.claude/commands/and uses git worktrees
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗