Hookfuzz — Testing skill for Claude Code
Test harness, spec runner and fuzzer for Claude Code hooks (any language).
How to install Hookfuzz
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open acus9345/hookfuzz and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Hookfuzz does
Test harness, spec runner and fuzzer for Claude Code hooks (any language). Build realistic payloads, assert decisions, fuzz edge cases, scan settings.
Alternatives in Testing
- Test Runner — Run Python tests with pytest, unittest, or other testing frameworks 23.4k ★
- OpenAgentsControl — AI agent framework for plan-first development workflows with approval-based execution 4.8k ★
- Maestro Spec — Intent-driven spec precipitation — state a constraint in natural language (加一条规范:禁止用 any / 记录架构约束:服务间走 gRPC / 530 ★
README
hookfuzz
**Test harness, spec runner and fuzzer for [Claude Code hooks](https://docs.claude.com/en/docs/claude-code/hooks)** — in any language.
Claude Code hooks are scripts that receive a JSON payload on stdin and answer with an exit code (`0` ok, `2` block with stderr fed back) and optional JSON on stdout. They are easy to get subtly wrong: a typo in `hookEventName`, a crash on an unexpected payload, a hook that hangs, a path in `settings.json` that doesn't exist (so your "policy" hook silently never runs). `hookfuzz` catches all of these before a real session does.
npm i -D hookfuzz # binary: hookfuzz
Node 20+, Linux / macOS / Windows, one runtime dependency (`yaml`).
Commands
`hookfuzz run` — fire one realistic event at a hook
$ hookfuzz run PreToolUse --tool Bash --input '{"command":"rm -rf /"}' -- bash hooks/block-rm.sh
event PreToolUse
exit 2
decision block (blocks) - Blocked: rm -rf is not allowed by policy
time 6.9 ms
stdout empty
stderr
│ Blocked: rm -rf is not allowed by policy
$ hookfuzz run PreToolUse --tool Write --input '{"file_path":"a/.env"}' -- "node hooks/guard.mjs"
event PreToolUse
exit 0
decision deny (blocks) - Writing .env files is not allowed
time 31.2 ms
stdout valid JSON
│ {"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny",...}}
--tool,--input JSON|@file— tool name andtool_input(or event fields likeprompt).--payload JSON|@file— deep-merge overrides into the payload (nulldeletes a key).--timeout ms(default 60000; must be a positive integer),--jsonfor machine-readable output.--shellruns a multi-argument hook command through the shell anyway (sh -c/cmd.exe); arguments are quoted, and on Windows cmd metacharacters such as%VAR%,%VAR:a=b%and%VAR:~0,5%are caret-escaped so they stay literal. A first word that cmd resolves to a.cmd/.batshim throughPATHEXT(e.g.npx
Related Skills
Hook Gym
Test harness for Claude Code hooks — batch-run violation cases against your guardrails
QA Integration
Run integration/E2E QA against a RUNNING app via a real browser — execute new + regression test cases, assert
Claude Code Test Runner
An automated E2E natural language test runner built on Claude Code.
Test Matrix Planning
Turn a growing harness surface into a realistic verification matrix instead of a few lucky spot checks.
QA Testing Rules
Language-agnostic QA testing rules for AI coding agents — pre-write category enumeration, structured docstring
Cfn Spec
SPARC Specification phase. Make testable acceptance criteria, edge cases, pre/post conditions, invariants BEFO
Related Agents
Ct Harness Engineer
Designs and audits Claude Code harness infrastructure — hooks, rules, settings, constraint promotion, maturity
Claude Harness Engineer
Changes Claude Code harness configuration — settings.json, statusline.sh, CLAUDE.md global rules, hooks, rules
Fuzzer
Generates property-based tests that find edge cases humans miss. Use for pure functions, parsers, serializers,