claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Claude Code does not detect slash commands located under .claude/commands directory

Open epaprat opened this issue 2 months ago • 16 comments

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

  1. Open any project folder in Claude Code.

  2. In the project root, create a directory named: .claude/commands

  3. 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.

  1. Save the file.

  2. Reload Claude Code or reopen the workspace.

  3. 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

Image

epaprat avatar Oct 14 '25 09:10 epaprat

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/8831
  2. https://github.com/anthropics/claude-code/issues/9435
  3. 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

github-actions[bot] avatar Oct 14 '25 09:10 github-actions[bot]

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.

epaprat avatar Oct 14 '25 11:10 epaprat

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

epaprat avatar Oct 14 '25 12:10 epaprat

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

Dingzeefs avatar Oct 16 '25 20:10 Dingzeefs

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.

bradleyfay avatar Oct 17 '25 01:10 bradleyfay

I have a same problem

youngdonkim avatar Oct 20 '25 02:10 youngdonkim

Same problem for me.

jwiegley avatar Oct 21 '25 23:10 jwiegley

Same for me

gcherem avatar Oct 22 '25 23:10 gcherem

same issue even on clean machine (macOS)

flamedmg avatar Oct 23 '25 08:10 flamedmg

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

brucechou1983 avatar Oct 23 '25 12:10 brucechou1983

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.

foglerek avatar Oct 26 '25 20:10 foglerek

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.

jwiegley avatar Oct 26 '25 23:10 jwiegley

Same issue. When telling agent to use SlashCommand(/my_command) then it can run it.

michal-samluk avatar Oct 27 '25 15:10 michal-samluk

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

mattkeenan avatar Nov 27 '25 15:11 mattkeenan

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

claude --plugin-dir .claude/ works, thanks a lot!

OS: macOS 14.7.4 CC: 2.0.55 (Claude Code)

veraposeidon avatar Nov 28 '25 08:11 veraposeidon

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:

  1. ✅ Skills loading exists - scans ~/.claude/skills/ for subdirectories with SKILL.md
  2. No code for loading slash commands from ~/.claude/commands/
  3. .claude/commands only 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.

vobornik avatar Dec 01 '25 19:12 vobornik

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.

sti0 avatar Dec 11 '25 08:12 sti0