[BUG] Project skills not discovered when HOME equals cwd when using --setting-sources project
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When using --setting-sources project, project skills in .claude/skills/ are not discovered if the HOME environment variable equals the current working directory.
The directory walk function checks if (cwd === homedir) break before checking if .claude/skills/ exists at that directory, so the loop exits immediately without finding any skills. In normal CLI usage this is masked because skills also load via the user settings path (~/.claude/skills/), but with --setting-sources project that fallback is disabled.
What Should Happen?
When using --setting-sources project, skills at .claude/skills/ should be discovered even when HOME equals cwd. The directory walk should inspect each directory for .claude/skills/ before checking stop conditions.
Error Messages/Logs
Steps to Reproduce
- Create a project with a skill:
``bash``
mkdir -p /tmp/test-skills/.claude/skills/hello
cat > /tmp/test-skills/.claude/skills/hello/SKILL.md << 'EOF'
---
name: Hello
description: Say hello
---
Say hello to the user
EOF
- Run Claude Code with
HOMEset to the project directory:
``bash``
cd /tmp/test-skills && HOME=/tmp/test-skills claude --setting-sources project
- Type
/skills
- Result: "No skills found" — despite
.claude/skills/hello/SKILL.mdexisting at cwd.
- For comparison, without the
HOMEoverride skills are found:
``bash``
cd /tmp/test-skills && claude
# /skills → "Hello" is listed
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.41
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Also reproducible on AWS EC2 Amazon Linux 2023.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗