Skip to main content

claude-hooks-check

CI PyPI Python License: MIT

A small Python linter for Claude Code hooks configuration — the hooks block inside your settings.json, or a standalone hooks JSON.

It catches the common foot-guns before you hand a command to Claude that it will silently run on your machine:

  • unknown event names (typos like PreToolYse, SessionStrat)
  • malformed matcher blocks (missing hooks array, wrong shape)
  • hook entries missing type or with an unknown type
  • command hooks with empty / non-string command
  • dangerous command patterns: rm -rf /, curl | sh, sudo ..., dd if=... of=/dev/..., fork bombs
  • hardcoded secrets in command strings (Anthropic, OpenAI, AWS, GitHub, Stripe, Google)
  • invalid or suspiciously-high timeout values

Accepts both shapes:

  • a full Claude Code settings.json — the linter reads its hooks key
  • a bare hooks JSON — e.g. { "PreToolUse": [...] }

Install

pip install claude-hooks-check

Usage

claude-hooks-check ~/.claude/settings.json
claude-hooks-check .claude/settings.json

Exit status: 0 on no errors, 1 on any errors.

Library API

from claude_hooks_check import validate_hooks_file

result = validate_hooks_file(".claude/settings.json")
for issue in result.errors:
    print(issue.code, issue.event, issue.matcher, issue.message)

Issue codes

Code Severity Meaning
E000 error file-level problem (missing, empty, not JSON, not an object)
E010 error hooks is not an object
E021 error event value is not an array
E050 error matcher block is not an object
E051 error matcher is not a string
E052 error matcher block missing hooks array
E053 error hooks is not an array
E101 error hook entry is not an object
E102 error hook entry missing type
E103 error unknown hook type
E104 error command hook has empty / non-string command
E105 error timeout is not a positive integer
E200 error dangerous command pattern detected
E201 error hardcoded secret in command
W001 warning no hooks and no recognized event at root
W011 warning hooks object is empty
W020 warning unknown event name
W022 warning event has no matcher blocks
W054 warning matcher block has empty hooks array
W105 warning timeout over one hour

License

MIT

Metadata

Release files for claude-hooks-check 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for claude-hooks-check 0.1.0
File Size Uploaded Provenance
claude_hooks_check-0.1.0.tar.gz 7.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for claude-hooks-check 0.1.0
File Interpreter ABI Platform
claude_hooks_check-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.5 kB

Release files / claude_hooks_check-0.1.0.tar.gz

Download URL claude_hooks_check-0.1.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
980851b8ebc7d9539239a1d61ea3c3a31cd065090eeca81409c61b67ade7a467
BLAKE2b-256 checksum
How to use checksums
1c830a49d745d890795ecfbd5c84e956a59515cf1a90365afc6edcaa44bf1e2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / claude_hooks_check-0.1.0-py3-none-any.whl

Download URL claude_hooks_check-0.1.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
acd34ede509713057ce011354d6537cc1c9d6932152daa66b0793ffa2ff0eb9d
BLAKE2b-256 checksum
How to use checksums
6f51abcf2cf6f60a5fe44c1904dc6a70731323b42dbbee82754d8594457257f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for claude-hooks-check 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page