[FEATURE] Add ability to match skill name in hook matchers.
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Problem Statement
Currently, hooks for the Skill tool are "all or nothing." If I set a PreToolUse hook for the Skill tool, it triggers for every instance Skill tool usage even when the hook is defined in a specific skill's frontmatter.
There is currently no way to apply hooks to a specific skill by name within the global configuration or the skill's frontmatter. This prevents developers from creating skill-specific setup/teardown logic or guardrails.
Note: we are using the Skill tool use event as a proxy for the skill's usage.
Proposed Solution
Extend the hook matcher syntax to allow filtering the Skill tool by the name of the skill being invoked. This would ideally use a Skill(<name>) or skill:<name> syntax within the matcher field.
This should specifically target:
PreToolUse: Run a command before a specific Skill is loaded.
PostToolUse: Run a command after a specific skill is loaded.
Alternative Solutions
Our current workaround is to pass the hook payload into PostToolUse scripts and perform the filtering based on skill name but this triggers hook execution for every skill which is not efficient.
Priority
High - Significant impact on productivity
Feature Category
Performance and speed
Use Case Example
Logging skill usage activity for a specific skill:
```{
"PostToolUse": [
{
"matcher": "Skill(dev-skill)",
"hooks": [
{
"type": "command",
"command": "./scripts/log-dev-activity.sh --<custom args relevant only to this skill>"
}
]
}
]
}
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗