[BUG] User-initiated slash commands (/skill-name) do not trigger PreToolUse or PostToolUse hooks for the Skill tool
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?
When a user types a slash command (e.g. /commit) directly, the Skill tool invocation does not trigger PreToolUse or PostToolUse hooks with matcher "Skill".
The only hook that fires is UserPromptSubmit.
When Claude programmatically invokes the same skill via the Skill tool (e.g. in response to a user message like "please commit my changes"), PreToolUse:Skill and PostToolUse:Skill fire as expected.
What Should Happen?
PreToolUse and PostToolUse hooks with matcher "Skill" should fire regardless of whether the skill was invoked by the user typing /skill-name or by Claude calling the Skill tool programmatically.
The hook lifecycle should be consistent — the invocation source should not determine whether hooks run.
Steps to Reproduce
- Create a plugin with a
hooks.jsonthat registers aPreToolUsehook onSkill:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Skill",
"hooks": [
{
"type": "command",
"command": "echo 'PreToolUse:Skill fired' >> /tmp/skill-hook-test.log"
}
]
}
]
}
}
- Install the plugin, start a new Claude Code session
- Test A — user-initiated: Type
/commit(or any installed skill)
- Expected:
/tmp/skill-hook-test.logcontains "PreToolUse:Skill fired" - Actual: File is not created. Hook does not fire.
- Test B — Claude-initiated: Ask Claude "please commit my changes" so it decides to invoke the Skill tool
- Expected:
/tmp/skill-hook-test.logcontains "PreToolUse:Skill fired" - Actual: Hook fires correctly.
Impact
This means plugins cannot reliably intercept or enrich skill invocations via PreToolUse/PostToolUse hooks — whether a hook fires depends on how the user triggered the skill, which the plugin author cannot control. The only workaround is parsing the raw prompt text via UserPromptSubmit, which is fragile (requires pattern-matching slash command syntax) and limited (no access to the tool input payload that PreToolUse provides).
Claude Model
Opus 4.6 (not model-dependent — this is framework behavior)
Is this a regression?
Unknown — unclear if this ever worked differently.
Claude Code Version
2.1.39
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗