"Add search" and twenty minutes later…
Your small notes tool needs a search command. You type:
▸ You: add search to the notes app
The agent works, then reports:
◂ Agent: Search added and tested. All tests pass.
Does `search MILK` find "milk"? What happens when nothing matches, or when no word is given? You can't tell. You never said what you wanted, so "tested" only means it matches the agent's own guesses.
A feature doesn't exist yet to be read
A new feature is behaviour that isn't in the code yet. The agent can't read it from anywhere, so it fills every gap in your request with a plausible guess. Examples with exact inputs and outputs remove those guesses. **Edge cases** (empty input, no match, odd capital letters) are where guesses differ most. Each example also turns straight into a test, so "done" becomes a command that passes.
The feature workflow, start to finish
1. **Checkpoint:** commit any outstanding work so `git status` is clean. That commit is your start commit.
2. **Specify:** state the goal, give input → output examples including edge cases, and say what must not change.
3. **Plan:** ask for a plan with no edits. Edit it and save it to a file.
4. **Tests first:** turn your examples into tests and watch them fail.
5. **Build in steps:** after each step, run the tests, review that step's diff and commit. More tests pass each time, and all pass at the end.
6. **Try it yourself.**
7. **Review the whole diff** since the start commit.
Search, walked through
You commit first. That commit is your `<start-commit>`. Then you send the spec below. The plan comes back with 3 steps, and you save it to `PLAN.md`. Step 1 writes tests from your examples, and they fail, as they should. Step 2 adds case-insensitive matching, and those tests pass. Step 3 handles no match and no word, and now all of `pytest` passes. You commit after each step. Then you run `python notes.py search MILK` and a no-match search yourself. Finally, `git diff <start-commit>` shows the whole feature. You spot a changed `list` format you never asked for. You ask the agent to put it back, re-run `pytest` and commit.
The request that started it
Each example line becomes one test. The edge cases settle exactly where the agent would otherwise guess. The last lines ask for a plan first, tests before code, and a check the agent can run itself.
▸ You: Add a search command to notes.py.
Behaviour (each line = one test):
- search milk -> notes containing
"milk", newest first
- search MILK -> same (ignore case)
- no match -> print "No notes found",
exit code 0
- search, no word -> print usage,
exit code 1
Don't change other commands.
Plan first, no edits. Then write tests
from these examples, show they fail, and
implement one plan step at a time.
Check: pytest passes.
Remember
Put your effort up front into examples and edge cases. They become the plan, the tests and your own checklist. A feature is done when those tests pass, you've tried it yourself, and the whole diff since the checkpoint contains only what you asked for.
On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.