Test a single Claude Code hook event in isolation, either by replaying a synthetic JSON fixture through its configured hook command(s), or by tailing the live capture log. Use when verifying hook input/output schemas, permission decisions, or additionalContext behavior without needing to organically trigger the event in a live Chat or Cowork session.
Ships in Hook plugin testing. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Test harness for every Claude Code hook event this plugin knows about. Two modes:
/hook-testing-plugin:hook-lab <EventName> pipes
fixtures/<EventName>.json into the hook command(s) configured for that event in
${CLAUDE_PLUGIN_ROOT}/hooks/hooks.json, and reports exactly what each command
returned./hook-testing-plugin:hook-lab --logs <EventName> shows the most
recent real payloads captured from an actual Chat or Cowork session, from the
central log (or its local fallback — see "Locating the log root" below).Run with no arguments, or --list, to see which events have fixtures and how many live
captures each has.
scripts/log-event.py writes to the first of these that it can create/write to.
Remember hooks execute wherever Claude Code itself runs — the user's HOST machine
in Cowork Chat, not the sandbox VM — so the resolved root may be a host path.
${CLAUDE_HOOKLAB_LOG_ROOT}, if that environment variable is set (explicit
per-machine override, e.g. to point a Windows machine at a shared drive).${CLAUDE_PROJECT_DIR} + /.hook-lab/events, when that variable is set.$HOME/mnt exists (the VM's layout), the
first writable non-internal folder under it (i.e. the connected folder)
/.hook-lab/events — because in the VM, $PWD is the VM-private $HOME,
not the connected folder.$PWD + /.hook-lab/events — the normal case on hosts and CLI.${CLAUDE_PLUGIN_DATA}/events — last resort, local to wherever the hook ran.Within whichever root wins, payloads are split into
<root>/<session_id>/<EventName>.jsonl (no machine segment — Cowork sessions all
report the same hostname, so the session id is what disambiguates). Use
${CLAUDE_SESSION_ID} for the current session's <session_id> unless the user asks
about a different one.
${CLAUDE_SKILL_DIR}/fixtures/ has one JSON file per event: SessionStart, Setup,
InstructionsLoaded, UserPromptSubmit, UserPromptExpansion, MessageDisplay,
PreToolUse, PermissionRequest, PostToolUse, PostToolUseFailure, PostToolBatch,
PermissionDenied, Notification, SubagentStart, SubagentStop, TaskCreated,
TaskCompleted, Stop, StopFailure, TeammateIdle, ConfigChange, CwdChanged,
DirectoryAdded, FileChanged, WorktreeCreate, WorktreeRemove, PreCompact,
PostCompact, SessionEnd, Elicitation, ElicitationResult. Each fixture matches the
input schema documented in ${CLAUDE_PLUGIN_ROOT}/docs/hooks-ref.md for that event
(common fields plus the event-specific ones), with placeholder values under
/tmp/hook-lab/.
$ARGUMENTS--list: list mode.--logs : log-tail mode, event name is the remainder.$ARGUMENTS trimmed.Run ls "${CLAUDE_SKILL_DIR}/fixtures" to show every testable event. Resolve the log
root per "Locating the log root" above, then for each event check whether
<root>/${CLAUDE_SESSION_ID}/<name>.jsonl exists and how many lines it has
(wc -l if present) so the user can see which events have already fired live in this
session. Mention which root won (override, working directory, or plugin-data
fallback) so the user knows where captures are landing.
${CLAUDE_SKILL_DIR}/fixtures/<EventName>.json exists. If not, list the
available names from step 2's ls output and stop — don't guess a fixture.${CLAUDE_PLUGIN_ROOT}/hooks/hooks.json and find every hook handler registered
under .hooks.<EventName>. For each type: "command" handler:
if field, check whether the fixture's tool_input.command (when
present) plausibly matches the Bash pattern; note the check but run it anyway if
unsure, since if filtering is best-effort in real usage too.command and
args, with ${CLAUDE_PLUGIN_ROOT} resolved to this plugin's root) and run it with
the fixture piped to stdin, e.g.:
cat "${CLAUDE_SKILL_DIR}/fixtures/<EventName>.json" | python "${CLAUDE_PLUGIN_ROOT}/scripts/log-event.py"
(that is the POSIX logger; on a Windows host the same payload goes through
powershell -NoProfile -ExecutionPolicy Bypass -File "${CLAUDE_PLUGIN_ROOT}/scripts/log-event.ps1" —
hooks.json runs both halves from one command and each no-ops off-platform){ after trimming
leading whitespace, per the exit-code-0 rule in
${CLAUDE_PLUGIN_ROOT}/docs/hooks-ref.md#exit-code-0) — if so, pretty-print it.<EventName> specifically: look up the event's
"decision control" section in ${CLAUDE_PLUGIN_ROOT}/docs/hooks-ref.md and state
plainly whether the tool call / prompt / stop / etc. would be allowed, blocked, or
left to the normal flow. If that file is somehow missing from the bundle, fall
back to the general rule: exit 0 = allow/normal flow (stdout parsed as JSON if it
starts with {), exit 2 = block with stderr fed back to Claude, any other
non-zero = non-blocking warning shown to the user.<root>/${CLAUDE_SESSION_ID}/<EventName>.jsonl grew
by one line matching the fixture (tail -n 1).Resolve the log root per "Locating the log root" above, then run
tail -n 20 "<root>/${CLAUDE_SESSION_ID}/<EventName>.jsonl". If the user asks
for a different session, ls "<root>" first to find its <session_id>. If
no matching file exists, say plainly that this event hasn't fired live yet in this
surface (Chat or Cowork) and suggest an action that would trigger it, based on
${CLAUDE_PLUGIN_ROOT}/docs/hooks-ref.md's description of when that event fires.
Pretty-print each captured JSON line.
fixtures/ConfigChange.json (opens in a new tab)fixtures/CwdChanged.json (opens in a new tab)fixtures/DirectoryAdded.json (opens in a new tab)fixtures/Elicitation.json (opens in a new tab)fixtures/ElicitationResult.json (opens in a new tab)fixtures/FileChanged.json (opens in a new tab)fixtures/InstructionsLoaded.json (opens in a new tab)fixtures/MessageDisplay.json (opens in a new tab)fixtures/Notification.json (opens in a new tab)fixtures/PermissionDenied.json (opens in a new tab)fixtures/PermissionRequest.json (opens in a new tab)fixtures/PostCompact.json (opens in a new tab)fixtures/PostToolBatch.json (opens in a new tab)fixtures/PostToolUse.json (opens in a new tab)fixtures/PostToolUseFailure.json (opens in a new tab)fixtures/PreCompact.json (opens in a new tab)fixtures/PreToolUse.json (opens in a new tab)fixtures/SessionEnd.json (opens in a new tab)fixtures/SessionStart.json (opens in a new tab)fixtures/Setup.json (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/hook-testing-plugin:hook-lab [EventName] | --logs [EventName] | --listfrom Hook plugin testing
npx claudepluginhub engineering-plus/vo-plugin-catalog --plugin hook-testing-plugin