Create a new Claude Code hook for lifecycle automation.
Create Claude Code hooks to automate lifecycle events like PreToolUse or SessionStart. Define matchers for specific tools/contexts and actions like prompts, commands, or skipping execution.
/plugin marketplace add artimath/surf-market/plugin install claude-code-meta@surf-marketCreate a new Claude Code hook for lifecycle automation.
Invoke hook-builder reference for current patterns:
skills/claude-code-meta/references/hook-builder.mdExtract requirements:
Plan hook:
Add to plugin.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "prompt",
"prompt": "Reminder: Check quality gates before proceeding"
}
]
}
]
}
}
Test hook:
Document:
Validate:
Return:
Lifecycle Events:
Matcher Patterns:
Action Types:
prompt - inject text into conversationcommand - execute shell commandskip - prevent tool execution (PreToolUse only)Best Practices:
skills/claude-code-meta/references/hook-builder.md