[Bug] claude -p hangs when .claude/skills directory contains SKILL.md files
Bug Description
The claude CLI hangs indefinitely in -p (print/non-interactive) mode when a .claude/skills/ directory contains at least one SKILL.md file.
Steps to Reproduce
- Create a directory with a
.claude/skills/subdirectory containing a SKILL.md file:
mkdir -p test-dir/.claude/skills/test-skill
echo "# Test Skill" > test-dir/.claude/skills/test-skill/SKILL.md
- Run any prompt in
-pmode from that directory:
cd test-dir
claude -p "What is 2+2?" --print
- The process hangs indefinitely with 0% CPU usage after initialization.
Expected Behavior
The command should execute the prompt and return the result, regardless of whether skills are present in the .claude/skills/ directory.
Actual Behavior
The process hangs indefinitely after:
[DEBUG] Watching for changes in skill/command directories: /path/to/.claude/skills...
No API call is made, no output is produced.
Debug Log
2026-01-29T02:48:11.812Z [DEBUG] Failed to check enabledPlatforms: TypeError: undefined is not an object (evaluating 'aF.join')
2026-01-29T02:48:11.893Z [DEBUG] Watching for changes in setting files /Users/mineo/.claude...
2026-01-29T02:48:11.896Z [DEBUG] [init] configureGlobalMTLS starting
2026-01-29T02:48:11.896Z [DEBUG] [init] configureGlobalMTLS complete
2026-01-29T02:48:11.896Z [DEBUG] [init] configureGlobalAgents starting
2026-01-29T02:48:11.897Z [DEBUG] [init] configureGlobalAgents complete
2026-01-29T02:48:11.900Z [DEBUG] [STARTUP] Loading MCP configs...
... plugins load successfully ...
2026-01-29T02:48:11.919Z [DEBUG] Watching for changes in skill/command directories: /path/to/.claude/skills...
<--- HANGS HERE --->
Environment
- Claude Code version: 2.1.23
- OS: macOS Darwin 24.6.0
- Platform: darwin
Workarounds Found
--disable-slash-commandsflag: Adding this flag prevents the hang:
``bash``
claude -p "What is 2+2?" --print --disable-slash-commands # Works
- No SKILL.md files: Empty
.claude/skills/directory works fine. Only hangs when at least one SKILL.md exists.
- Interactive mode: The same directory works fine in interactive mode (without
-p).
Test Matrix
| Scenario | Result |
|----------|--------|
| No .claude directory | ✅ Works |
| Empty .claude/skills/ directory | ✅ Works |
| Skill directory without SKILL.md | ✅ Works |
| Minimal SKILL.md (just # Test) | ❌ Hangs |
| Full SKILL.md with frontmatter | ❌ Hangs |
| --disable-slash-commands with SKILL.md | ✅ Works |
Impact
This bug prevents using claude -p for automated batch processing when the target repository has a .claude/skills/ directory with skills defined, which is a common pattern for repositories using rocro-skills or similar skill libraries.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗