Skip to the workspace
Pebellslearn by building
Usage Best Practices  ›  Capstone Project

Verify with Tests

Usage Best Practices 15 minA task is done only when a check passes, so you watch a new test fail for the right reason, make it pass without editing it, and then review and run the checks yourself.

claude code / Verify with Tests

Explore each scene at your own pace.

01 · The rule

The rule

Verify with Tests

"Done! The feature works" is a claim. A test run that passes is evidence. Much of this course comes down to one habit: never accept the claim without the evidence.

The rule

Done means a check passed, not that Claude said so.

Tests turn a fuzzy request into a target the agentic loop can hit. A few habits make them work well with an agent:

  • Test first. Ask for a test that captures the requirement, and watch it fail before any feature code exists. A failing test proves it can tell "missing" from "present".
  • Fail for the right reason. The failure should say the behaviour is missing ("expected 6 deliveries, got 7"), not that the test itself is broken by a typo or a bad import.
  • Say how to run the checks. Put the command, such as pytest -q, in CLAUDE.md, so Claude runs it on its own in every session.
  • Forbid the shortcut. "Don't change or skip the tests" closes the easiest way to fake a pass.
  • Run it yourself. ! pytest -q at the end is your independent confirmation.
  • Go beyond unit tests when it matters: a linter, a type checker, or opening the app and trying the feature the way a customer would.
Write a test: pausing tomorrow removes exactly one delivery.
Run it and show me it fails. Don't write the feature yet.
Now implement it in orders.py. Don't change or skip the test.
Run pytest -q until everything passes.

Sending these as two separate messages matters. Ask for the test and the feature together and you never see the red step, so you cannot tell a test that detects the missing behaviour from one that would have passed anyway.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.