2026-02-01 18:15:01 +00:00
|
|
|
{
|
|
|
|
|
"$schema": "https://claude.ai/schemas/hooks.json",
|
|
|
|
|
"hooks": {
|
|
|
|
|
"PreToolUse": [
|
2026-02-02 07:17:36 +00:00
|
|
|
{
|
|
|
|
|
"matcher": "*",
|
|
|
|
|
"hooks": [
|
|
|
|
|
{
|
|
|
|
|
"type": "command",
|
|
|
|
|
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/detect-module.sh"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"description": "Detect current module and export context variables",
|
|
|
|
|
"once": true
|
|
|
|
|
},
|
2026-02-01 18:15:01 +00:00
|
|
|
{
|
|
|
|
|
"matcher": "Bash",
|
|
|
|
|
"hooks": [
|
|
|
|
|
{
|
|
|
|
|
"type": "command",
|
2026-02-01 19:35:06 +00:00
|
|
|
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/prefer-core.sh"
|
2026-02-01 18:15:01 +00:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"description": "Block destructive commands (rm -rf, sed -i, xargs rm) and enforce core CLI"
|
2026-02-01 19:35:06 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"matcher": "Write",
|
|
|
|
|
"hooks": [
|
|
|
|
|
{
|
|
|
|
|
"type": "command",
|
|
|
|
|
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/block-docs.sh"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"description": "Block random .md file creation"
|
2026-02-02 07:13:28 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"matcher": "tool == \"Write\" || tool == \"Edit\"",
|
|
|
|
|
"hooks": [
|
|
|
|
|
{
|
|
|
|
|
"type": "command",
|
|
|
|
|
"command": "echo \"${tool_input.content}\" | ${CLAUDE_PLUGIN_ROOT}/scripts/detect-secrets.sh ${tool_input.filepath}"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"description": "Detect secrets in code before writing or editing files."
|
2026-02-01 18:15:01 +00:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"PostToolUse": [
|
|
|
|
|
{
|
|
|
|
|
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\.go$\"",
|
|
|
|
|
"hooks": [
|
|
|
|
|
{
|
|
|
|
|
"type": "command",
|
2026-02-01 19:35:06 +00:00
|
|
|
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/go-format.sh"
|
2026-02-01 18:15:01 +00:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"description": "Auto-format Go files after edits"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\.php$\"",
|
|
|
|
|
"hooks": [
|
|
|
|
|
{
|
|
|
|
|
"type": "command",
|
2026-02-01 19:35:06 +00:00
|
|
|
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/php-format.sh"
|
2026-02-01 18:15:01 +00:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"description": "Auto-format PHP files after edits"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"matcher": "tool == \"Edit\"",
|
|
|
|
|
"hooks": [
|
|
|
|
|
{
|
|
|
|
|
"type": "command",
|
2026-02-01 19:35:06 +00:00
|
|
|
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/check-debug.sh"
|
2026-02-01 18:15:01 +00:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"description": "Warn about debug statements (dd, dump, fmt.Println)"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"matcher": "tool == \"Bash\" && tool_input.command matches \"^git commit\"",
|
|
|
|
|
"hooks": [
|
|
|
|
|
{
|
|
|
|
|
"type": "command",
|
2026-02-01 19:35:06 +00:00
|
|
|
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/post-commit-check.sh"
|
2026-02-01 18:15:01 +00:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"description": "Warn about uncommitted work after git commit"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"PreCompact": [
|
|
|
|
|
{
|
|
|
|
|
"matcher": "*",
|
|
|
|
|
"hooks": [
|
|
|
|
|
{
|
|
|
|
|
"type": "command",
|
2026-02-01 19:35:06 +00:00
|
|
|
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/pre-compact.sh"
|
2026-02-01 18:15:01 +00:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"description": "Save state before auto-compact to prevent amnesia"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"SessionStart": [
|
|
|
|
|
{
|
|
|
|
|
"matcher": "*",
|
|
|
|
|
"hooks": [
|
|
|
|
|
{
|
|
|
|
|
"type": "command",
|
2026-02-01 19:35:06 +00:00
|
|
|
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/session-start.sh"
|
2026-02-01 18:15:01 +00:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"description": "Restore recent session context on startup"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|