[BUG] Custom slash commands not discovered in ~/.claude/commands/ despite correct setup
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?
Custom slash commands stored in ~/.claude/commands/*.md are not being discovered or
loaded by Claude Code 2.0.5. Commands do not appear in autocomplete.
Interestingly, hooks configured in ~/.claude/settings.json work perfectly, proving
that configuration loading works but the filesystem scanning mechanism for discovering
commands seems broken.
All command files are properly formatted with required frontmatter, correct filenames,
and proper permissions. Multiple restarts and troubleshooting steps have been
attempted with no success.
What Should Happen?
Custom commands in ~/.claude/commands/*.md should be:
- Automatically discovered on Claude Code startup
- Available as slash commands (e.g., /debug, /test, /analyze-codebase)
- Listed in autocomplete when typing /
- Executable when invoked
Error Messages/Logs
No error messages appear. Commands simply don't exist - typing / only shows built-in
commands, and attempting to invoke custom commands results in "Unknown slash command"
error.
# When trying to invoke custom command:
/debug
Error: Unknown slash command: /debug
Diagnostic output:
Diagnostics
└ Currently running: npm-local (2.0.5)
└ Path: /Users/DINGZEEFS/.nvm/versions/node/v23.9.0/bin/node
└ Invoked: /Users/DINGZEEFS/.claude/local/node_modules/.bin/claude
└ Config install method: local
└ Auto-updates enabled: default (true)
└ Search: OK (vendor)
Steps to Reproduce
- Create the commands directory:
mkdir -p ~/.claude/commands
- Create a test command file ~/.claude/commands/test.md:
---
description: Simple test command
---
# Test Command
This is a test command. Arguments: $ARGUMENTS
The test command is working!
- Verify the file exists and has correct permissions:
ls -la ~/.claude/commands/test.md
# Should show: -rw-r--r-- 1 user staff 134 Oct 3 11:47 test.md
- Exit Claude Code completely (close terminal)
- Open a new terminal and start Claude Code:
claude
- Type / to see available commands
- Expected: /test appears in the list
Actual: Only built-in commands appear, /test is missing
- Try to invoke the command:
/test
- Expected: Command executes
Actual: "Unknown slash command: /test"
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.5 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
- Hooks work, commands don't: Hooks configured in ~/.claude/settings.json execute
correctly, proving the ~/.claude/ directory is accessible and settings are being
loaded. This isolates the issue to filesystem scanning for command files.
- All setup verified correct:
- ✅ Directory: ~/.claude/commands/ exists and is readable
- ✅ Files: 8 command files with proper .md extension
- ✅ Permissions: All files are rw-r--r-- (readable)
- ✅ Format: All files have required description frontmatter
- ✅ Content: Files contain instructions (not just command names)
- ✅ Naming: Files use hyphens (e.g., debug.md, not debug md.md)
- ✅ No subdirectories: Files are directly in commands folder
- ✅ Ripgrep installed: rg --version shows 14.1.1
- Troubleshooting attempted:
- Restarted Claude Code multiple times (full terminal closure)
- Removed duplicate npm-global installation
- Verified no local project .claude/commands/ override
- Checked for hidden characters (none found)
- Confirmed directory is real (not a symlink)
- Tried both ~/.claude/commands/ and ~/.config/claude/commands/
Example command file structure:
$ ls -la ~/.claude/commands/
total 96
-rw-r--r-- 1 user staff 6674 Oct 3 11:35 analyze-codebase.md
-rw-r--r-- 1 user staff 1679 Oct 3 11:51 debug.md
-rw-r--r-- 1 user staff 9723 Oct 3 11:41 pr-review.md
-rw-r--r-- 1 user staff 134 Oct 3 11:47 test.md
Example file content:
---
description: Debug and fix terminal errors automatically
allowed-tools: Bash(python:), Bash(uv:), Read, Write, Edit
---
# Error Debugging and Fixing
## Debugging Process
- READ the terminal output to understand the error
- ANALYZE the error - identify root cause
- FIX the error by modifying code
10 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Did you try running
/debugdirectly or try to have Claude run it throughSlashCommandtool?SlashCommandtool only supports commands that havedescriptionpopulated: https://docs.claude.com/en/docs/claude-code/slash-commands#slashcommand-tool-supported-commands . You can useclaude --debugto see which custom slash commands are available forSlashCommandtool.@dicksontsai yeah I tried that and it confirmed my commands have the right format with descriptions etc
👍 same for me when using the brew version of claude-code (2.0.13). I uninstalled that version and installed with NPM and now custom slash commands are found. See my initial issue for details: https://github.com/anthropics/claude-code/issues/9316
I am on NPM unfortunatelly so that does not work for me
npm install somehow causes this problem.
For WSL, my issue was resolved using the solution described in #9518
I resolved it by removing my configs in RIPGREP_CONFIG_PATH as I had some coloring included by default which hinders claude-code to parse the directories properly. Even though claude-code uses it's own ripgrep the config is still used.
Related https://github.com/anthropics/claude-code/issues/7283#issuecomment-3342066751
It is finally working for me after setting
USE_BUILTIN_RIPGREP=0Hey folks - this should be resolved in the next release, which also drops support for custom ripgrep configs in Claude Code.
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.