[BUG] Slash commands/skills in .claude/commands/ not discovered when using symlinks (regression)
Summary
Symlinked .md files and directories inside .claude/commands/ are not discovered as slash commands. This is a regression -- symlinks were followed correctly in earlier versions (confirmed working in 2.1.87) but fail silently in 2.1.89.
Reproduction Steps
- Create a directory with command files elsewhere on the filesystem:
``bash``
mkdir -p ~/my-shared-commands/mytools
echo "Do something useful." > ~/my-shared-commands/mytools/hello.md
- Symlink into your project's
.claude/commands/:
``bash``
mkdir -p .claude/commands/mytools
ln -sf ~/my-shared-commands/mytools/hello.md .claude/commands/mytools/hello.md
- Verify the symlink resolves:
``bash``
file .claude/commands/mytools/hello.md
# Reports: Unicode text, UTF-8 text
cat .claude/commands/mytools/hello.md
# Shows content correctly
- Start Claude Code -- the command
/mytools:hellodoes not appear in the slash command list.
- Remove the symlink and copy the file instead:
``bash``
rm .claude/commands/mytools/hello.md
cp ~/my-shared-commands/mytools/hello.md .claude/commands/mytools/hello.md
- Restart Claude Code -- the command now appears correctly.
Also affects directory symlinks
Symlinks pointing to directories containing nested .md command files also fail discovery.
Expected Behavior
Symlinked .md files in .claude/commands/ (and .claude/skills/) should be discovered and loaded as slash commands, just as regular files are. This worked in version 2.1.87.
Actual Behavior
Symlinks are silently ignored during command discovery. No error message is shown. Commands only work when files are real (non-symlinked).
Use Case
Shared command libraries across multiple projects. A common pattern is to maintain a central repository of reusable commands and symlink them into each project's .claude/commands/ directory. This avoids duplication and keeps commands in sync across projects.
Environment
- Claude Code 2.1.89 (broken)
- Claude Code 2.1.87 (working)
- macOS Darwin 24.5.0 (Apple Silicon)
- Symlink targets are on the same filesystem (not cross-mount)
Suggested Fix
The file discovery mechanism for commands/skills should follow symlinks (e.g., use fs.stat instead of fs.lstat, or pass appropriate flags to the directory walker). Since the Read tool already follows symlinks correctly, this appears to be an inconsistency in the discovery code path.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗