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.
Workflow: having the agent write tests card 2 of 6

Tests copied from the code copy its bugs

builds on: Spotting tests bent to pass, Verifying before you accept a change
To write tests, the agent reads the function and describes it. If the code returns a negative price for a 200% discount, a test written from the code may expect that negative price. Expected values also often get computed with the code's own formula, so the test can never disagree with it. Useful tests come from **intent**: what *should* happen. You hold that knowledge, so give it to the agent.
Terms on this card
test
A small piece of code that calls your code with chosen inputs and checks the result matches what you expect.
expected values
The results a test says the code must return. Work them out by hand, not with the code's own formula.
function
A named, reusable block of code, like `get_data`, that other parts of the program call.
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.
Learn this step by step on Bytewise
Lesson goal: Get useful tests for existing code by asking for behaviour-focused cases, edge cases and failure cases. Check that each test would fail if the code were broken, and decide what to do when a test exposes a real bug. · the whole lesson