34.3 Change proposal workflow (plan → diff → tests)

Overview and links for this section of the guide.

The Three-Step Flow

Never ask the model to "just do it." It leads to spaghetti code. Force this flow:

  1. PLAN: "Read `src/utils.ts`. Explain what needs to change to support the new date format. List the steps."
  2. DIFF: "Based on the plan, generate a Unified Diff for the file."
  3. TEST: "Generate a test case that verifies this change."

Generating Clean Diffs

LLMs are notoriously bad at row numbers in standard diffs. A better format is Search/Replace Blocks:

<<<<<<< SEARCH
function oldCode() {
  return true;
}
=======
function newCode() {
  return false;
}
>>>>>>> REPLACE

This is robust against minor line number shifts. Your script parses this block, finds the `SEARCH` text in the file, and swaps it for `REPLACE`.

Where to go next