Yauhen Massalski All lessons

Learn the /goal command

Give Claude a finish line it can check

Claude can work for hours without you. It only needs a clear finish line. In 15 minutes, you learn to write one.

Claude Code
The Claude app that works on the files on your computer.
/goal
A command you type in Claude Code. It tells Claude when the job is done.
Turn
One round of work. Claude does something, then reports back.

01 · The problem

Friday night, 120 photos

You have a folder with 120 product photos. Each photo needs one short line that says what is in it.

You want Claude to write all 120. You do not want to sit there and type "continue" every few minutes.

So you type this and go to bed:

/goal make the descriptions good

What happens next? Make your guess below.

A made-up case. No real store is touched.

02 · Your guess

Guess before you read on

A wrong guess costs nothing. Guessing first helps you remember the answer. Pick one to open the next part of the lesson.

03 · How it works

Two players: Claude and the referee

Here is what happens after you type /goal. Press Next step to see each part. The three endings light up after step 3.

1You set the finish line
2Claude works one turn
3The referee reads the chat
Not done: next turn
Done: goal ends
Not possible: goal ends, "failed"

What the referee sees

Same job. Same Claude. Only the last message is different. Click both tabs.

04 · Remember

The referee only sees the scoreboard.

The chat is the scoreboard. The referee reads it after every turn. It cannot open a file. It cannot run a test.

So your goal must make Claude put the proof in the chat. A number. A list. A test result.

Goal asked for120
Shown in chat120
RefereeMet

On the court

A referee calls what they see. "The ball went in" is a call he can make. "They played hard" is not.

Food delivery

Order "something tasty" and you cannot complain. Order "2 pizzas, no onions, by 8 pm" and you check each part at the door.

At the gym

"Get fit" never ends. "Run 5 km in under 30 minutes, show me the watch" ends the day you do it.

A good goal has 3 parts

  1. A number. How many, or what result. "120 descriptions." Or "exit code 0", the computer's signal for "no errors".
  2. Proof in the chat. Tell Claude what to show. "Show the file list." "Print the count."
  3. A cap. A limit on turns, like "or stop after 20 turns". It works like an oven timer. You forget the cake, and it still does not burn.

Why does the referee only read?

The referee is a small, fast AI. It runs after every turn, so it must be cheap and quick. Reading the chat is the cheapest check. Source: the official /goal page.

05 · Two checks

Pass two checks to finish

A miss is fine. Each miss gives you a new case.

Check 1 of 2 · Pick the goal the referee can judge

06 · Try it

Next time you say "do all of them"

Start with /goal, a number and a cap.

Try it for real · 2 minutes · safe

Make a new, empty folder first. Do not use a real project. Open Claude Code in that folder and type:

/goal create 5 files named note-1.txt to note-5.txt in this folder and show ls output proving 5 exist, or stop after 5 turns

ls is a command that lists the files in a folder.

/goalShows how the goal is going: the finish line, time, turns, and the last reason.
/goal clearStops the goal at any time.

Check: did the file list show up in the chat? That list is the scoreboard the referee read.

Stuck? Ask Claude. Say "explain /goal like I am new", or paste what you see.

Read the source once. It is short: code.claude.com/docs/en/goal.

Get this skill

loop-spec: My own skill. It helps you write a clear finish line before a long job. Free.

Get this skill
Back to all lessons