Slash commands with hyphens in filename not recognized (v2.0.76)
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 defined in .claude/commands/ with hyphens in the filename are not recognized by Claude Code CLI v2.0.76. Commands using underscores work correctly.
What Should Happen?
Both docs-sync.md and docs_sync.md should be recognized as valid command filenames, as official documentation shows hyphenated examples like security-review.md, fix-issue.md, and review-pr.md.
Custom slash commands in .claude/commands/ with hyphens are NOT recognized:
- docs-sync.md → /docs-sync NOT FOUND
- docs_sync.md → /docs_sync WORKS
Error Messages/Logs
Unknown slash command: docs-sysnc
Steps to Reproduce
- Create
.claude/commands/docs-sync.mdwith valid frontmatter: - ```yaml
- ---
- description: Sync documentation
- ---
- ```
- 2. Try to invoke
/docs-sync→ command not found - 3. Rename to
.claude/commands/docs_sync.md - 4. Invoke
/docs_sync→ works correctly
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
v2.0.76
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Workaround: Use underscores instead of hyphens in command filenames.
Note: Documentation and examples should be updated to reflect actual behavior, OR hyphens should be supported as shown in docs.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗