- Home
- Skills
- Code Quality & Review
- Claude Code Hooks & Plugin Config Linter
Works with the AI Agents you already use
Claude Code Hooks & Plugin Config Linter
- `UNKNOWN_EVENT`: Flags unrecognized hook event keys outside the 9 canonical Claude Code lifecycle events.
$15
Claude Code Hooks & Plugin Config Linter
Example session with this skill installed
Run the linter on my current Claude Code settings and hook scripts to check for blocking exit code errors and tool matcher typos.
- Read your context and instructions
- Compiled the claude code hooks
I have audited your Claude Code configuration and hook scripts. The linter detected 2 critical issues that would cause your hooks to fail silently or fail to block execution as intended.
Hook Configuration Audit Report
| Check | Status | Finding | Severity |
|---|---|---|---|
| JSON Syntax | PASS | Valid settings.json structure | - |
| Event Names | PASS | All keys match canonical event list | - |
| Tool Matchers | FAIL | Found "matcher": "bash". Must be "Bash" | HIGH |
| Blocking Logic | FAIL | guard_rm.py uses sys.exit(1). Use exit(2) to block. | HIGH |
| Plugin Cache | PASS | No duplicate plugin versions detected | - |
| Portability | WARNING | ${CLAUDE_PLUGIN_ROOT} detected without Windows quoting | LOW |
Result: [BLOCKED]
The audit failed due to case-sensitive matcher mismatches and non-blocking exit codes in security scripts.
Next steps
- Update
settings.jsonto use"matcher": "Bash"(uppercase). - Modify
hooks/guard_rm.pyto usesys.exit(2)for all paths where the command should be denied. - Re-run the linter to confirm all
HIGHseverity findings are resolved.
Connects securely to your tools. The creator never sees your data.
About this skill
Above-the-Fold Hook (3-Second Value)
Stop shipping silently broken Claude Code hooks—where a typo like BeforeToolUse is ignored, a lowercase "matcher": "bash" never fires, or a PreToolUse guard calling sys.exit(1) lets destructive commands execute anyway.
Claude Code Hooks & Plugin Config Linter delivers a deterministic 3-layer static audit guardrail (SKILL.md 5-step audit SOP + JSON Schema Draft 2020-12 contracts + zero-dependency Python 3 stdlib AST/JSON linter) that validates settings.json, inspects referenced .py and .sh blocking hooks for the exit-code 2 rule, catches tool matcher casing bugs, flags Windows ${CLAUDE_PLUGIN_ROOT} path risks, detects duplicate cached plugin versions, and exits 1 on any blocking violation.
What's Inside (3-Layer Architecture + 60-Second Test Pack)
- Layer 1 — 5-Step Hooks & Plugin-Cache Audit SOP (
SKILL.md): Operational playbook for Claude Code, Cursor, and Codex CLI enforcing JSON Syntax Validation -> Known Event Verification -> Canonical Tool Matcher Casing -> AST/Regex Exit-Code 2 &${CLAUDE_PLUGIN_ROOT}Audit -> Plugin Cache Duplicate Gate. - Layer 2 — JSON Schema Draft 2020-12 Contracts (
schemas/):schemas/lint_policy.schema.json: Strictly typed policy contract configuringfail_on_severities,plugin_root_path_severity(WARNINGorHIGH),known_events,canonical_tool_matchers, and optionalblocking_events.schemas/lint_report.schema.json: Machine-readable audit report contract coveringstatus,exit_code,settings_file,scripts_scanned,cache_plugins_checked,counts_by_rule, and structuredfindingswith locations and remediations.
- Layer 3 — Zero-Dependency Static Linter Engine (
scripts/hooks_config_linter.py): 100% Python 3 standard library (argparse,ast,json,pathlib,re,shlex,sys,typing) enforcing 6 deterministic rules:JSON_INVALID: Catches malformed JSON insettings.json,--cache, or--policyand emits a structured[BLOCKED]report (exit 1) instead of a Python traceback.UNKNOWN_EVENT: Flags unrecognized hook event keys outside the 9 canonical Claude Code lifecycle events.EXIT_CODE_RISK: Uses Pythonast(.py:sys.exit(1),exit(1),raise SystemExit(1)) and regex (.sh:exit 1) to catch blocking-event hook scripts missing an exit-code2blocking path.MATCHER_CASE: Flags case mismatches against canonical Claude Code tool names (Bash,Edit,Write,Read,Glob,Grep,WebFetch,WebSearch,Task,NotebookEdit), including regex alternation expressions likeEdit|Write.PLUGIN_ROOT_PATH: Flags${CLAUDE_PLUGIN_ROOT}in hook commands with Windows-path resolution guidance at policy-controlled severity (WARNINGorHIGH).CACHE_DUPLICATE: Detects plugins installed at 2+ versions in the plugin cache inventory JSON.- Pure-ASCII terminal output (Windows
cp1252-safe),--json, and--out-report <path>support.
- 60-Second Test Pack (
examples/):examples/lint_policy.json: Default policy contract ready for CI or local pre-commit checks.- FAIL set (
examples/settings_fail.json,examples/hooks_fail/block_rm.py,examples/plugin_cache_fail.json): Plants 4 exact defects (UNKNOWN_EVENT,EXIT_CODE_RISK,MATCHER_CASE,CACHE_DUPLICATE) and proves[BLOCKED](exit 1). - PASS set (
examples/settings_pass.json,examples/hooks_pass/block_rm.py,examples/plugin_cache_pass.json): Compliant hook config,sys.exit(2)guard hook consumingsys.stdin, and clean single-version plugin cache proving[PASS](exit 0, 0 findings).
Who This Is For & Prerequisites
Built for:
- Developers, platform teams, and Claude Code plugin authors maintaining
.claude/settings.json,PreToolUse/Stopguard scripts, and multi-developer plugin caches across Windows, macOS, and Linux. - Teams running Claude Code, Cursor, or Codex CLI in CI who want a fast, offline, zero-dependency config gate before hook mistakes reach production.
Prerequisites:
- Python 3.9+ (uses Python 3 standard library only — zero
pip install, zero external packages, zero network calls). - Works cross-platform on Windows (pure ASCII
cp1252-safe output), macOS, and Linux.
60-Second Quick-Start
Run directly from the skill folder:
# 1. Run FAIL fixtures (catches MATCHER_CASE, EXIT_CODE_RISK, UNKNOWN_EVENT, CACHE_DUPLICATE -> exit 1)
python scripts/hooks_config_linter.py \
--settings examples/settings_fail.json \
--scripts-dir examples/hooks_fail \
--cache examples/plugin_cache_fail.json \
--policy examples/lint_policy.json
# 2. Run PASS fixtures (0 findings -> exit 0)
python scripts/hooks_config_linter.py \
--settings examples/settings_pass.json \
--scripts-dir examples/hooks_pass \
--cache examples/plugin_cache_pass.json \
--policy examples/lint_policy.json
# 3. Emit machine-readable JSON report (or save with --out-report report.json)
python scripts/hooks_config_linter.py \
--settings examples/settings_pass.json \
--scripts-dir examples/hooks_pass \
--cache examples/plugin_cache_pass.json \
--policy examples/lint_policy.json \
--json
Real Terminal Proof
1. FAIL Gate — Catching Matcher Casing, Exit-Code 1 Bug, Unknown Event & Cache Duplicate (exit code 1)
$ python scripts/hooks_config_linter.py --settings examples/settings_fail.json --scripts-dir examples/hooks_fail --cache examples/plugin_cache_fail.json --policy examples/lint_policy.json
============================================================================
CLAUDE CODE HOOKS & PLUGIN CONFIG LINTER -- STATIC AUDIT REPORT
============================================================================
Settings File : examples/settings_fail.json
Scripts Dir : examples/hooks_fail
Plugin Cache : examples/plugin_cache_fail.json
Policy File : examples/lint_policy.json
Items Audited : Scripts Scanned=1 | Cache Plugins Checked=3
----------------------------------------------------------------------------
RULE COUNTS : JSON_INVALID=0 | UNKNOWN_EVENT=1 | EXIT_CODE_RISK=1 | MATCHER_CASE=1 | PLUGIN_ROOT_PATH=0 | CACHE_DUPLICATE=1
----------------------------------------------------------------------------
Findings (4 total, 4 blocking):
1. [HIGH|BLOCK] MATCHER_CASE @ examples/settings_fail.json::hooks.PreToolUse[0].matcher
Detail: Tool matcher 'bash' in 'bash' uses wrong casing; canonical Claude Code tool name is 'Bash'.
Fix : Update matcher 'bash' to exact canonical casing 'Bash' because Claude Code tool matchers are case-sensitive.
2. [HIGH|BLOCK] EXIT_CODE_RISK @ examples/hooks_fail/block_rm.py:line 24
Detail: Blocking hook 'examples/hooks_fail/block_rm.py' wired to 'PreToolUse' exits with code 1 (Python AST at line 24) and defines no exit-code 2 blocking path.
Fix : In Claude Code blocking hooks, exit code 1 is a non-blocking error that lets execution continue. Write the block reason to stderr and exit with code 2 (sys.exit(2) in Python or 'exit 2' in shell).
3. [HIGH|BLOCK] UNKNOWN_EVENT @ examples/settings_fail.json::hooks.BeforeToolUse
Detail: Unknown hook event name 'BeforeToolUse'. Claude Code silently ignores unrecognized hook keys.
Fix : Replace with a valid Claude Code hook event: PreToolUse, PostToolUse, UserPromptSubmit, Notification, Stop, SubagentStop, SessionStart, SessionEnd, PreCompact.
4. [HIGH|BLOCK] CACHE_DUPLICATE @ examples/plugin_cache_fail.json::plugins[acme-dev-kit]
Detail: Plugin 'acme-dev-kit' has 2 cached entries (versions: 1.1.0, 1.2.0). Duplicate cached versions cause stale hook resolution.
Fix : Remove older cached versions of 'acme-dev-kit' so only a single active version remains in the plugin cache.
----------------------------------------------------------------------------
[BLOCKED] Config audit failed: 4 blocking violation(s) (4 total finding(s)). Fix findings above and re-run.
============================================================================
# Exit code: 1
2. PASS Gate — Clean Hooks Config, Exit-Code 2 Script & Deduplicated Plugin Cache (exit code 0)
$ python scripts/hooks_config_linter.py --settings examples/settings_pass.json --scripts-dir examples/hooks_pass --cache examples/plugin_cache_pass.json --policy examples/lint_policy.json
============================================================================
CLAUDE CODE HOOKS & PLUGIN CONFIG LINTER -- STATIC AUDIT REPORT
============================================================================
Settings File : examples/settings_pass.json
Scripts Dir : examples/hooks_pass
Plugin Cache : examples/plugin_cache_pass.json
Policy File : examples/lint_policy.json
Items Audited : Scripts Scanned=1 | Cache Plugins Checked=2
----------------------------------------------------------------------------
RULE COUNTS : JSON_INVALID=0 | UNKNOWN_EVENT=0 | EXIT_CODE_RISK=0 | MATCHER_CASE=0 | PLUGIN_ROOT_PATH=0 | CACHE_DUPLICATE=0
----------------------------------------------------------------------------
[PASS] Hooks and plugin config approved: 0 findings, 0 blocking violations.
============================================================================
# Exit code: 0
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.
Static analysis only, does not execute hooks. Requires Python 3. lint_policy.json must be present for custom severity levels.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed today
- Software
Python