fix(hook-development): recognize all five hook handler types#75537
Open
fcarvajalbrown wants to merge 1 commit into
Open
fix(hook-development): recognize all five hook handler types#75537fcarvajalbrown wants to merge 1 commit into
fcarvajalbrown wants to merge 1 commit into
Conversation
The hook-development skill only knew two of the five hook handler types that Claude Code supports. Both the teaching docs and the bundled validator were stale, so the validator rejected valid configs as errors. - validate-hook-schema.sh: accept command, prompt, http, mcp_tool, and agent (previously errored on the last three); add per-type required-field checks (http->url, mcp_tool->server+tool, agent->prompt); expand the event allowlist to the full documented set so events like FileChanged/PostCompact are no longer flagged. - SKILL.md: document all five types with required/optional fields and examples (this omission was the root cause of the drift). - scripts/README.md: list all five types instead of command/prompt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
plugin-devhook-development skill teaches plugin authors how to writehooks.json, but it only knew two of the five hook handler types Claude Code actually supports. Both the docs and the bundled validator had drifted from the product:scripts/validate-hook-schema.shaccepted onlycommandandprompt, and reportedhttp,mcp_tool, andagenthooks as errors — even though all three are valid, documented types. So the tool failed valid configs it was meant to certify.SKILL.md's "Hook Types" section documented only 2 of the 5 types (the root cause of the drift).Verified against the official docs (https://code.claude.com/docs/en/hooks): the five handler types are
command,prompt,http,mcp_tool, andagent.Changes
scripts/validate-hook-schema.shhttp/mcp_tool/agent.http->url,mcp_tool->server+tool,agent->prompt.FileChanged,PostCompact,PermissionRequest, etc.) so valid events are no longer flagged as unknown.SKILL.md— add a five-type overview table plus dedicated subsections for HTTP, MCP-tool, and Agent hooks with required/optional fields and examples.scripts/README.md— list all five types instead ofcommand/prompt.Testing
Ran the validator against fixtures built from the official docs:
http/mcp_tool/agentconfigInvalid type 'http', exit 1)httphook missingurlmcp_toolmissingtoolwebhook)FileChangedeventcommand/promptconfig