[BUG]
Custom Slash Commands Not Recognized - "Unknown slash command" Error
Bug Description
Custom slash commands created in .claude/commands/ are not being recognized by Claude Code. All custom
commands return "Unknown slash command: [command_name]" despite following the documented format and file
structure.
Environment
- OS: Windows (Git for Windows/WSL environment)
- Claude Code Version: [Please add your version from claude --version]
- Working Directory: Standard project directory with .claude/commands/ folder
- Built-in Commands: Working correctly (verified /bashes, /release-notes work)
Expected Behavior
Custom slash commands should be recognized and executable when:
- Markdown files are placed in .claude/commands/ directory
- Files contain valid YAML frontmatter with description field
- Files follow the documented format from Claude Code documentation
Actual Behavior
All custom slash commands return: Unknown slash command: [command_name]
Reproduction Steps
- Create .claude/commands/ directory in project root
- Create a simple command file (e.g., hello.md):
---
description: Simple hello world command
---
Hello! This is a test slash command.
- Restart Claude Code completely
- Attempt to run /hello
- Observe "Unknown slash command: hello" error
Files and Configuration Verified
Directory Structure
.claude/
├── commands/
│ ├── hello.md
│ ├── msd.md
│ ├── test.md
│ └── Diffusion01.md
└── settings.local.json
File Permissions
-rw-r--r-- 1 Matt 197121 85 Sep 2 17:45 hello.md
-rw-r--r-- 1 Matt 197121 1480 Sep 2 17:41 msd.md
-rw-r--r-- 1 Matt 197121 189 Sep 2 17:41 test.md
-rw-r--r-- 1 Matt 197121 1828 Sep 2 17:38 Diffusion01.md
Sample Command File Content (hello.md)
---
description: Simple hello world command
---
Hello! This is a test slash command.
File Encoding Verification
$ file .claude/commands/hello.md
.claude/commands/hello.md: ASCII text
Character Analysis (no hidden characters found)
0000000 - - - \n d e s c r i p t i o n :
0000020 S i m p l e h e l l o w o
0000040 r l d c o m m a n d \n - - - \n
Troubleshooting Attempted
- Multiple complete restarts of Claude Code
- Restarted VS Code completely
- Verified YAML frontmatter syntax (tried both quoted and unquoted descriptions)
- Tested with minimal frontmatter (only description field)
- Tried different command names (hello, test, msd, Diffusion01)
- Removed optional frontmatter fields (allowed-tools, argument-hint)
- Verified file encoding (ASCII text, no BOM)
- Checked for hidden characters in frontmatter
- Confirmed running from correct project directory
- Verified .claude/commands/ directory exists and is readable
Additional Context
- Built-in slash commands work perfectly (/bashes, /release-notes, etc.)
- Custom slash commands were introduced in v0.2.31 according to release notes
- Project has other Claude Code functionality working (file editing, tool usage, etc.)
- No error messages in terminal beyond "Unknown slash command" output
Expected Fix
Custom slash commands should be automatically discovered and made available when properly formatted .md
files are placed in the .claude/commands/ directory, as documented in the Claude Code slash commands
documentation.
---
Note: This appears to be a platform-specific or installation-specific issue since the configuration
follows all documented requirements exactly.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗