Exit code

A number that a script returns at the end to say how it went: 0 means “everything is fine”, 2 means (in hooks) “stop the action”.

You’ll also find it as: exit codes, exit 2

How it appears in the course

The script answers with a number (the exit code): 0 means “everything is fine”, 2 means “stop”.

Introduction · Module 07, Hooks: automatic actions

A number. Every program returns a number when it finishes: the exit code.

What does a hook receive, and what does it answer? · Module 07, Hooks: automatic actions

If the file name contains one of them, it writes the reason on stderr (>&2) and exits with exit 2 (stop). Otherwise, exit 0.

Ready-to-use recipes · Module 07, Hooks: automatic actions

Where you learn it

In module 07 · Hooks: automatic actions, in the Claude Code for Beginners course.

Related terms

Learn Claude Code from zero, in plain English

12 modules with 1–2 minute lessons, which you can also do on your phone. The first two modules are free.