Claude Code Hooks & Automation (29)
A step-by-step walkthrough of replacing a self-hosted n8n webhook with a code route built by Claude Code, and when to keep n8n or Zapier instead.
Walkthrough of fine-tuning the 322M-parameter Laya model behind laya-guard, a hook that screens Claude Code, Cursor and Codex shell commands with rules first and the model for allow, review or block calls, across three training runs.
Using the ccdeck dashboard's hook as the example, lists every way a Claude Code hook can affect the agent (JSON stdout, exit code 2, other non-zero exits, plain stdout on some events) and how to close and test each so a watch-only hook stays read-only.
A week of logging Claude Code and Codex sessions with a plugin that checks each 'tests pass' claim against what the agent actually ran: 948 claims, 315 flagged, and only 3 of 46 hand-checked flags held up.
A team's PreToolUse hook missed an open "$u" loop that sent nine links to the wrong browser profile, and they rewrote it to block unreadable open targets, checked against 59,145 past commands.
A real-project Claude Code setup where CLAUDE.md routes into a wiki, hooks restore rules after compaction, corrections become rules and then tests, and typecheck, tests, e2e, Lighthouse and screenshots gate 'done'.
Builds and tests a 30-line Claude Code mod (v2.1.287+) that refuses Edit and Write calls outside the task's git worktree.
GitGuardian explains using ggshield AI hooks to scan prompts, commands, file reads, MCP calls and outputs for secrets in Claude Code, Cursor and Codex.
An experiment showing a failing check got a Claude Code agent to clear its to-automate list far faster than a warning did.
A headless Claude Code pattern where the agent asks a question in a ticket, exits, and resumes with claude -p --resume once answered.
A test showing a deliberately crashing safety hook did not stop Claude Code from running the command, and what that means for guardrails.
A test showing Read deny rules for secrets and .env still let 4 of 11 access routes through, such as grep -r and Python one-liners.
How the author built a deploy gate so an autonomous Claude Code agent can merge and ship to production safely.
Hooks the author built to stop Claude Code from "fixing" failing tests by editing the expected values.
A guide to Claude Code hooks, hook events and telemetry for controlling what the agent sees and reports.
A verification loop that keeps Claude Code from declaring a task done until security checks (like no hardcoded keys) pass.
A developer explains a Claude Code hook that injects an index of accepted Architecture Decision Records from docs/adr/ into context, and is candid that it only delivers the list rather than guaranteeing the model follows the decisions.
A test of how many ways to git push got past a single Bash(git push:*) deny rule in .claude/settings.json.
A comparison of a CLAUDE.md rule versus a PreToolUse hook for protecting files, including what happens when the user "authorizes" a bypass.
A 60-second test for whether your Claude Code hooks actually fire on Windows, plus common reasons they don't.
Pitfalls found while auto-logging subagent runs with a Stop hook, and how the data cut weekly cost.
How a human-triggered "@claude review" GitHub Actions workflow was locked down to read-only, bounded reviews.
Moving grep-able coding rules from prompts into Claude Code hooks so they are enforced every time.
Graft, a set of Claude Code hooks that cut grep-related token use by about 42%.
A 60-line PreToolUse hook that blocks Claude Code from editing your .env file.
How the author auto-resumes rate-limited Claude Code sessions with a PROGRESS.md file and retries.
Show HN for Kastra, which intercepts tool calls from Claude Code, Cursor, Codex and OpenClaw and checks them against deterministic allow, hold or deny policies before they run, with an audit trail.
Forcing red-green-refactor TDD in Claude Code with hooks and CLAUDE.md rules.
Debugging a Windows Claude Code hook that silently dropped every Korean character.
Want it set up already? Claude Code Power Config Pack
Like these workflows? Here is a tested Claude Code setup you can drop into any repo.
- 8 tested hooks: block
rm -rf /, force-push to main, secrets and lockfile edits; auto-format edited files; notify you when Claude needs input.
- Permission presets for Node/TypeScript, Python, Go, Rust, Rails and monorepos, so it stops asking about every test run.
- Plus: 2 status lines, 6 CLAUDE.md templates, 4 subagents (reviewer, test writer, debugger, security), 3 skills and a one-page troubleshooting checklist.
One install command that backs up your settings first. Checked against the official Claude Code docs. MIT licensed.
Launch price: $6 instead of $12 (code LAUNCH50, first 25 buyers, until Nov 10, 2026).
Get the Config Pack: $6 launch priceOr try 2 of the hooks freeFree on Gumroad: block-dangerous-bash and protect-secrets with a settings snippet. Enter $0; Gumroad asks for an email to deliver the zip.
Prefer to build it yourself? Use the free Claude Code tools, no sign-up.