[BUG] Slash Commands Not Loading from .claude/commands Directory in v2.0.22

Status Fixed / completed
Maintainer reply ✓ Yes — whyuan-cc
Activity 12 comments · opened Oct 19, 2025 · closed Oct 20, 2025
💡 Likely answer: A maintainer (whyuan-cc, contributor) responded on this thread — see the highlighted reply below.

[BUG] Slash Commands Not Loading from .claude/commands Directory

Environment

Claude Code Version: 2.0.22
Platform: Linux (WSL2)
OS Version: Linux 6.6.87.2-microsoft-standard-WSL2
Installation Type: Native
Working Directory: /workspaces/knowledge-forge

Issue Summary

Custom slash commands defined in .claude/commands/*.md are not being discovered or loaded by Claude Code. The directory exists, contains properly formatted command files, but zero commands are registered.

Expected Behavior

According to Claude Code documentation, commands placed in .claude/commands/ should be automatically discovered and available as slash commands. These should appear:

  • In autocomplete when typing /
  • In the SlashCommand tool available commands list
  • Be executable via /command-name

Actual Behavior

  • Zero commands are loaded despite 17 properly formatted .md files in .claude/commands/
  • Typing / shows only built-in commands
  • Debug logs show [DEBUG] Slash commands included in SlashCommand tool: (empty)
  • No scanning/discovery process runs for slash commands
  • No error messages or warnings about command loading

Directory Structure

/workspaces/knowledge-forge/.claude/
├── commands/
│   ├── architect.md
│   ├── breakdown.md
│   ├── execute.md
│   ├── github.md
│   ├── hello.md          # Simple test command
│   ├── help.md
│   ├── initiate.md
│   ├── integrate.md
│   ├── phase.md
│   ├── scope-review.md
│   ├── specify.md
│   ├── status.md
│   ├── test.md           # Minimal test command
│   ├── validate.md
│   ├── validate-scope.md
│   └── workflow-status.md
├── settings.json
└── settings.local.json

Directory Permissions:

drwxr-xr-x 2 vscode vscode 4096 Oct 19 16:55 commands/
-rw-r--r-- 1 vscode vscode   86 Oct 19 16:55 hello.md
-rw-r--r-- 1 vscode vscode  144 Oct 19 16:08 test.md

Command File Format

All command files follow the correct frontmatter format:

hello.md:

---
description: Test hello command
---

Hello World! This is a minimal test command.

test.md:

---
description: Simple test command
argument-hint: message
---

This is a test command. You said: $ARGUMENTS

Current working directory: $(pwd)

All 17 files have valid YAML frontmatter with description field.

Debug Log Evidence

From: ~/.claude/debug/71ebfaa0-a184-4792-a500-689f569923c4.txt

Skills Loading (Works Correctly)

[DEBUG] ENABLE_SKILLS check passed, loading skills...
[DEBUG] Loading skills from directories: managed=/etc/claude-code/.claude/skills, user=/home/vscode/.claude/skills, project=/workspaces/knowledge-forge/.claude/skills
[DEBUG] Total plugin skills loaded: 0
[DEBUG] Total plugin commands loaded: 0
[DEBUG] Loaded 0 skills total (managed: 0, user: 0, project: 0)

Slash Commands Loading (Broken)

[DEBUG] Skills and commands included in Skill tool:
[DEBUG] Slash commands included in SlashCommand tool:
[DEBUG] Loaded plugins - Enabled: 0, Disabled: 0, Commands: 0, Agents: 0, Errors: 0

Critical Missing Log: There is NO equivalent "Loading slash commands from directories..." message. The system that scans .claude/commands/ never runs or logs anything.

Repeated Throughout Session

The log contains 29 instances of:

[DEBUG] Slash commands included in SlashCommand tool:

All are empty - no commands listed.

Comparison: Skills vs Commands

| Feature | Directory | Log Message | Status |
|---------|-----------|-------------|--------|
| Skills | .claude/skills/ | "Loading skills from directories..." | ✓ Scanning runs |
| Slash Commands | .claude/commands/ | (none) | ✗ No scanning |

The slash command discovery mechanism never executes or fails silently.

Configuration

settings.json:

{
  "env": {
    "PYTHONPATH": "${PWD}",
    "PROJECT_ROOT": "${PWD}",
    "SLASH_COMMAND_TOOL_CHAR_BUDGET": "100000",
    "USE_BUILTIN_RIPGREP": "0"
  },
  "permissions": {
    "allowedTools": [
      "SlashCommand",
      ...
    ]
  },
  "model": "claude-sonnet-4-5-20250929"
}

Additional Observations

  1. Settings loading works: Debug shows settings files being watched and loaded
  2. Hooks work: PostToolUse hooks execute correctly
  3. Directory detection works: Manual test -d /workspaces/knowledge-forge/.claude/commands succeeds
  4. File reading works: Manual cat /workspaces/knowledge-forge/.claude/commands/test.md succeeds
  5. Only discovery is broken: The automated scanning/loading of commands never happens

Secondary Issue (Possibly Unrelated)

Ripgrep builtin test fails:

[DEBUG] Ripgrep first use test: FAILED (mode=builtin, path=/home/vscode/.local/share/claude/versions/2.0.22)

This path is incorrect (it's a file, not a directory), but system ripgrep works fine:

$ which rg
/usr/bin/rg
$ rg --version
ripgrep 13.0.0

Settings specify "USE_BUILTIN_RIPGREP": "0" so this may be unrelated.

Steps to Reproduce

  1. Create .claude/commands/ directory in project root
  2. Add a simple command file with valid frontmatter:

```markdown
---
description: Test command
---

Hello from test command.
```

  1. Start Claude Code session
  2. Type / in conversation
  3. Observe: Only built-in commands appear, custom command is missing

Workarounds Attempted

  • ✗ Restarting Claude Code
  • ✗ Checking file permissions
  • ✗ Verifying YAML frontmatter format
  • ✗ Creating minimal test commands
  • ✗ Checking settings configuration

Related GitHub Issues

This appears to be a known issue affecting multiple users:

  • #9518: Claude Code does not detect slash commands located under .claude/commands directory
  • #8831: Custom slash commands not discovered in ~/.claude/commands/
  • #1212: Claude Code not finding custom commands
  • #1483: Commands Not Detected in .claude/commands Directory
  • #7283: Custom slash commands no longer working

Request

Please investigate why the slash command discovery/scanning mechanism is not running in version 2.0.22. The skills loading mechanism works (logs show directory scanning), but there's no equivalent scanning for .claude/commands/ directories.

---

Full debug log available upon request.

View original on GitHub ↗

12 Comments

github-actions[bot] · 10 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/9518
  2. https://github.com/anthropics/claude-code/issues/8831
  3. https://github.com/anthropics/claude-code/issues/9435

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

acaneva · 10 months ago

Manual SlashCommand Tool Testing - Confirms Bug

I manually tested the SlashCommand tool to verify command discovery, and the results confirm the bug:

Test Commands

SlashCommand("/hello") → Error: Unknown slash command: hello
SlashCommand("/test")  → Error: Unknown slash command: test
SlashCommand("/help")  → Error: Slash command help is not a prompt-based command

Analysis

Custom Commands (NOT WORKING):

  • /hello and /test both exist as .md files in .claude/commands/
  • Both return Unknown slash command error
  • These should be registered and available

Built-in Command (Different Behavior):

  • /help returns a different error: "not a prompt-based command"
  • This proves the SlashCommand tool IS functional
  • Built-in commands ARE recognized
  • Only custom command discovery is broken

Conclusion

✅ SlashCommand tool itself works
✅ Built-in commands are recognized
❌ Custom commands from .claude/commands/ are NOT loaded

This manual test confirms what the debug logs showed:

[DEBUG] Slash commands included in SlashCommand tool:

↑ Empty - zero custom commands registered despite 17 valid .md files existing

The command discovery/scanning mechanism is definitely not running in v2.0.22.

acaneva · 10 months ago

✅ Issue Resolved - Root Cause Identified

Status: Slash commands now loading correctly after configuration refactoring

---

🎯 Root Cause

The issue was caused by unsupported configuration options and overly restrictive tool patterns in settings.local.json that interfered with Claude Code's tool initialization and command discovery system.

Primary Culprits

  1. Unsupported Configuration Blocks (CRITICAL)
  • memory, parallelTools, outputStyle, statusLine blocks
  • These caused silent initialization failures that prevented command discovery
  1. Overly Restrictive Tool Patterns (PRIMARY FIX)
  • Bash(git *), Bash(gh *), Task(general-purpose), etc.
  • Interfered with internal directory scanning for .claude/commands/
  1. Experimental/Deprecated Tools
  • Memory tool and MultiEdit tool
  • Caused tool initialization to fail early

---

🔧 Configuration Changes That Fixed It

❌ Broken Configuration

{
  "permissions": {
    "allowedTools": [
      "Bash(git *)",           // ⚠️ Too restrictive
      "Task(general-purpose)", // ⚠️ Restricted agent type
      "Memory",                // ⚠️ Experimental/unsupported
      "MultiEdit(src/**)",     // ⚠️ Deprecated
      ...
    ]
  },
  "enableMemory": true,        // ⚠️ Unsupported
  "memory": { ... },           // ⚠️ Unsupported block
  "parallelTools": { ... },    // ⚠️ Unsupported block
  "outputStyle": "development" // ⚠️ Unsupported
}

✅ Working Configuration

{
  "env": {
    "SLASH_COMMAND_TOOL_CHAR_BUDGET": "100000",
    "USE_BUILTIN_RIPGREP": "0"
  },
  "permissions": {
    "allow": [
      "Read(/home/vscode/**)",
      "Write(src/**)",
      ...
    ],
    "allowedTools": [
      "Read",      // ✅ Simple tool names only
      "Bash",      // ✅ No restrictive patterns
      "Task",      // ✅ No agent restrictions
      "Skill",
      "SlashCommand",
      ...
    ]
  },
  "hooks": {
    "PostToolUse": [{
      "matcher": "Write(*.py)",
      "hooks": [{
        "type": "command",
        "command": "rye fmt $file",
        "continueOnError": true  // ✅ Error handling
      }]
    }]
  }
}

---

🔍 Key Changes

  1. Removed all unsupported config blocks (memory, parallelTools, etc.)
  2. Simplified allowedTools to base tool names (removed patterns like Bash(git *))
  3. Removed experimental tools (Memory, MultiEdit)
  4. Moved file permissions to permissions.allow section
  5. Added environment variables for slash command budgets
  6. Added error handling to hooks (continueOnError: true)

---

✅ Verification

After configuration fix:

  • ✅ All 17 custom slash commands load correctly
  • ✅ Commands appear in autocomplete
  • /status and other commands execute successfully
  • ✅ No "Unknown slash command" errors

---

💡 Recommendations for Claude Code Team

  1. Add Configuration Validation
  • Validate settings.local.json on startup
  • Show helpful error messages for unsupported options
  • Warn about deprecated/experimental features
  1. Improve Error Visibility
  • Show initialization errors in debug logs
  • Don't fail silently when config issues occur
  • Add --validate-config flag for testing
  1. Documentation Updates
  • Clearly document supported configuration options
  • Provide migration guides for deprecated features
  • Add examples of proper tool permission patterns
  1. Error Messages
  • When tool patterns are used incorrectly, suggest the fix
  • When unsupported configs are found, warn the user
  • Link to documentation for proper configuration

---

📝 Workarounds Attempted (All Failed)

Before finding the config issue:

  • ❌ Cleared project cache (~/.claude/projects)
  • ❌ Checked ripgrep configuration (not the issue)
  • ❌ Reinstalled via curl installer
  • ❌ Complete clean reinstall

None of these worked because the issue was in the configuration itself.

---

🎯 Takeaway

The issue was entirely configuration-based. Unsupported config blocks caused silent failures in the tool initialization process, which prevented slash commands from being discovered. Simplifying to documented configuration options resolved the issue immediately.

Platform: WSL2 (Linux)
Version: Claude Code 2.0.22
Resolution: Configuration refactoring (removed unsupported options)
Time to Resolution: ~4 hours of debugging

Hope this helps others encountering similar issues! 🎉

whyuan-cc contributor · 10 months ago

this was fixed by https://github.com/anthropics/claude-cli-internal/pull/8646 and in claude already. Please let me know if you can still repro. thanks

tonydehnke · 10 months ago

Claude Code VS-Code extension 2.0.25 is not seeing custom Slash commands for me on MacOS.. but the terminal CC does. @whyuan-cc

s-411 · 10 months ago
Claude Code VS-Code extension 2.0.25 is not seeing custom Slash commands for me on MacOS.. but the terminal CC does. @whyuan-cc

Same for me.

flamedmg · 10 months ago

issue still persists. I tried to remove any Claude configs, started clean and still having this issue

PwrBank · 10 months ago

In the mentioned above post, I have screenshots showing two projects with the same exact configs are loading differently in Claude Code. One is not reading the .claude folder or claude.md at all.

Up-to-date VS Code, latest Claude Code, and latest Claude Code extension.

<img width="1858" height="393" alt="Image" src="https://github.com/user-attachments/assets/e505cee3-e07a-4d52-a381-d6234b9da632" />

whyuan-cc contributor · 10 months ago

thanks for reporting. Let me take a look.

nr-shashankssingh · 10 months ago

facing same issue with claude-code V2.0.28 cli in mac terminal [macOS 15.6.1] but works with VScode claude-code extension

drswobodziczka · 10 months ago

having the latest version of the claude code (2.0.28) but suddenly and unfortunately all the global slash comments given via SYMLINKS are not recognized anymore. In the same time, I can use global slash commands when they are given via regular files - here for both terminal and IDE extensions.

github-actions[bot] · 9 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.