[BUG] Project commands don't take precedence over user commands as documented
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?
Project Commands Don't Take Precedence Over User Commands
When a project command (.claude/commands/*.md) and user command (~/.claude/commands/*.md) share the same name, the user command executes instead of the project command, contradicting the documented behavior.
Environment
- Claude Code Version: 2.0.76 (latest as of 2025-01-01)
- Platform: macOS (Darwin 23.6.0)
- Installation: Native
What Should Happen?
According to the official documentation:
"If a project command and user command share the same name, the project command takes precedence and the user command is silently ignored."
Actual Behavior
- Both commands appear in autocomplete (user command should be silently ignored)
- User command is highlighted first in autocomplete
- User command executes when pressing Enter (project command should execute)
Error Messages/Logs
Autocomplete Output
When typing /prep, both commands appear:
/prep Load context for a new agent session (user)
/prep Load project context (project)
The user command is highlighted first by default.
Debug Logs
With claude --debug, the logs show:
Loaded 2 unique skills (managed: 0, user: 0, project: 0, legacy commands: 2)
All commands are categorized as "legacy" with no user/project distinction. This appears to be the bug. The 2 commands from ~/.claude/commands/ and .claude/commands/ are all categorized as "legacy commands" instead of being tagged as user: 1, project: 1.
Steps to Reproduce
- Create a user command:
``bash``
mkdir -p ~/.claude/commands
cat > ~/.claude/commands/prep.md << 'EOF'
---
description: Load context for a new agent session
---
# Prep (User)
This is the USER command
EOF
- Create a project command with the same name:
``bash``
mkdir -p .claude/commands
cat > .claude/commands/prep.md << 'EOF'
---
description: Load project context
---
# Prep (Project)
This is the PROJECT command
EOF
- Start Claude Code in the project directory:
``bash``
claude
- Type
/prepand observe autocomplete
- Press Enter to execute
Expected: Project command executes, user command silently ignored
Actual: User command executes
Claude Model
None
Is this a regression?
No idea.
Last Working Version
_No response_
Claude Code Version
2.0.76
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
default model (currently Sonnet 4.5)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗