Skip to content

Prompt-based hook set (validate + completion gate)

A plugin hooks.json combining a prompt-based PreToolUse validator, a Stop-event completion gate, and a SessionStart context loader. Plugin format uses the {“hooks”: {…}} wrapper; user settings.json omits it.

Parameter What to supply
${CLAUDE_PLUGIN_ROOT} absolute path to the installed plugin — always use for portability
Prompt-based hook set (validate + completion gate)
{
"description": "Validation hooks for code quality",
"hooks": {
"PreToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "prompt",
"prompt": "Validate file write safety. Check: system paths, credentials, path traversal, sensitive content. Return 'approve' or 'deny'."
}
]
}
],
"Stop": [
{
"matcher": "*",
"hooks": [
{
"type": "prompt",
"prompt": "Verify task completion: tests run, build succeeded, questions answered. Return 'approve' to stop or 'block' with reason to continue."
}
]
}
],
"SessionStart": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/load-context.sh",
"timeout": 10
}
]
}
]
}
}