thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

AI & Machine Learning · Advanced

Hooks

User-defined commands that run automatically at points in an agent's lifecycle, such as before or after a tool call.

Definition

In Claude Code, hooks enforce deterministic behavior, for example running a formatter after each edit or blocking writes to protected files, rather than relying on the model to remember instructions.

Exam tip

Use hooks when an action must always happen; instructions alone are not guaranteed.

Related terms