Generate a minimal Claude Code command-hook settings snippet and check its JSON syntax in your browser. Choose one event, an optional matcher, a settings scope, and the command you intend to run. The page does not execute that command or contact a server.
Build a command hook snippet
Enter a command you have already reviewed. Command hooks run with your user permissions; this generator does not make a command safe.
What does this generator check?
It creates one event entry with a command handler, checks that the command is not blank, and parses the generated text as JSON. For SessionStart, it also checks common documented matcher values. For tool-event matchers, it checks regular-expression syntax when the matcher uses regex characters. A valid JSON snippet does not prove that a command exists, is safe, matches the situation you intend, or runs in your installed Claude Code version.
The output contains only a hooks property. If your selected settings file already contains permissions, model settings, or other keys, merge this property into the existing JSON instead of replacing the whole file. Confirm the active configuration in Claude Code and test a harmless action before relying on the hook.
How should I choose a hook event?
PreToolUseruns before a matching tool call; use it only when your reviewed command needs to inspect that call.PostToolUseruns after a matching tool call; a narrow matcher such asEdit|Writecan target file edits.SessionStartruns when a session starts or resumes. Anthropic recommends keeping these hooks fast.Stopruns at turn completion and has no matcher field in this generator.
These are documented event descriptions, not an endorsement of running any particular command. Review the script and its side effects yourself. Hook commands can access files and tools available to your user account.
Why is this tool useful?
Anthropic documents hooks as nested JSON settings: an event contains matcher groups, and each matcher group contains handlers. A Claude Code issue reports a settings file containing JSON-valid hooks that did not appear in /hooks; a separate 2026 issue reports a reproduced invalid matcher causing the settings file's hooks to be ignored in the affected versions. These individual reports illustrate why configuration shape and runtime checks matter. They do not establish how often users encounter the problem or describe every current version.
Frequently asked questions
Does this generator run or upload my hook command?
No. It generates text locally in your browser and makes no network request. It does not execute the command.
Can valid JSON guarantee the hook will fire?
No. JSON parsing does not validate every Claude Code schema rule, settings precedence, command availability, permissions, or event behavior. Review the official documentation, inspect the active hooks in Claude Code, and test a harmless action.
Which settings file should I use?
Use local project settings for an unshared project-only trial, project settings for configuration intended to be shared with a repository, or user settings for your own configuration across projects. Organizational managed settings and precedence may affect behavior; consult Anthropic's settings documentation.
Are hooks a safe way to enforce policy?
This generator is not a security audit or policy-control system. Anthropic warns that command hooks run with your full user permissions. Review and test every command, keep it narrowly scoped, and do not rely on an unverified hook as your only safeguard.
What evidence supports this tool?
Anthropic's current hooks documentation describes the JSON structure, events, matchers, and command-hook security boundary. Public GitHub issues provide qualitative examples of setup and configuration questions; they are not a representative survey, bug-rate estimate, or evidence that a reported issue affects all current versions.
Sources · checked November 3, 2026
- Anthropic Claude Code Docs: Hooks reference · event configuration, matchers, and security
- Anthropic Claude Code Docs: Settings files and precedence
- Claude Code issue #11544 · report of JSON-valid hooks not loading · observed Nov 2025
- Claude Code issue #75081 · invalid matcher report and maintainer reproduction · opened Jul 7, 2026
Related: Claude Code permission settings, Claude Code MCP proxy troubleshooting, and Claude Code profile.
Methodology and limitations
The browser-only generator writes one documented command-hook event structure, parses its JSON, and applies a limited check to selected matcher values. It does not run commands, verify all Claude Code schema rules, or confirm a hook works in an installed version. Anthropic documentation was checked November 3, 2026. Public GitHub issues are qualitative examples of configuration questions, not prevalence evidence.
Affiliate placeholder {{AFF_TOOLNAME}} — referral link not configured.