Claude Code Setup Playbook — 8 · Task Files
CP — 09

Step 8. Add task files and a finish gate

Builds on all of the above. This is the most expensive step to keep running. Many teams should stop at step 7.

Read time2 min
SectionClaude Code Setup Playbook
01 — 8 · task files

What to do

Why: for large changes, a task file records the plan and the proof. A Stop hook can then refuse to let the agent say "done" until the proof is there.

Do this:

  1. Define a task template with fixed sections: Objective, Scope, Plan, Validation, Result.
  2. Keep session task files out of git (.claude/tasks/ in .gitignore). If you need a durable backlog, give it a separate folder that is committed.
  3. Decide what counts as evidence for "done": passing tests, a type check, a screenshot.
  4. Write a Stop hook that checks the task file for that evidence.
02 — 8 · task files

Example

Example. The template:

markdown
# Task: <name>

## Objective
<one sentence>

## Scope
In: <files or areas>
Out: <what you won't touch>

## Plan
1. ...

## Validation
- [ ] `npm run typecheck` passes
- [ ] `npm test -- <file>` passes
- [ ] Manual check: <what you looked at>

## Result
<what changed, what you saw>

And a Stop hook that blocks while the Validation section still has unchecked boxes:

js
const fs = require("fs");
const file = process.env.TASK_FILE; // set by your workflow or a UserPromptSubmit hook
if (file && fs.existsSync(file)) {
  const unchecked = fs.readFileSync(file, "utf8").match(/- \[ \]/g);
  if (unchecked) {
    console.error(`Task has ${unchecked.length} unchecked validation item(s).`);
    process.exit(2); // blocks stopping; agent keeps working
  }
}
03 — 8 · task files

Check it works

Check: start a task, leave one box unchecked and tell Claude to finish. It should be sent back to the work. Check the box and it should be allowed to stop.

Watch out:

  • A gate that works in one tool and not another gives false confidence. Say which tools enforce it.
  • Don't build a custom command language, a multi-agent manager or worktree automation until the single-agent flow is stable.
  • A task file is a checkpoint, not product truth. Keep real requirements in your product docs and update those first.