
This course contains the use of artificial intelligence.
Claude Code runs shell commands, reads files and edits code on your machine. Most days that's the point. But the same session that fixes a bug can also run rm -rf on the wrong folder, open a .env file and send your keys to the model, or push a change nobody has read. This course builds the hooks that catch those moments before the tool runs, and the tests that prove each hook works.
You write six hooks in plain Python, one lecture at a time, and test each one by hand and with pytest. Every demo runs the starter repo in a throwaway project. The live sessions are real Claude Code runs, so you see what the model actually does after a block.
What you get
16 video lectures: a welcome plus 5 modules, 100 minutes in total
The starter repo (zip, attached to the first lecture): Python 3.9+ with no third-party packages, six hooks, settings files for Windows and macOS/Linux, and 186 pytest cases
A guardrail checklist in the last lecture, in the order to install things
The modules
How hooks work. The five ways an agent hurts you, the hook events and the JSON payload, exit codes, and when to use a permission rule instead of a hook.
Block destructive commands. Your first PreToolUse hook, a deny list for the shell with 14 rules, and a guard for folders Claude must not write to.
Keep secrets secret. A guard for .env files, environment dumps and real key formats, plus redaction so secrets stay out of your own logs.
Audit and review. A log of every tool call, a review gate that blocks git push until you sign off on that exact commit, and a stop gate that won't let Claude say "done" before the tests have run.
Ship it and keep it working. Per-repo and global install, testing hooks with pytest, failure drills where you break things on purpose, and the checklist.
What it doesn't do
It doesn't teach Claude Code from zero. You should already have used it.
Hooks read command text. They catch honest mistakes, like an eager push at the end of a task. They aren't a wall against someone set on getting around them. Each lecture shows its own gaps, and the course pairs hooks with permission rules, branch protection and short-lived keys.
Tested on Windows 11 with Python 3.14. The macOS and Linux settings files are included but haven't been tested on those systems.
How it was made
Written with AI help (Claude) and reviewed by AmagiLabs before release. Narrated by Ricardo, using an AI voice model of his own voice. AmagiLabs isn't affiliated with Anthropic. Claude and Claude Code are Anthropic's names, used here only to say what the course works with.