[BUG] Command silently blocked when skill directory has same name and user-invocable: false
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?
Bug Description
When a custom command in .claude/commands/ has the same name as a skill directory
in .claude/skills/, invoking the command via /command-name silently fails with:
> This skill can only be invoked by Claude, not directly by users.
> Ask Claude to use the "explain-code" skill for you.
The command never executes. There is no indication that a naming conflict exists.
## Steps to Reproduce
- Create a skill:
.claude/skills/explain-code/SKILL.mdwithuser-invocable: false - Create a command:
.claude/commands/explain-code.md - Type
/explain-codein Claude Code
## Expected Behavior
The command in .claude/commands/ should execute, or the user should receive a clear
error explaining the naming conflict.
## Actual Behavior
The skill resolution takes priority over command resolution. Since the skill is marked
user-invocable: false, the user sees a blocking error and the command never runs.
## Impact
- Commands are silently shadowed by skills with the same directory name
- No warning about the naming conflict at load time or invocation time
- Workaround: rename the skill directory or the command file
## Environment
- Claude Code CLI
- macOS
What Should Happen?
Steps to Reproduce
- Create skill directory:
.claude/skills/explain-code/SKILL.md
with user-invocable: false in frontmatter
- Create command file:
.claude/commands/explain-code.md
with any valid command content
- Type
/explain-codein Claude Code chat - Observe: command never runs, skill error appears instead
Error Messages/Logs
Steps to Reproduce
What Should Happen?
One of the following (in order of preference):
- Commands take priority over skills —
.claude/commands/should always
win over .claude/skills/ when names collide, since commands are explicit
user-defined entry points.
- Conflict detected at startup — Claude Code should warn on launch if a
command name collides with a skill directory name, e.g.:
> Warning: command "explain-code" is shadowed by skill "explain-code"
> (user-invocable: false). The command will never be reachable.
- Clear error at invocation time — instead of the generic skill error,
show something actionable:
> "/explain-code" could not run: blocked by skill with same name
> (user-invocable: false). Rename .claude/skills/explain-code/
> or .claude/commands/explain-code.md to resolve the conflict.
Currently none of the above happens — the command silently disappears.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.59
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗