claude-code
claude-code copied to clipboard
[BUG] Claude Code not finding custom commands in ~/.claude/commands or ./claude/commands
Environment
- Platform (select one):
- [X] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- Claude CLI version: 0.2.124
- Operating System: Windows 11 - Ubuntu WSL
- Terminal: Windows Terminal
Bug Description
Claude Code CLI tool fails to discover and load custom commands stored in the expected directories (~/.claude/commands or ./claude/commands).
Steps to Reproduce
- Create a test.md file under ~/.claude/commands or ./claude/commands
- Start Claude CLI with claude command
- No custom commands appear when trying to access via /user:test or /project:test
Expected Behavior
Files under ~/.claude/commands should load as /user: commands and ./claude/commands should load as /project: commands in the Claude CLI.
Actual Behavior
No custom commands available
Debugging Information
- Verified that the command files exist in the correct locations
- No error messages are displayed when claude starts or with --debug
Additional Context
Custom commands were functioning correctly in previous versions. This issue appeared after the latest update.
I tested loading claude from a new directory and the /user:* prompts showed up. If I renamed the folder in ~/.claude/projects to a different name, the prompts showed up for existing projects when I restarted Claude
I'm having this same issue.
I don't use /user: commands and mostly have only /project: commands, but I can't seem to get them to load.
This happened with a recent update of about 2 days ago if I'm not mistaken.
Same issue, started happening to me today.
Hi! Are you running claude from the same directory that your .claude folder is in, or from another directory?
Hi! Are you running
claudefrom the same directory that your.claudefolder is in, or from another directory?
Yes, running from an existing project with a .claude/commands folder does not load the .md files as /project: command or the user scoped ones.
- Running claude for the first time in a new folder loads them correctly
- renaming the project file in ~/.claude/projects will fix an older projects.
Started seeing this yesterday. Today with 0.2.126 it seems to have gone from intermittently loading .claude/commands to never loading.
Same issue
I'm having the same issue too. Also with v1
This fixed the issue for me on MacOS: (I believe its some kind of caching issue)
1. Stop Claude Code
pkill -f claude
2. Backup your commands
cp -r .claude/commands/ ~/Desktop/claude-commands-backup/
3. Remove all Claude Code data
rm -rf ~/.claude/ rm -rf ~/Library/Preferences/com.anthropic.claude-code.plist rm -rf ~/Library/Caches/com.anthropic.claude-code/ rm -rf ~/Library/Application\ Support/Claude\ Code/
4. Reinstall Claude Code
npm uninstall -g @anthropic-ai/claude-code npm install -g @anthropic-ai/claude-code
5. Restore commands
mkdir -p .claude/commands/ cp -r ~/Desktop/claude-commands-backup/* .claude/commands/
Same issue here
For me, running rm -r ~/.claude/projects/-path-to-your-project (and restarting the session?) resolved the issue where commands were not being recognized with / on WSL Ubuntu.
What I ended up doing was modifying .claude/settings.json and adding the 'cleanupPeriodDays' and kept lowering it and re-loading Claude. It eventually got rid of whichever JSONL was causing the problem. Prior to this I tried jq and all passed validation, so who knows. But I am just happy to have my custom commands back.
For me, running
rm -r ~/.claude/projects/-path-to-your-project(and restarting the session?) resolved the issue where commands were not being recognized with/on WSL Ubuntu.
This seems to be the simplest solution on WSL Ubuntu.
I ran running into this issue on a Ubuntu machine that is not WSL, but SSH'd via VS Code in from a Windows computer (if that is relevant).
Running rm -rf ~/.claude/projects and relaunching the session fixed it for me.
I started using the function below to remove the last n history json file(s) and this seems working.
cld_reset_history() {
# Delete the latest n JSONL files from Claude project history
# Usage: cld_reset_history [num_files]
# Default: deletes 1 file if num_files not specified
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
RED='\033[0;31m'
NC='\033[0m'
echo_success() { echo -e "${GREEN}$@${NC}"; }
echo_warning() { echo -e "${YELLOW}$@${NC}"; }
echo_error() { echo -e "${RED}$@${NC}"; }
local num_files=${1:-1}
local current_path="$(realpath $(pwd))"
local cld_project_name=$(echo "$current_path" | sed 's|/|-|g' | sed 's|\.|-|g' | sed 's|_|-|g')
local cld_history_dir="$HOME/.claude/projects/$cld_project_name"
if [ ! -d "$cld_history_dir" ]; then
echo_error "Claude project directory not found: $cld_history_dir"
return 1
fi
files_to_delete=($(ls -t --color=never "$cld_history_dir"/*.jsonl 2>/dev/null | head -n $num_files))
if [ ${#files_to_delete[@]} -eq 0 ]; then
echo_warning "No JSONL files found"
return 1
fi
for file in "${files_to_delete[@]}"; do
rm -f "$file"
if [ ! -f "$file" ]; then
echo_success "Deleted: $(basename $file)"
else
echo_error "Failed to remove: $(basename $file)"
fi
done
}
I'm still seeing this today on version 1.0.31 on macos. What's more concerning is that commands don't work at all, this isn't just an auto-completion/UX issue. For example I have a custom command at ~/.claude/commands/commit.md, and if I type /user:commit in Claude it doesn't even load the file.
sadly the shared workarounds aren't usable for me because I don't even have a projects directory under ~/.claude
Really crazy that such a huge issue has been open for a month with no fix.
Hi @rcdailey
I noticed that the prefix syntax for user/project level specification has been removed in recent versions. The new format appears to be /commit <markdown contents> (user), though I am not sure for MacOS.
Watch out with newer versions of claude code on macos. For some reason my configuration path changed from
~/.claude to ~/.config/claude
Moving my commands folder to ~/.config/claude fixes the issue of not discovering commands for me.
See #1455
Yes via another issue I realized that nothing was actually broken, there's just apparently a lack of proper documentation updates when changes are made to claude code. I verified everything works great after moving all my files to ~/config/claude.
Thanks for the follow up replies!
Looks like there might be a bug in v1.0.62 on native Windows that makes it not recognize commands anymore. Downgrading and disabling auto updates fixed the issue for me.
npm un -g @anthropic-ai/claude-code
npm i -g @anthropic-ai/[email protected]
claude config set -g autoUpdates disabled
Just be sure to turn autoUpdates back on once the issue is resolved.
Edit: Looks like that autoUpdate config isn't honored and claude still updates once it starts up 🙄
Looks like there might be a bug in v1.0.62 on native Windows that makes it not recognize commands anymore. Downgrading and disabling auto updates fixed the issue for me.
npm un -g @anthropic-ai/claude-code
npm i -g @anthropic-ai/[email protected] claude config set -g autoUpdates disabled Just be sure to turn autoUpdates back on once the issue is resolved.Edit: Looks like that autoUpdate config isn't honored and claude still updates once it starts up 🙄
Thank you, this method is very helpful
This should be resolved in v1.0.63.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.