florianbruniaux/claude-code-ultimate-guide/eval-hooks

Claude Code and agent skill by florianbruniaux/claude-code-ultimate-guide

Trust tier 2
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"},{"type":"config","description":"Configuration overrides"}]
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Audit Claude Code and Codex hooks for validity, safety, and correctness across settings.json, hooks.json, config.toml, plugin, and skill or agent frontmatter hooks. Resolves each command, checks event names, handler types, matchers, exit-code and JSON decision strategy, and timeouts against each host's documented rules, then reviews hooks one by one. Use when setting up hooks, debugging a hook that never fires, never blocks, or hangs the agent, or doing a periodic hooks hygiene pass. Not for wr…

Install

npx vskill@latest install florianbruniaux/claude-code-ultimate-guide/eval-hooks

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as florianbruniaux/claude-code-ultimate-guide/eval-hooks.

Hooks evaluator

Discover every Claude Code and Codex hook in scope, validate each one against the filesystem and the host's documented hook semantics, then run an interactive session to confirm or improve them.

The goal is not just to score; it is to leave every hook working, correctly scoped, and safe to run.

Sources of truth: the official Claude Code hooks reference (https://code.claude.com/docs/en/hooks) and the Codex hooks documentation (https://developers.openai.com/codex/hooks). When a rule below and the live documentation disagree, the documentation wins; report the disagreement instead of scoring against stale text.

When to use

  • First time adding hooks (validate before committing)
  • A hook never fires, or fires on every tool call
  • The agent hangs noticeably before executing a tool
  • A policy hook is supposed to block but doesn't
  • After copying hooks from another project, machine, or host
  • Periodic hygiene: "are all these hooks still doing something useful?"

Scope

ArgumentAudit
noneEvery Claude Code and Codex location listed below that exists
claude or codexThat host only
a file pathThat file only (settings JSON, hooks.json, config.toml, skill or agent file)
audit-only, or the user asks for no changesSteps 1-4 and 6 only: list each proposed change instead of asking or editing, and omit the user-feedback lines from the report

Audit each host with its own rules. Never score a Codex hook against Claude Code semantics or the reverse.

When a ctxharness doctor --format json report generated during this task is available, reconcile against it: every hook-layer finding it reports must appear in the audit, and every extra finding needs file:line evidence.


Claude Code: Key concepts

Event types (33)
EventWhen it firesExit 2 effect
SessionStartSession begins or resumesStderr to user only
Setup--init-only, or --init / --maintenance in -p modeIgnored
UserPromptSubmitPrompt submitted, before processingBlocks and erases the prompt
UserPromptExpansionA typed command expands into a promptBlocks the expansion
PreToolUseBefore a tool call executesBlocks the tool call
PermissionRequestA tool call needs a permission decisionNot honored: deny through the JSON decision object
PermissionDeniedAuto mode denies a tool callIgnored (only hookSpecificOutput.retry is read)
PostToolUseAfter a tool call succeedsStderr to Claude; the tool already ran
PostToolUseFailureAfter a tool call failsStderr to Claude
PostToolBatchAfter a full batch of parallel tool callsStops the agentic loop
NotificationClaude Code sends a notificationIgnored
MessageDisplayWhile assistant text is displayedOriginal text displayed
SubagentStartA subagent is spawnedStderr to user only
SubagentStopA subagent finishesPrevents the subagent from stopping
TaskCreatedA task is being createdRolls back the creation
TaskCompletedA task is being marked completedPrevents completion
StopClaude finishes respondingPrevents stopping, continues the turn
StopFailureThe turn ends on an API errorIgnored (except terminalSequence)
TeammateIdleAn agent team teammate is about to go idleKeeps the teammate working
InstructionsLoadedA CLAUDE.md or .claude/rules/*.md file loadsIgnored
ConfigChangeA configuration file changes mid-sessionBlocks the change (except policy_settings)
CwdChangedThe working directory changesStderr to user only
DirectoryAddedA directory is added via /add-dir or SDK register_repo_rootStderr to debug log; already added
FileChangedA watched file changes on diskStderr to user only
WorktreeCreateA worktree is being createdAny non-zero exit fails creation
WorktreeRemoveA worktree is being removedAny non-zero exit fails removal if the directory remains
PreCompactBefore compactionBlocks compaction
PostCompactAfter compactionStderr to user only
PreModelSwitchBefore a requested model switchBlocks the switch
PostModelSwitchAfter the session model changesStderr to user only
ElicitationAn MCP server requests user inputDenies the elicitation
ElicitationResultAfter the user answers an elicitationBlocks the response (becomes decline)
SessionEndSession terminatesStderr to user only
Exit codes and JSON output
  • Exit 2 blocks on the events whose row says so. No JSON can override it, not even permissionDecision: "allow".
  • JSON is read on every exit code, not only 0. For events with a standard decision model, a valid JSON decision takes effect on exit 0 or any other non-2 code: hookSpecificOutput.permissionDecision: "deny" (PreToolUse, PreModelSwitch), hookSpecificOutput.decision.behavior: "deny" (PermissionRequest), top-level decision: "block" (UserPromptSubmit, UserPromptExpansion, PostToolUse, PostToolUseFailure, PostToolBatch, Stop, SubagentStop, ConfigChange, PreCompact, TaskCreated, PreModelSwitch).
  • Any other non-zero code without valid JSON is a non-blocking error: the action proceeds and the transcript shows the first stderr line. A missing or non-executable script exits with a code like 127 and lands in this bucket, so a mistyped path silently disables a policy gate.
  • Exit 0 stdout becomes context only on UserPromptSubmit, UserPromptExpansion, SessionStart, and PostModelSwitch; elsewhere it goes to the debug log.

A policy hook is correctly built when it uses either exit 2 or a JSON decision supported by its event. Exit 1 alone is the defect.

Timeout defaults (seconds)
HandlerDefault
command, http, mcp_tool600
same, on UserPromptSubmit, PreModelSwitch, PostModelSwitch30
same, on MessageDisplay10
prompt30
agent60
SessionEnd1.5 total budget; a per-hook timeout raises it to the highest configured value, up to 60. Plugin hook timeouts do not raise it. CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS overrides it

A timed-out command, http, or mcp_tool hook on PreToolUse does not block the tool call; on PreModelSwitch it blocks the switch. timeout is not enforced on a running async: true hook; it is enforced with asyncRewake.

Handler types and where they are allowed
Handler typeAllowed on
command, mcp_toolEvery event
httpEvery event except SessionStart and Setup
promptPermissionDenied, PostToolBatch, PostToolUse, PostToolUseFailure, PreToolUse, Stop, SubagentStop, TaskCompleted, TaskCreated, TeammateIdle, UserPromptExpansion, UserPromptSubmit, PermissionRequest
agent (experimental)Same as prompt, except PermissionRequest, where an agent hook is skipped

On PermissionDenied, prompt and agent hooks run but their output is discarded.

Handler fields
FieldApplies toNotes
typeallcommand, http, mcp_tool, prompt, agent
ifallOne permission rule, such as Bash(git *). Evaluated only on PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDenied; on any other event the hook never runs. Best-effort filter, not an enforcement mechanism
timeoutallSeconds
statusMessageallSpinner text
onceallHonored only in skill frontmatter; ignored in settings files and agent frontmatter
commandcommandShell string, or the executable when args is set
argscommandExec form: no shell, each element one argument. Preferred when referencing ${CLAUDE_PROJECT_DIR} or ${CLAUDE_PLUGIN_ROOT}
shellcommandbash or powershell; ignored when args is set
asynccommandRuns in the background; cannot block or decide
asyncRewakecommandBackground, and wakes Claude when the process exits 2
url, headers, allowedEnvVarshttpBlocks only through a 2xx JSON body; status codes alone never block
server, tool, inputmcp_toolUses an already connected server
prompt, modelprompt, agent$ARGUMENTS receives the hook input
Matchers
Matcher valueEvaluated as
"*", "", or omittedMatch all
Only letters, digits, _, -, spaces, ,, `\`Exact string, or a list separated by `\ or ,` (hyphens need v2.1.195+)
Any other characterUnanchored JavaScript regex (Edit.* also matches NotebookEdit; anchor with ^...$)

FileChanged and StopFailure use a narrower exact set (letters, digits, _, |). Each event filters a different field:

EventMatcher filters
PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDeniedtool name (Bash, `Edit\Write, mcp__server__.*`)
SessionStartstartup, resume, clear, compact, fork
Setupinit, maintenance
SessionEndclear, resume, logout, prompt_input_exit, other
Notificationnotification type
SubagentStart, SubagentStopagent type
PreCompact, PostCompactmanual, auto
PreModelSwitch, PostModelSwitchcanonical target model name
ConfigChangeconfiguration source
DirectoryAddedslash_command, register_repo_root
FileChangedliteral filenames to watch
StopFailureerror type
InstructionsLoadedload reason
UserPromptExpansioncommand name
Elicitation, ElicitationResultMCP server name

No matcher support (a matcher is silently ignored): UserPromptSubmit, PostToolBatch, Stop, TeammateIdle, TaskCreated, TaskCompleted, WorktreeCreate, WorktreeRemove, CwdChanged, MessageDisplay.

Execution model
  • All matching hooks run in parallel.
  • The same handler defined in more than one settings file runs once. A plugin's or a skill's copy of the same handler stays separate.
  • PermissionRequest hooks also run in sessions that cannot show a prompt, such as background subagents in -p mode; if no hook decides, the call is denied.
  • Several PreToolUse decisions resolve as deny > defer > ask > allow. The documentation does not define which updatedInput wins when several hooks rewrite the same call.
  • Stop and SubagentStop continuations, through decision: "block" or additionalContext, are bounded by the stop_hook_active input and an 8-consecutive-continuation cap.
  • Command hooks run without a controlling terminal: interactive commands (read, fzf, gum, any TUI) cannot get input. Use terminalSequence in JSON output for notifications.

Claude Code: Locations scanned

LocationScopeNotes
Managed policy settingsOrganizationCannot be disabled by user, project, or local disableAllHooks
~/.claude/settings.jsonUserNot read by cloud sessions
.claude/settings.jsonProject, committed
.claude/settings.local.jsonProject, personal
Plugin hooks/hooks.jsonWhile the plugin is enabled
Skill frontmatter hooks:Rest of the session once the skill is invokedonce: true honored here only
Subagent frontmatter hooks:While that subagent runsStop becomes SubagentStop. Project subagent hooks run only after workspace trust is accepted, including in -p

~/.claude/settings.local.json is not a documented settings location. If it exists, report it as undocumented and do not score its hooks as active.

Also record, from the effective settings:

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
6,306
Repository forks
821
7-day trend score
43

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks
  • configConfiguration overrides

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/florianbruniaux/claude-code-ultimate-guide/eval-hooks/badge)](https://verified-skill.com/skills/florianbruniaux/claude-code-ultimate-guide/eval-hooks)

Something wrong with this skill or its page? Tell us.