Skill With Hooks Example
This is an example skill that demonstrates how to embed Claude Code-compatible hooks
directly in a skill's frontmatter.
Purpose
When this skill is loaded, its hooks become active for the session:
- PreToolUse (Bash): Validates bash commands before execution
- PreToolUse (all tools): Logs all tool invocations
- PostToolUse (all tools): Logs tool results
Hook Scripts
The hooks reference scripts in the ./hooks/ directory relative to this skill:
validate-bash.sh - Checks bash commands for dangerous patterns
log-tool-use.sh - Logs tool name and parameters
log-tool-result.sh - Logs tool execution results
Usage
Load this skill to activate its hooks:
load_skill(skill_name="skill-with-hooks")
The hooks will remain active until the session ends.
Testing
This skill is used to validate the skill-scoped hooks integration between
amplifier-module-tool-skills and amplifier-module-hooks-shell.