[BUG] Multiple /command echo when using custom skills
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?
Bug Report: Multiple /command echo when using custom skills
Summary
When executing a custom skill command (e.g., /agentic), the command appears to be echoed and potentially re-executed multiple times in the CLI output. This may be caused by the CLI incorrectly interpreting literal /command text found in file content as commands to execute.
Environment
- Claude Code Version: v2.1.3
- OS: Windows 10
- Shell: cmd.exe / Windows Terminal
Steps to Reproduce
- Create a custom skill file at
~/.claude/commands/agentic.mdthat contains documentation with literal/agenticreferences (examples, usage instructions, etc.)
- The skill spawns sub-agents using the Task tool that may read files in
~/.claude/commands/
- Run the command:
````
claude /agentic
- Observe the CLI output
Observed Behavior
The /agentic command appears multiple times in the output, followed by multiple "Musing..." spinners:
> /agentic
> /agentic
> /agentic
Musing... (ctrl+c to interrupt)
Musing... (ctrl+c to interrupt)
Musing... (ctrl+c to interrupt)
Musing... (ctrl+c to interrupt)
Musing... (ctrl+c to interrupt)
Expected Behavior
The command should appear only once:
> /agentic
Musing... (ctrl+c to interrupt)
Hypothesis
When the agent reads files as part of its work (exploring codebase, reading skill documentation), the CLI may be incorrectly parsing literal /command text found in file content as actual commands to execute.
For example, if ~/.claude/commands/agentic.md contains:
## Usage
Run `/agentic` to start the task runner.
And an agent reads this file during exploration, the CLI might interpret the /agentic text as a command invocation.
Impact
- Visual confusion: Multiple command echoes make output hard to follow
- Potential resource waste: If commands are actually being re-executed (not just re-displayed), this wastes API tokens and creates duplicate work
- Multiple spinners: Suggests internal duplication of processing
Workaround Attempted
Escaping or avoiding literal /command text in skill files may help, but this degrades documentation quality.
Additional Context
This was observed when launching Claude Code from a batch file:
@echo off
cd /d "C:\Users\...\project"
claude /agentic
The batch file only calls claude /agentic once, so the duplication is happening within the CLI itself.
---
What Should Happen?
investigate bug and avoid visual confusion
Error Messages/Logs
Steps to Reproduce
reproducibility might be hard but we have a /agentic.md file that we call from a echo call. See above.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
noticed with 2.0 or higher
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗