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

Slash Command Visibility Broken for .gitignored subdirectories

Open hiragram opened this issue 1 year ago • 9 comments

Bug Description Custom slash commands under subdirectory are invisible from Claude Code.

For example, .claude/commands/hello.md is visible, but .claude/commands/greeting/hello.md is not visible and cannot be executed.

% claude --version 1.0.43 (Claude Code)

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 1.0.43
  • Feedback ID: aef9463e-8544-4d95-b2d6-243caf484f7d

Errors

[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n    at genericNodeError (node:internal/errors:983:15)\n    at wrappedFn (node:internal/errors:537:14)\n    at checkExecSyncError (node:child_process:882:11)\n    at execSync (node:child_process:954:15)\n    at ED (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:702:3921)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:9038\n    at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:13327)\n    at hJ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:8184)\n    at S_ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:7265)\n    at NB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:11432)","timestamp":"2025-07-06T12:45:15.496Z"}]

hiragram avatar Jul 06 '25 12:07 hiragram

This is happening to me too using:

  • Claude 1.0.48
  • Mac OS 15.3.2
  • iTerm2 v3.5.13:
repro of problem

nickhoffman avatar Jul 11 '25 02:07 nickhoffman

@dicksontsai Hi. Release note for v1.0.45 says:

Custom slash commands: Restored namespacing in command names based on subdirectories. For example, .claude/frontend/component.md is now /frontend:component, not /component.

but it seems still broken. Commands in subdirectory such as ./.claude/commands/greeting/hello.md does not appear.

By the way, release note says .claude/frontend/component.md but .claude/commands/frontend/component.md is correct?

hiragram avatar Jul 11 '25 05:07 hiragram

I took a look and can confirm that user-level subdirectories aren't supported properly (what @nickhoffman saw).

@hiragram are you seeing this in project-level .claude or user-level ~/.claude? Also, thanks for the note about the changelog.

dicksontsai avatar Jul 11 '25 05:07 dicksontsai

@dicksontsai My reports are based on project level commands.

Actual files:

user level project level
Image Image

Claude Code says:

Image

As you mentioned, user-level commands' behavior looks incorrect and project-level ones work fine. However, it turned out that the issue I initially reported was caused by a different reason. The subdirectory that I originally reported was gitignored. After I removed it from .gitignore , commands in the subdirectory can be seen from Claude Code. Is this the expected behavior? I would also like commands in gitignored subdirectories to be visible and executable.

hiragram avatar Jul 11 '25 06:07 hiragram

Yes, it's expected for Claude Code to ignore slash command files in .gitignore. Supporting this is not a quick fix, but I can leave this issue open to see when we get around to this feature request. Thanks for looking into the issue together.

dicksontsai avatar Jul 11 '25 06:07 dicksontsai

@dicksontsai Thank you. Are there any workaround to keep the commands gitignored, project scoped, and executable?

hiragram avatar Jul 11 '25 06:07 hiragram

#4209

Gabbo7474 avatar Jul 29 '25 14:07 Gabbo7474

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 03 '25 10:12 github-actions[bot]

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.

github-actions[bot] avatar Dec 23 '25 14:12 github-actions[bot]