From factory-templates
Use when validating the quality of a Claude Code hook configuration (hook.json). Checks event type, matcher specificity, command safety, timeout configuration, and absence of secrets. Returns a 0-100 quality score.
How this skill is triggered — by the user, by Claude, or both
Slash command
/factory-templates:hook-quality-validatorThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
A Claude Code skill for validating `hook.json` configuration files. Produces a 0-100 quality score with a detailed breakdown and actionable issue list.
A Claude Code skill for validating hook.json configuration files. Produces a 0-100 quality score with a detailed breakdown and actionable issue list.
event, command, and timeout are present and correctly typedevent is one of the seven recognised Claude Code lifecycle eventsrm -rf, chmod 777, sudo rm)command for AWS key patterns, hard-coded passwords, and .env credential referencesThe validator accepts either:
dict — the already-parsed hook JSON objecthook.json file{
"event": "PostToolUse",
"command": "echo hook fired",
"timeout": 30
}
{
"event": "PostToolUse",
"matcher": { "tool_name": "Write" },
"command": "python3 scripts/lint.py",
"timeout": 60,
"description": "Run linter after every file write"
}
HookQualityValidator.validate() returns a dict with four keys:
{
"score": 85, # int 0-100
"passed": True, # bool — True when score >= 80
"breakdown": {
"required_fields": 25, # max 25
"matcher_specificity": 20, # max 25
"command_safety": 20, # max 20
"timeout": 15, # max 15
"no_secrets": 15, # max 15
},
"issues": [
"Matcher missing on PostToolUse hook — hook fires on every tool call"
]
}
| File | Purpose |
|---|---|
validator.py | Core HookQualityValidator class |
README.md | Installation and usage guide |
from validator import HookQualityValidator
result = HookQualityValidator().validate("path/to/hook.json")
print(result["score"]) # e.g. 85
print(result["passed"]) # True / False
print(result["issues"]) # list of human-readable problems
| Category | Max pts | Pass condition |
|---|---|---|
| Required fields | 25 | event, command, timeout all present |
| Event type | — | event is a recognised Claude Code lifecycle event (checked inside required-fields category) |
| Matcher specificity | 25 | tool_name or other specific matcher present on applicable events |
| Command safety | 20 | No rm -rf (unscoped), chmod 777, or sudo rm |
| Timeout | 15 | timeout key present and > 0 |
| No secrets | 15 | No AWS key patterns, hard-coded passwords, or .env credential references |
Passing threshold: score >= 80
.md files (use validating-agents instead)validating-commands instead)Before treating a validator score as authoritative:
rm -rf, force-pushes, unbounded loops) trigger critical-severity issuesGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub donalmoloney/factory-template