Refactoring with AI under a safety net
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
refactor in small, verified steps.
Planned topics
- Start green: tests and contract tests pass before you begin.
- Ask for one small step at a time; run tests after each; commit each step.
- Reject any change that alters behavior or public contracts, even if it looks cleaner.
- Characterization tests protect untested code before you touch it.
- Keep diffs small enough to review; split large ones.
Draft outline details
Demonstration
a sequence of commits: extract method, rename, move class, each with green tests.
Check your understanding
What do you do when tests fail after an AI step?
Show answer
Revert or fix that small step; do not continue on red.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.