AI Coding Agent Hooks

A hook is a shell script your AI coding agent runs automatically at a defined event — before a tool call, after a file edit, before a shell command executes. Used well, hooks enforce the policy you can't rely on a prompt alone to guarantee: block a secret before it's committed, log every tool call for an audit trail, or require a second check before a production command runs. Every hook below is real, copy-paste code — not a concept.

100 hooks · Written for Claude Code's documented hook contract
New to agent hooks? Read the security risks first →

8 results Clear filters →

🕵️ Data Privacy & PII

8 hooks

Catch customer PII before it leaves the machine, gets logged in the clear, or ends up re-identified across two datasets that were never supposed to be joined.

Block Re-Identification Joins Across Two Anonymized Datasets
Security
Flags a command that references two different anonymized dataset files in the same session.
PreToolUse · Claude Code
Mask PII in MCP Arguments Instead of Blocking the Call
Security
Replaces SSN- and account-number-shaped values in an outbound MCP call's arguments rather than denying it out…
PreToolUse · Claude Code
Redact PII From Audit Logs
Security
Masks SSN- and account-number-shaped strings before they're written to any local log file.
PostToolUse · Claude Code
Block Copying PII Columns to a Non-Encrypted Destination
Security
Blocks a cp/export command referencing a known PII table name unless the destination path is under an encrypt…
PreToolUse · Claude Code
Block Reads of Customer Data Exports Outside Working Hours
Security
Only allows reading a customer data export path during a configured working-hours window.
PreToolUse · Claude Code
Block Writing Raw Account Numbers to a Shared Scratch Path
Security
Blocks a Write whose content contains an account-number-shaped string unless the target is a private scratchp…
PreToolUse · Claude Code
Log Every PII-Pattern Match for a DSAR Register
Security
A separate, dedicated log of PII-pattern matches, built to feed a Data Subject Access Request register.
PostToolUse · Claude Code
Require a PII-Reviewed Session Tag Before Reading a Tagged Path
Security
Blocks reading any path with ssn or dob in the name unless the session is explicitly tagged as PII-reviewed.
PreToolUse · Claude Code
Need a hook that isn’t here?

Tell us what you want enforced automatically and we’ll build it — free and public.

Request a hook →
FEEDBACK