/loop skill loses skill name after first iteration — 'unknown skill' on repeat
Bug Description
The /loop skill works correctly on the first iteration but fails on all subsequent iterations with the error:
unknown skill:
Note the empty string after the colon — the skill name that /loop is supposed to re-invoke is lost between iterations.
Steps to Reproduce
- Have a custom skill defined in
.claude/commands/(e.g.,build.md) - Run
/loop 10m /build - First iteration executes
/buildcorrectly - After the interval, the next iteration fails with
unknown skill: - Every subsequent iteration also fails with the same error
Expected Behavior
Each iteration should invoke the specified skill (/build) with the same behavior as the first iteration.
Likely Cause
After the first iteration completes (especially for long-running skills that produce significant output), context compression appears to drop the loop's internal state — specifically the skill name it needs to re-invoke. The Skill tool then receives an empty string as the skill name.
Workaround
Use a shell loop with the CLI instead of the built-in /loop:
while true; do claude -p "/build" --allowedTools '*'; sleep 600; done
Each invocation gets a fresh context, avoiding the state loss.
Environment
- Claude Code CLI (latest)
- macOS (Darwin 25.3.0)
- Custom skills in
.claude/commands/
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗