claude-code
claude-code copied to clipboard
Project commands don't override global commands (precedence reversed)
Description
According to the documentation, project commands (.claude/commands/) should take precedence over global/user commands (~/.claude/commands/). However, in practice, global commands take precedence over project commands.
From the docs:
If a project command and user command share the same name, the project command takes precedence and the user command is silently ignored.
Steps to Reproduce
-
Create a global command:
mkdir -p ~/.claude/commands echo "Global version of the command" > ~/.claude/commands/my-command.md -
Create a project command with the same name:
mkdir -p .claude/commands echo "Project-specific version" > .claude/commands/my-command.md -
Run
/my-commandin the project
Expected Behavior
The project command should run: "Project-specific version"
Actual Behavior
The global command runs instead: "Global version of the command"
Environment
- Restarted Claude Code multiple times
- Tested in multiple projects
- Both files confirmed to exist in correct locations
Workaround
Remove the global command so only project commands exist.