agent-audit
Audit agents spawned in the current/last run against the agent-selection taxonomy
Validate ~/.claude/settings.json hooks block — event names, file existence, executability, matcher syntax; --fix repairs common issues
> /plugin marketplace add heymegabyte/claude-skillsHow it fires
How this command gets triggered: by you, by Claude, or both.
/audit-hook-wiringContext preview
What this command does when you run it.
Validate ~/.claude/settings.json hooks block — event names, file existence, executability, matcher syntax; --fix repairs common issues
description: Validate ~/.claude/settings.json hooks block — event names, file existence, executability, matcher syntax; --fix repairs common issues argument-hint: [--fix] allowed-tools: Bash, Read, Edit
<!-- <SUBAGENT-STOP>: skip this skill when running inside a subagent. Meta-skills must not leak into spawned subagent contexts. --> <SUBAGENT-STOP/>
Audit every hook entry in `~/.claude/settings.json` against the Claude Code spec. A misconfigured hook silently no-ops — bad event names, non-executable scripts, and malformed matchers all fail without feedback.
**Purpose** — catch wiring bugs before they silently swallow hooks.
**When to use** — after editing `settings.json`; after creating a new hook script; when a hook seems to not fire; on demand.
**Inputs** — `$ARGUMENTS`: pass `--fix` to attempt automated repairs (chmod +x, event rename suggestions). Without `--fix`, the audit is read-only.
---
Read `~/.claude/settings.json`. Extract the `hooks` object.
Valid Claude Code hook event names (exact set — anything outside this list is invalid):
SessionStart UserPromptSubmit Stop PreToolUse PostToolUse Notification
Common invalid names seen in the wild (rename → correct):
Build the entry list: for each event key in `hooks`, for each entry object in its array, collect:
---
For every inner hook command:
**A. Event name check**
**B. File extraction**
**C. File existence check**
test -f <expanded-path> && echo EXISTS || echo MISSING
**D. Executability check** (for direct-exec and interpreter-invoked scripts alike)
test -x <expanded-path> && echo EXECUTABLE || echo NOT_EXECUTABLE
Note: interpreter-invoked scripts (`python3 foo.py`) don't NEED the executable bit, but it's still best practice. Flag `NOT_EXECUTABLE` as a WARNING (not FAIL) for interpreter-invoked scripts; flag as FAIL for direct-exec scripts.
**E. Matcher syntax check** (PreToolUse and PostToolUse entries only)
Valid matcher forms per Claude Code spec:
Flag as FAIL if:
---
Hook Wiring Audit — ~/.claude/settings.json
════════════════════════════════════════════
SUMMARY
Total hook entries: 14
PASS: 11
WARN: 1
FAIL: 2
SessionStart
✓ session-start-reminders.py EXISTS EXECUTABLE (no matcher)
✓ session-start-router.py EXISTS EXECUTABLE (no matcher)
UserPromptSubmit
✓ sync-desktop-skills.py EXISTS EXECUTABLE (no matcher)
✓ userpromptsubmit-router.py EXISTS EXECUTABLE (no matcher)
Stop
✓ sync-desktop-skills.py EXISTS EXECUTABLE (no matcher)
✓ stop-skill-tracker.py EXISTS EXECUTABLE (no matcher)
PreToolUse
✓ pretooluse-router.py EXISTS EXECUTABLE matcher: "Bash|WebFetch|WebSearch|mcp__.*" ✓
✗ on-write-guard.py MISSING matcher: "Write|Edit"
→ Fix: create file or remove this entry
~ skill-security-auditor.py EXISTS NOT_EXEC matcher: "Write|Edit|MultiEdit" ✓
→ WARN: chmod +x ~/.claude/hooks/skill-security-auditor.py
PostToolUse
✓ enforce-tdd-e2e.py EXISTS EXECUTABLE matcher: "Write|Edit|MultiEdit" ✓
INVALID EVENTS (rename required)
✗ "PreCommit" is not a valid Claude Code hook event
→ Not a Claude event — use lefthook for git hooks. Remove or migrate.
ACTIONABLE FIXES
[FAIL] PreToolUse › on-write-guard.py — file does not exist
→ Delete the entry from settings.json, or create the missing script
[FAIL] hooks["PreCommit"] — invalid event name
→ Remove this block; wire git pre-commit in lefthook.yml instead
[WARN] PreToolUse › skill-security-auditor.py — not executable
→ Run: chmod +x ~/.claude/hooks/skill-security-auditor.py---
For each WARN (not executable, interpreter-invoked):
chmod +x <path> echo " → chmod +x applied: <path>"
For each FAIL (invalid event name): print the exact JSON path + suggested action but DO NOT auto-edit — event renames require human judgment. Print:
→ Manual fix needed: remove or rename hooks["<BadEvent>"] in ~/.claude/settings.json → See: rules/bash-matcher-guardrails.md for valid event set
For each FAIL (missing file): print:
→ Script not found: <path> → Either create the file or remove this hook entry
After applying any chmod fixes, re-run existence + executability checks to confirm green:
test -x <path> && echo " ✓ confirmed executable
14-category autonomous product-building OS for 32+ AI coding tools. One-line prompts → deployed products.
Repo: heymegabyte/claude-skills
Audit agents spawned in the current/last run against the agent-selection taxonomy
Run the Agent Diversity Review gate and emit the result table
Meta-analyze the effectiveness of a /loop arc — per-iteration metrics, LOC delta trend, saturation detection, and a keep/lengthen/delete recommendation.
Audit the rules/ directory for missing foundational principles; output gap list with priority and justification
Catch Resend-class bug (isError: false on HTTP 4xx/5xx) across all MCP server tool handlers
Healthcheck + drift detect + rotation-reminder across all MCP servers in ~/.claude/mcp-registry.json