Chapter 11: Design

All of that assumes you can change the shape of code safely. That is what this word means, and its meaning is stricter than most people use it.

Refactoring

Changing how code is organised without changing what it does, in small steps, running the tests after each one. If the behaviour changed, it wasn't refactoring.

Agents say "refactor" and may mean rewrite. A rewrite that also changes behaviour can't really be reviewed, and when something breaks you can't tell which line did it. Small green steps give an agent a way to know it is still safe.

Say it to your agent

“Refactor only: no behaviour changes and no test edits. Make each step its own commit and run bun test between them. If a test goes red, revert that step rather than fixing forward. Add the feature afterwards, in a separate commit.”

The workshop

Name a word, or describe what you mean in everyday language.