From authoring
Guides Claude Code hooks: lifecycle events, handler types (command/prompt/agent/http), decision control, matchers, and patterns for guardrails, context injection, quality gates, notifications, automation. Use for creating, debugging, planning.
npx claudepluginhub crouton-labs/crouton-kit --plugin authoringThis skill uses the workspace's default tool permissions.
Hooks are deterministic handlers that fire at lifecycle events. Unlike instructions, hooks **cannot be ignored** — they block, inject, or modify at the system level.
Implements Playwright E2E testing patterns: Page Object Model, test organization, configuration, reporters, artifacts, and CI/CD integration for stable suites.
Guides Next.js 16+ Turbopack for faster dev via incremental bundling, FS caching, and HMR; covers webpack comparison, bundle analysis, and production builds.
Discovers and evaluates Laravel packages via LaraPlugins.io MCP. Searches by keyword/feature, filters by health score, Laravel/PHP compatibility; fetches details, metrics, and version history.
Hooks are deterministic handlers that fire at lifecycle events. Unlike instructions, hooks cannot be ignored — they block, inject, or modify at the system level.
Hooks fire at three points in execution: before the user or agent acts (UserPromptSubmit, PreToolUse), after the system acts (PostToolUse, Stop), and during agent lifecycle transitions (SubagentStart, TaskCompleted). Session bookend events (SessionStart, SessionEnd) handle setup and teardown. See reference.md for the full event list with blocking/injection capabilities per event.
Pick based on how complex the decision is:
| Handler | Use when... |
|---|---|
| command | Logic is deterministic — regex check, file exists, env var set. Fastest. |
| prompt | Decision requires judgment but no file access — "is this prompt asking for secrets?" |
| agent | Decision requires investigation — read files, run commands, check state. |
| http | Hook logic lives outside the machine — shared enforcement service, cross-team policy. |
Default to command. Escalate to prompt only when a shell script can't encode the judgment. Use agent sparingly — it spawns a subagent and adds real latency.
All hook output must be wrapped in hookSpecificOutput with the matching hookEventName. hookEventName is required — without it, Claude Code silently drops the payload.
{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"additionalContext": "injected text"
}
}
See reference.md for the full per-event return value spec (permissionDecision, updatedInput, decision: "block", etc.).
Use | to target multiple tools: "matcher": "Write|Edit|MultiEdit". MCP tools match as mcp__servername__toolname. Omit matcher to catch all tools for that event.
See reference.md for full matcher syntax including SessionStart variants.
Hooks can be declared in SKILL.md or agent frontmatter to scope them to that skill/agent only — useful for guardrails that shouldn't apply globally. Uses the same matcher/handler format as hooks.json, nested under hooks: in frontmatter. See reference.md for a full example.
See patterns.md for comprehensive examples organized by category:
"async": true for hooks that shouldn't block (tests, notifications)stop_hook_active to prevent infinite continuation loops.