Preflight Checklist
What's Wrong?
Skill-scoped hooks defined in SKILL.md frontmatter (using the hooks YAML property) are not being triggered when the skill is loaded within a plugin.
I created a test skill with a PreToolUse hook that should trigger when Bash tool is called. The hook is defined in the SKILL.md frontmatter:
---
name: test
description: This skill should be used when the user says "test hooks"...
hooks:
PreToolUse:
- matcher: "Bash"
hooks:
- type: command
command: "touch /tmp/skill-hook-triggered.txt"
once: true
---
When I invoke the skill and then use the Bash tool, the hook is never executed - the file /tmp/skill-hook-triggered.txt is never created.
What Should Happen?
When a skill is loaded (via /test or natural language trigger), the hooks defined in that skill's SKILL.md frontmatter should be registered and executed when matching tools are used.
In this case, after loading the test skill and running any Bash command, the file /tmp/skill-hook-triggered.txt should be created.
Steps to Reproduce
-
Create a plugin with the following structure:
plugins/eval/
├── .claude-plugin/
│ └── plugin.json
└── skills/
└── test/
└── SKILL.md
-
Create SKILL.md with hooks in frontmatter:
---
name: test
description: This skill should be used when the user says "test hooks", "hook 테스트", or wants to verify that skill-level hooks are working.
hooks:
PreToolUse:
- matcher: "Bash"
hooks:
- type: command
command: "touch /tmp/skill-hook-triggered.txt"
once: true
---
# Test Skill
Hook 동작 테스트를 위한 간단한 스킬입니다.
-
Register and enable the plugin in settings.json
-
Invoke the skill by typing /test or "hook 테스트"
-
Run any Bash command (e.g., ls)
-
Check if /tmp/skill-hook-triggered.txt exists
Result: File does not exist - hook was not triggered.
Claude Model
Is this a regression?
Claude Code Version
2.1.5 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Cursor
Additional Information
The skill loads and displays correctly (the SKILL.md content is shown to the model), but the hooks defined in the frontmatter appear to be ignored.
This may be related to how skill-scoped hooks are parsed and registered when loaded dynamically via the skill invocation flow vs. static plugin hooks defined in hooks.json.
Plugin structure used for testing:
// .claude-plugin/plugin.json
{
"name": "eval",
"description": "Evaluation framework plugin",
"version": "1.1.0"
}
Preflight Checklist
What's Wrong?
Skill-scoped hooks defined in SKILL.md frontmatter (using the hooks YAML property) are not being triggered when the skill is loaded within a plugin.
I created a test skill with a
PreToolUsehook that should trigger whenBashtool is called. The hook is defined in the SKILL.md frontmatter:When I invoke the skill and then use the Bash tool, the hook is never executed - the file
/tmp/skill-hook-triggered.txtis never created.What Should Happen?
When a skill is loaded (via
/testor natural language trigger), the hooks defined in that skill's SKILL.md frontmatter should be registered and executed when matching tools are used.In this case, after loading the test skill and running any Bash command, the file
/tmp/skill-hook-triggered.txtshould be created.Steps to Reproduce
Create a plugin with the following structure:
Create
SKILL.mdwith hooks in frontmatter:Register and enable the plugin in
settings.jsonInvoke the skill by typing
/testor "hook 테스트"Run any Bash command (e.g.,
ls)Check if
/tmp/skill-hook-triggered.txtexistsResult: File does not exist - hook was not triggered.
Claude Model
Is this a regression?
Claude Code Version
2.1.5 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Cursor
Additional Information
The skill loads and displays correctly (the SKILL.md content is shown to the model), but the hooks defined in the frontmatter appear to be ignored.
This may be related to how skill-scoped hooks are parsed and registered when loaded dynamically via the skill invocation flow vs. static plugin hooks defined in
hooks.json.Plugin structure used for testing: