Block VI · Coding with agents · Lesson 32
Code like a pro with AI: plan, tests and review
You'll learn the workflow that avoids fragile code: plan before writing, write the tests first, work in parallel with worktrees and automatically review every change before accepting it.
- 11 min
- 9 animated slides
- 4-question quiz
- Narrated in 6 languages
What you'll see in this lesson
- The workflow that prevents fragile code
The teams that work best with agents always repeat the same cycle: plan, tests, code, review and commit.
- Plan mode: first it reads and proposes, then it touches
In plan mode the agent explores the code and presents you a plan, but changes nothing until you approve it.
- Big tasks: interview and specification
Before a big feature, ask the agent to interview you and put everything in writing in a file.
- Tests first: the agent knows when it's done
With TDD (test-driven development) you write the tests first, check that they fail, and only then write the code.
- Give the agent something it can check
Anything that returns «pass» or «fail» works: tests, build, linter or a screenshot compared with the design.
- Several sessions in parallel with git worktrees
A worktree is another working copy of the same repository, in its own folder and branch: each agent works in its own.
- Automatic review before accepting each change
A reviewer with a clean context finds bugs the agent that wrote the code can't see.
- Small commits: every step, a way back
Commit every time something works and passes the tests: one change, one commit, one clear message.
- Summary: the professional workflow with agents
Plan, tests, verification, parallel work, review and small commits: slower at first, much faster in the end.
Tools and concepts
- Plan mode
- Worktrees
- Code review
- TDD
Sign in with your Google account to access this lesson and the whole course.