From claude-code-observability
Audits Claude Code hook event schemas for drift by comparing EVENT_FIELD_REGISTRY in hook_dispatcher.py against official docs. Reports differences with --json or --fix options.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-code-observability:hook-schema-auditThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Detect drift between the hook dispatcher's `EVENT_FIELD_REGISTRY` and official Claude Code documentation.
Detect drift between the hook dispatcher's EVENT_FIELD_REGISTRY and official Claude Code documentation.
--fix: Generate updated registry code (output only, does not auto-apply)--json: Machine-readable JSON output for CI/automation--verbose: Show all fields, not just differencesLoad the hook-management skill and query for official hook event schemas:
Skill(hook-management)
Also spawn the claude-code-guide agent for live web documentation:
Task(claude-code-guide, "WebFetch https://code.claude.com/docs/en/claude_code_docs_map.md to find hook event documentation pages. Then WebFetch those pages. Extract the input fields for each hook event: PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, Notification, UserPromptSubmit, Stop, SubagentStart, SubagentStop, PreCompact, SessionStart, SessionEnd, TeammateIdle, TaskCompleted. Return structured data with event name and field lists.")
Read the EVENT_FIELD_REGISTRY from hook_dispatcher.py:
# Extract the registry definition
grep -A 30 "EVENT_FIELD_REGISTRY = {" plugins/claude-code-observability/hooks/hook_dispatcher.py
Parse the registry into a structured format for comparison.
For each hook event, compare:
EVENT_FIELD_REGISTRY)Generate a report showing:
| Event | Documented | Implemented | Missing | Extra |
|---|---|---|---|---|
| pretooluse | 5 | 3 | tool_input | - |
| notification | 2 | 0 | message, notification_type | - |
Default output:
Hook Schema Audit Report
========================
Schema Version: 1.7.0
Audit Date: 2026-02-15T15:30:00Z
Coverage Summary:
- Total events: 14
- Fully covered: 11 (79%)
- Partially covered: 2 (14%)
- Missing: 1 (7%)
Findings:
[WARNING] notification: Missing fields: message, notification_type
[WARNING] userpromptsubmit: Missing fields: prompt
[OK] pretooluse: All documented fields present
...
Recommendation: Update EVENT_FIELD_REGISTRY to include missing fields.
With --json:
{
"schema_version": "1.7.0",
"audit_timestamp": "2026-02-15T15:30:00Z",
"coverage": {
"total_events": 14,
"fully_covered": 11,
"partially_covered": 2,
"missing": 1
},
"events": {
"pretooluse": {
"status": "ok",
"documented": ["tool_name", "tool_input", "tool_use_id"],
"implemented": ["tool_name", "tool_input", "tool_use_id"],
"missing": [],
"extra": []
}
}
}
With --fix:
Output updated Python code for EVENT_FIELD_REGISTRY that can be copy-pasted into hook_dispatcher.py.
Based on findings, provide actionable recommendations:
# Basic audit
/claude-code-observability:audit-hook-schema
# CI integration (machine-readable)
/claude-code-observability:audit-hook-schema --json
# Generate fix
/claude-code-observability:audit-hook-schema --fix
# Detailed output
/claude-code-observability:audit-hook-schema --verbose
When using --json:
0: All events fully covered1: Some fields missing (partial coverage)2: Critical drift detected (events missing entirely)npx claudepluginhub melodic-software/claude-code-plugins --plugin claude-code-observabilityAudits Claude Code hooks for config validity, script structure, matchers, env vars, decisions, and tests. Run after hook creation, before releases, or for periodic checks.
Scaffolds Claude Code hooks with templates, validation, and conflict analysis. Analyzes existing hooks, prevents conflicts, and generates boilerplate code automatically.
Creates, validates, and refines Claude Code plugin hooks for workflow automation. Supports command hooks (shell scripts), prompt hooks (LLM decisions), event matching, decision schemas, and production safety validation.