[BUG] Claude Code does not detect slash commands located under .claude/commands directory
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?
Claude Code is not detecting any slash commands placed in the .claude/commands folder. Even though the directory exists in the project root and contains valid command files, none of them appear in the Slash Commands list or autocomplete when using / in the editor.
What Should Happen?
Claude Code should automatically detect and load all slash commands located in the .claude/commands directory. These commands should appear in the Slash Commands list and be available for autocomplete when typing / in the editor.
Error Messages/Logs
No error messages appear in the Claude Code interface or console. The slash commands are simply not detected no warnings, logs, or failed load indicators are shown.
Steps to Reproduce
-
Open any project folder in Claude Code.
-
In the project root, create a directory named: .claude/commands
-
Inside that directory, create a file named test.md with the following dummy slash command content:
This is a dummy command for testing Claude Code slash command detection.
-
Save the file.
-
Reload Claude Code or reopen the workspace.
-
Try typing /test in the editor or check the “Slash Commands” panel.
Result: The command does not appear in the list or autocomplete, and cannot be executed.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.0.14
Claude Code Version
2.0.14
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/8831
- https://github.com/anthropics/claude-code/issues/9435
- https://github.com/anthropics/claude-code/issues/1212
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
Additional Notes / Troubleshooting Tried: I’ve already tried the known fixes:
Clearing the ~/.claude/projects directory
Adjusting file permissions for .claude and .claude/commands in the project folder
Reinstalling Claude Code both locally and globally via npm
None of these resolved the issue.
After running the manual install below for WSL, the issue was resolved. It seems that npm install somehow causes this problem.
Install latest version
curl -fsSL https://claude.ai/install.sh | bash -s latest
After running the manual install below for WSL, the issue was resolved. It seems that npm install somehow causes this problem.
Install latest version
curl -fsSL https://claude.ai/install.sh | bash -s latest
You would not believe it man but when running this command the script downloads an intel version instead of arm. I do not have my m1 macbook running in Rosetta so I am totally baffled why this happends
My NPM version is ARM based and downloads normally
Additional Reproduction Case: macOS Confirmation
I can confirm this issue on macOS (Darwin 24.6.0) with Claude Code v2.0.21.
Environment
- Platform: macOS Darwin 24.6.0
- Claude Code: v2.0.21
- Installation: Homebrew
- Project: Fresh clone from Specify template with 8 command files in
.claude/commands/
Debug Log Evidence
From ~/.claude/debug/latest, the root cause is clear:
[DEBUG] Loading skills from directories: managed=/Library/Application Support/ClaudeCode/.claude/skills user=/Users/bfay/.claude/skills project=/Users/bfay/pulpit/.claude/skills
[DEBUG] Total plugin commands loaded: 0 [DEBUG] Loaded 0 skills total (managed: 0, user: 0, project: 0) [DEBUG] Slash commands included in SlashCommand tool: [DEBUG] Skills and commands included in Skill tool:
The issue: Claude Code only scans .claude/skills/ directories but the project uses .claude/commands/. The
.claude/commands/ directory is never scanned.
File Structure Verified
All 8 command files exist with proper permissions and frontmatter:
$ ls -la .claude/commands/
-rw-r--r-- 7.1K speckit.analyze.md
-rw-r--r-- 17K speckit.checklist.md
-rw-r--r-- 11K speckit.clarify.md
-rw-r--r-- 5.1K speckit.constitution.md
-rw-r--r-- 7.2K speckit.implement.md
-rw-r--r-- 2.9K speckit.plan.md
-rw-r--r-- 12K speckit.specify.md
-rw-r--r-- 6.1K speckit.tasks.md
Each file has valid frontmatter:
description:
Hypothesis
Claude Code v2.0 introduced "Skills" (v2.0.20) and "Plugin System" (v2.0.12). The command discovery logic appears to have been refactored to only scan .claude/skills/ without maintaining backward compatibility for .claude/commands/.
This affects any project created with the older .claude/commands/ structure, including templates like the Specify/Pulpit template.
Configuration Verification
Confirmed this is NOT caused by:
- Shell environment variables
- Dotfile configuration
- Git config
- File permissions
- Claude Code settings
This is a directory naming/discovery issue in the command scanner itself.
I have a same problem
Same problem for me.
Same for me
same issue even on clean machine (macOS)
Same here.
os: LinuxVersion: 6.8.0-1041-gcp claude code v2.0.25
A workaround to me: the --plugin-dir option add both slash commands and sub-agents successfully
Confirming same issue on 2.0.27 (OSX 26.0.1). It was working until new sessions stopped loading the custom commands. This breaks my workflows. I tried clearing ~/.claude/projects to no avail.
I noticed yesterday that my slash commands had started working again with 2.0.26, but I didn't do anything special to use them.
Same issue. When telling agent to use SlashCommand(/my_command) then it can run it.
i have a possible cause; the permissions on the npm vendor files under /usr/lib/node_modules/. I run tight permissions on my root user (umask 077) and this means that when installing / updating npm it caused the files to become non readable / executable for non root users. this silently broke custom commands (and possibly other things) for claude code. fixing the permissions fixed the problem.
obviously this might not be the only cause, but it was my cause.
run the following as root.
chmod -fR go+r /usr/lib/node_modules/*
find /usr/lib/node_modules -type d -print0 | xargs -0 chmod 755
find /usr/lib/node_modules -type f -perm -u+x -print0 | xargs -0 chmod go+x
the paths on macos will be different but i don't have a mac machine to test on
Same here.
os: LinuxVersion: 6.8.0-1041-gcp claude code v2.0.25
A workaround to me: the
--plugin-diroption add both slash commands and sub-agents successfully
claude --plugin-dir .claude/ works, thanks a lot!
OS: macOS 14.7.4 CC: 2.0.55 (Claude Code)
Still broken in 2.0.55 (npm) - Workaround confirmed
Environment:
- Claude Code version: 2.0.55
- Installation: npm (
@anthropic-ai/[email protected]) - OS: Linux (kernel 6.8.0-86-generic)
- Structure:
~/.claude/commands/example.md(flat .md files, not subdirectories)
Problem:
Global slash commands in ~/.claude/commands/ are completely ignored. Debug logs show:
Loading skills from directories: user=/home/user/.claude/skills, ...
Loaded 0 unique skills (managed: 0, user: 0, project: 0)
Slash commands included in SlashCommand tool:
Code analysis:
I examined the minified cli.js (~10MB) and found:
- ✅ Skills loading exists - scans
~/.claude/skills/for subdirectories withSKILL.md - ❌ No code for loading slash commands from
~/.claude/commands/ .claude/commandsonly appears in sandbox ignore patterns
Workaround that works:
claude --plugin-dir ~/.claude/
With this flag, /example executes correctly from ~/.claude/commands/example.md.
Permanent fix - add to .bashrc:
alias claude='claude --plugin-dir ~/.claude/'
Question: Is --plugin-dir the intended way to use global commands, or is this a bug where the default user directory loading is broken?
The documentation suggests ~/.claude/commands/ should work automatically, but the npm installation doesn't seem to include that functionality.
I had the same problem and found my root cause. After installing a plugin marketplace the local slash commands were gone. After removing the plugin local slash commands are accessable again.
Workaround with alias claude='claude --plugin-dir ~/.claude/' works.