What hooks are
Hooks are scripts that intercept Claude's actions. Pre-hooks run before an action executes and can block it. Post-hooks run after and can validate, flag, or log the result.
The hooks you'll install in Module 3 — the AP Style check, source attribution check, and AI slop detector — are all post-hooks. They run after Claude writes something and flag problems before you move the work forward.
The limits of prompts
You can tell Claude "don't write unattributed statistics" in your CLAUDE.md, and it will usually comply. Usually. Prompts are instructions. Claude follows them well, but they're subject to context length, session drift, and the inherent unpredictability of a probabilistic model.
A hook that scans every piece of Claude-generated text for unattributed statistics is more reliable: it's code. It runs the same way every time, regardless of what else is in the context. The hook doesn't drift.
A journalism scenario
Say you're running a pipeline that processes 200 press releases and extracts quotes. You could prompt Claude to "always flag quotes that seem to be paraphrases rather than direct quotes."
Or you could write a post-hook that scans output for quote marks and checks whether each attributed statement appears verbatim in the source document. The hook catches what the prompt misses — including the cases where Claude, deep in a long context, stops applying the instruction consistently.
Hooks work best for fixed rules
Hooks are well-suited to things that should never happen: publishing without attribution, writing about named individuals without checking their title against your source sheet, generating output that contains your publication's banned words.
The journalism skills library includes 13 hooks covering the most common of these. Understanding what hooks are — and what they're doing — helps you evaluate them critically and, eventually, write your own for newsroom-specific rules that no general library will cover.
SOURCE: These patterns are drawn from the "Hooks for deterministic safety" lesson in jamditis/stash, which extracts and organizes techniques from The Agentic Lab's advanced Claude Code guide.
NEXT: Head to Module 3 to install the journalism skills library and see hooks in action.