Feature Request: Allow excluding markdown files in .claude/commands from slash command discovery
Summary
Currently, every .md file placed in .claude/commands/ is automatically discovered and exposed as a slash command. There is no mechanism to exclude specific markdown files from this auto-discovery, making it difficult to co-locate documentation alongside command definitions.
Use Case
When organizing commands by feature/domain (e.g., .claude/commands/git/), it's natural to want documentation files like AGENTS.md or README.md in the same directory to provide context about those commands. However, these documentation files currently become unintended slash commands.
Current behavior:
.claude/commands/git/
├── commit.md → /git:commit ✅
├── commit-push.md → /git:commit-push ✅
└── COMMANDS_GIT_AGENTS.md → /git:COMMANDS_GIT_AGENTS ❌ (unintended)
Proposed Solutions
Any of these would solve the problem:
Option 1: Underscore Prefix Convention
Files prefixed with _ are excluded from command discovery:
.claude/commands/git/_AGENTS.md # Ignored
.claude/commands/git/_README.md # Ignored
Option 2: Frontmatter Option
Add a frontmatter property to exclude a file:
---
exclude-from-commands: true
---
# Documentation content here
Option 3: Configuration in settings.json
Allow specifying exclusion patterns:
{
"commands": {
"excludePatterns": ["**/AGENTS.md", "**/README.md", "**/_*.md"]
}
}
Option 4: Dedicated Subdirectory
Automatically exclude a specific subdirectory name:
.claude/commands/git/
├── commit.md → /git:commit ✅
└── docs/ # Entire directory excluded
└── AGENTS.md # Ignored
Benefits
- Keeps documentation co-located with related commands
- Follows common conventions in other CLI tools
- Reduces clutter in the slash command menu
- Enables better organization of
.claude/directory - Supports the
AGENTS.mdpattern for AI context files
Current Workaround
Move documentation to .claude/docs/ or use non-.md extensions, but this separates related content and loses markdown formatting benefits.
Environment
- Claude Code CLI
- Affects all users organizing commands with documentation
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗