Go from never having used a coding agent to working productively and safely with one. The learner should understand what an agent is and how it differs from a chat assistant. They should choose a tool, set up a protected first project, describe tasks the agent can do well, and follow and verify its work. They should recover from bad changes, manage context, and plan bigger changes. They should also use tests as the definition of done and run everyday workflows (bug fixes, features, writing tests, codebase exploration, scripts, small tools, refactors). Throughout, they should keep secrets and systems safe and keep their own understanding growing instead of outsourcing it.
Tests as the definition of done
card 5 of 6
The hand-off and the proof
builds on: Describing a task: goal, context, constraints, check, Spotting tests bent to pass, Verifying before you accept a change
The test is committed. Read the block from (1) to (5):
(1) Your hand-off: a fixed finish line and one rule.
(2) The agent's first run fails with 20.0 instead of 18.0. The bug is real and the test catches it.
(3) "All 24 tests pass" is only a claim so far.
(4) Only `src/cart.py` is listed, so the committed test is untouched.
(5) Your own run: 24 passed, exit code 0. That is your proof.
(1)
▸ You: Make test_ten_percent_code pass.
Fix src/cart.py; don't edit tests/.
Done means `pytest` exits 0.
(2)
⚙ Run: pytest tests/test_cart.py
FAILED test_ten_percent_code
assert 20.0 == 18.0
⚙ Edit: src/cart.py
⚙ Run: pytest
(3)
◂ Agent: All 24 tests pass. Only
src/cart.py changed.
(4)
$ git diff --stat HEAD
src/cart.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(5)
$ pytest
24 passed in 0.31s
$ echo $?
0
Terms on this card
- test
- A small piece of code that runs part of your program with a known input and checks that the result is what you expect.
- exit code
- A number a command returns when it finishes: 0 means success, anything else means failure.
- tests
- Small pieces of code that run your program's code and check it gives the expected results.
- agent
- An AI tool that doesn't just chat. It reads your project's files, edits them and runs commands to carry out a task you give it.
- src
- Short for "source": a common folder name for a project's main code files.
Lesson goal: Turn 'done' into a command that passes, for example by having a failing test written first and then making it pass without editing it. Explain why this gives the agent a goal it can check itself and gives you evidence. ·
the whole lesson