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: refactoring safely with an agent
card 6 of 6
Remember
builds on: Workflow: having the agent write tests, Tests as the definition of done, Doing a bigger change plan-first, step by step, Branches for risky or alternative attempts
Pin the current behaviour with committed tests first. Then refactor on a branch in small, tested, committed steps. At the end, prove that no test and no public name, parameter or return value changed. If one did, it wasn't a refactor.
Terms on this card
- refactor
- Changing how code is organised (names, structure, splitting functions) without changing what it does for anyone using it.
- branch
- A separate line of commits in git, so experimental work stays off `main` until you decide to merge it.
- return value
- What a function hands back to the code that called it.
- test
- A small piece of code that runs part of your program and checks the result matches what's expected, reporting pass or fail.
- tests
- Small pieces of code that run your program's code and check it gives the expected results.
Lesson goal: Refactor safely by making sure tests cover the behaviour first, then asking for behaviour-preserving changes in small committed steps on a branch. Check that no test or public interface was quietly changed. ·
the whole lesson