liveBook · Manning

Refactoring

As explained in "Looks Good to Me"

AI-assisted restructuring of code directly within a code-review workflow while proposing an immediately integrable change.

Refactoring becomes a collaborative code-review tactic when AI identifies an improvement, proposes the change inline, and lets the team decide whether to integrate it. A reviewer can point to a specific concern; an author can use the same capability as a first review of their own pull request. section 13.3 section 13.6

Choose the level of assistance that fits the pull request and your team’s confidence:

  • Target a selected region with a natural-language request, such as asking What The Diff to register code as a singleton; review and accept the generated change with one click. section 13.3
  • Ask Qodo’s /improve command for maintainability improvements or overlooked best practices; use --extended when a larger pull request needs segmented, proportionate suggestions. section 13.3
  • Keep human judgment in the loop: validate context and nuance, avoid treating suggestions as approval decisions, and introduce the capability cautiously. section 13.6

A practical review exchange

A reviewer notices that a pull-request change could be improved but cannot yet articulate the exact edit. They comment on the relevant lines with a focused refactoring request. The AI proposes an inline patch; the author reviews it, adjusts it if needed, and integrates it only after human validation. The author could have run the same improvement command before requesting review. section 13.3 section 13.6

Figure 13.3 What The Diff generated suggestion to register selected code as a singleton
figure

Inspect the generated suggestion for registering selected code as a singleton. section 13.3

Figure 13.4 Output of Qodo /improve command with the --extended flag
figure

Inspect how Qodo’s extended improvement command segments a larger pull request and generates proportionate suggestions. section 13.3

How "Looks Good to Me" covers it

How deep it goes
Explains targeted and extended suggestions, but defers final decisions and contextual judgment to humans.
Examples
Uses What The Diff’s singleton suggestion and Qodo’s /improve and --extended commands as concrete workflows.
What it assumes
Assumes familiarity with pull requests and review feedback while emphasizing that AI suggestions still require human validation.
What you can do after
Apply it via What The Diff or Qodo to propose review changes, then validate and integrate suitable patches.
How it connects
Connects refactoring with code review, pull requests, maintainability, best practices, and human judgment.

Also explained in

Compare how 22 books explain refactoring →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of "Looks Good to Me". The section links point to the parts of the book it draws on.