Skip to content

08: Hooks, Automation & What's Next

35 minutes | You need: everything from modules 1-7

Hooks are deterministic scripts that fire at lifecycle events. Unlike skills (AI-decided instructions), hooks always run when their trigger condition is met. They’re your quality gates — the things that must happen regardless of what Claude decides.

Configure via /hooks or add directly to your settings:

{
"hooks": {
"PostToolUse": [{
"matcher": "Write",
"hooks": [{ "type": "command", "command": "npm run lint --fix" }]
}]
}
}

Make an edit and watch the linter fire automatically after every file write. Claude sees the linter output and adjusts if there are issues.

Run tests before any git commit:

{
"hooks": {
"PreToolUse": [{
"matcher": "Bash(git commit*)",
"hooks": [{ "type": "command", "command": "npm test" }]
}]
}
}

Try committing — tests run first. If they fail, the commit is blocked and Claude sees why.

Hooks aren’t limited to shell scripts:

HTTP hooks — call a webhook when something happens:

{
"hooks": {
"Stop": [{
"hooks": [{ "type": "http", "url": "https://your-slack-webhook.com/...", "method": "POST" }]
}]
}
}

MCP tool hooks — trigger an MCP tool as a hook action.

Common hook events (Claude Code has 20+ events total — see the docs for the full list):

EventWhenBest for
PreToolUseBefore a tool executesBlock dangerous ops, validate inputs, run tests before commits
PostToolUseAfter a tool completesAuto-lint, auto-format, post-edit validation
PostToolUseFailureAfter a tool failsError logging, rollback logic
StopSession endsCleanup, notifications, summary logging
SessionStartSession beginsLoad project setup, check environment
UserPromptSubmitWhen user submits a promptLogging, audit trails

4. End-to-end: everything together (15 min)

Section titled “4. End-to-end: everything together (15 min)”

Pick a real task from your backlog and run the full workflow. This time you’re not learning — you’re working:

1. Spec itShift+Tab into Plan Mode. Write a clear spec with requirements and acceptance criteria (Module 3).

2. Research — Ask Claude to delegate the investigation:

Use a subagent to explore how [relevant module] currently works, what patterns it uses, and what I need to be careful about when making changes.

Your context stays clean (Module 4).

3. Execute — Exit Plan Mode. Let Claude implement with your CLAUDE.md guiding conventions (Module 2). Hooks auto-lint on every write.

4. Review with a skill — Run /simplify or your custom review skill (Module 6). It runs in a subagent — your context stays clean.

5. Ship — Claude creates the PR via GitHub MCP or gh CLI (Module 7). Tests run before commit (your safety hook).

6. Read the diff — Before merging, review what changed and why.

Notice what just happened: you specified the what, Claude handled the how, hooks enforced quality, skills provided reusable workflows, subagents kept your context lean, and MCP connected to your external tools. This is the stack:

CLAUDE.md → persistent conventions (loaded every request)
Skills → reusable workflows (loaded on demand)
Subagents → isolated workers (separate context windows)
Hooks → deterministic gates (always fire)
MCP → external tools (GitHub, databases, monitoring)

This bootcamp covered the core workflow. Here’s what’s waiting when you need it:

Orchestrate multiple Claude instances working on the same codebase — one on frontend, one on backend, one on tests, coordinating through shared tasks and inter-agent messaging.

Run prompts on a recurring schedule. /loop 5m "check the deploy status" polls every 5 minutes. /schedule creates cloud-based cron jobs that run without your terminal open.

Run Claude in your CI pipeline: claude -p "Review this PR for security issues". No interactive terminal needed. Works in GitHub Actions, GitLab CI, and any pipeline that can run a command.

Push events into a running Claude session from external systems — CI results, monitoring alerts, chat messages. Claude reacts while you’re away.

Claude can control your screen (macOS), open apps, click buttons, fill forms. The Chrome integration lets Claude test web apps, debug UI issues, and extract data from web pages.

Package skills, agents, hooks, and MCP servers into distributable plugins. Create and share plugin marketplaces within your organization.

Two working hooks (auto-lint + pre-commit tests). A completed end-to-end workflow on a real task using the full stack.

Playbook M07 — Advanced Workflows for the full hook lifecycle, plugins, and agent teams. Playbook M08 — Security for security-reviewer subagents and prompt injection defense. Playbook M12 — CI/CD for headless mode and pipeline integration.

Modules 1-8 are complete. You have: a CLAUDE.md, Plan Mode + thinking controls, context management habits, daily workflow patterns, a custom skill, MCP connections, and automated quality hooks. Modules 9-12 cover research patterns, verification, multi-agent orchestration, and adversarial review — don’t skip them. For the full picture — theory, security, team adoption, CI/CD — see the AI-Augmented Development Playbook.