Agent tool: skill path mentioned in subagent prompt auto-invokes the skill and can end the run with no work done

Open 💬 0 comments Opened Jul 10, 2026 by AnFeSDB

Environment

  • Claude Code 2.1.205 (Windows 11, desktop app entrypoint)
  • Session model: claude-fable-5; subagent spawned via Agent tool with subagent_type: "general-purpose", model: "opus"

Repro

  1. Install a personal skill under ~/.claude/skills/my-skill/ (with supporting files, e.g. scripts/helper.ps1).
  2. Spawn a subagent via the Agent tool whose prompt references a file inside that skill folder, e.g.: "First read C:\Users\<user>\.claude\skills\my-skill\scripts\helper.ps1 and reuse its connection pattern, then build ...".
  3. The path mention appears to auto-invoke the skill in the subagent as a context load.

Observed (subagent JSONL transcript)

  • Event 1: user prompt (the task)
  • Events 2-3: type: "attachment" (the auto-loaded skill)
  • Event 4: assistant (correctly running on claude-opus-4-8) emits a single text block containing only the invocation metadata echo, then stop_reason: "end_turn":

{"type":"skill","name":"my-skill","invokeType":"context","message":"user invoked the my-skill skill"}

  • 0 tool uses, ~3s duration. The Agent tool returns that JSON as the subagent's final result; no work is done.

Expected

Auto-loading a skill as context should not derail the subagent's first turn; the subagent should execute the prompt. Also, invokeType: "context" and the "skill mention in an Agent prompt triggers invocation" behavior do not appear to be documented.

Workaround

Avoid mentioning installed skill names or paths in Agent tool prompts (inline the needed snippet instead).

View original on GitHub ↗