Skip to content
Courses/Agents and automation/Hooks: Deterministic Automation

Hooks: Deterministic Automation

A model can forget a rule. A hook cannot. That's why hooks are the right tool for blocking dangerous actions, running checks, and leaving an audit trail.

  • Distinguish soft instructions from mandatory controls.
  • Design hooks for commands, tests, logs, and branch protection.
  • Use hooks without turning every action into a maintenance trap.

When to use hooks

  • Block direct `git push` to `main`.
  • Run lint or tests after editing critical files.
  • Log sensitive commands.
  • Prevent reading `.env` files, keys, or private dumps.
  • Require human approval for deploys, deletions, or migrations.
Terminal
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/deny-dangerous.sh"
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "Edit",
        "hooks": [
          {
            "type": "command",
            "command": "npm run lint"
          }
        ]
      }
    ]
  }
}
Complete Aulafy mapSee how this lesson fits without leaving your path.

Complete Aulafy map

How all courses connect

This is not a checklist. Start with the foundation, choose an outcome, and go deeper only when your project needs more control.

  1. 1Understand
  2. 2Apply or build
  3. 3Operate with confidence
01

Choose an application

Turn the foundation into a visible outcome: a website, a business improvement, media, or an interactive experience.

Continue into the technical branch when you need to maintain code, data, or infrastructure.

02

Build with code

Prepare your environment, work with coding agents, and run models while keeping control of your projects.

This branch prepares you to design and operate reliable AI systems.

03

Take systems to production

Combine retrieval, agents, evaluation, security, deployment, and model adaptation when the problem requires it.

You do not need every course: choose the component your system needs and return as it grows.

View full catalogue