validate-hooks

Validates hooks.json structure, event names, and hook type-event compatibility for Claude Code plugins.

1|Updated Mar 22, 2026
One-click install
npx skills add https://github.com/JaviMontano/mao-plugin-qa --skill validate-hooks-javimontano
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: validate-hooks
Source: https://github.com/JaviMontano/mao-plugin-qa/tree/main/skills/validate-hooks
Command: npx skills add https://github.com/JaviMontano/mao-plugin-qa --skill validate-hooks-javimontano

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Misconfigured hooks.json files cause silent failures and runtime errors in Claude Code plugins, especially when prompt or agent hooks are registered on events that lack ToolUseContext. This Skill audits hooks.json and reports every structural and compatibility issue with severity levels and remediation guidance. ## Core Features & Use Cases - Type-Event Compatibility Check: Cross-references all 4 hook types (command, http, prompt, agent) against all 22 events, flagging prompt/agent hooks on the 19 non-ToolUseContext events as CRITICAL. - Structural Validation: Verifies JSON syntax, the top-level hooks object shape, valid event names with misspelling suggestions, required fields per hook type, and matcher values. - Script Reference Checks: Confirms that command-type hooks point to existing, executable script files within the plugin tree. - Use Case: Before publishing a plugin, run this audit to catch a prompt hook mistakenly registered on SessionStart, which would otherwise fail silently at runtime. ## Quick Start Validate the hooks.json file in my plugin at ./my-plugin and report any type-event compatibility problems.

Frequently Asked Questions about validate-hooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate a hooks.json file for a Claude Code plugin?▼

Point the Skill at your plugin root and it parses hooks/hooks.json, checking JSON syntax, the top-level hooks object, event names, hook entry fields, and type-event compatibility. It outputs a severity table with CRITICAL, WARNING, and INFO findings plus a safety summary.

Which hook types work on which Claude Code events?▼

command and http hooks work on all 22 events. prompt and agent hooks only work on PreToolUse, PostToolUse, and PermissionRequest, because those are the only events that provide ToolUseContext. Using prompt or agent on any other event causes a runtime error.

Why does my prompt hook fail on SessionStart?▼

Prompt hooks require ToolUseContext, which SessionStart does not provide, so the hook fires without context and fails silently. Change the type to command or move the hook to PreToolUse, PostToolUse, or PermissionRequest.

What is the difference between PostToolUse and PostToolUseFailure for hooks?▼

PostToolUse provides ToolUseContext, so prompt and agent hooks are safe there. PostToolUseFailure does not provide ToolUseContext, so prompt or agent hooks registered on it will fail at runtime. This is a common confusion the validator flags.

Can this validator fix or modify my hooks.json automatically?▼

No, the Skill is strictly read-only and never modifies hooks.json or any other file. It reports each finding with severity, an explanation of why it fails, and specific remediation steps for you to apply manually.

What are the limitations of hooks.json static validation?▼

Static validation cannot verify runtime behavior, so a syntactically correct command may still fail at execution time, for example by referencing a missing binary. It also does not evaluate matcher regex semantics or hooks defined in settings.json or CLAUDE.md.