Free to read · no account needed

16 min · code

Ask for an explanation before the patch

Goal: Avoid blind copy-paste of code you do not understand—by forcing a plain-language diagnosis first.

Best for: Every coding chat for beginners; also useful when you are tired and tempted to “just apply it.”

If you cannot explain the bug to a friend, you should not ship the fix. Split the chat: Step A explain only; Step B patch only after OK.

Explain-then-change is a seatbelt: the model must show it understands the bug before it rewrites. You catch wrong assumptions early—when they are cheap.

If the explanation cites a file you do not have, stop. Guessing the locus is how wrong patches feel productive.

Why beginners skip this

“Just fix it” on “Avoid blind copy-paste of code you do not” skips the explain pass that catches the wrong layer The fix is one dated pass/fail on a live artifact for “Avoid blind copy-paste of code you do not”—not another bookmark. If you cannot name what you will refuse this week, you are still collecting titles

Step 1 — Two-step ask

Do this step with a real artifact open—not from memory.

Step A: Explain the bug in plain language (5 bullets). Do not give fixed code yet.
Step B: After I say “OK”, show the smallest patch and why each changed line exists.
Constraints: no unrelated refactors; no new dependencies unless I ask.

Step 2 — Minimal repro gate

Example

Filled prompt

Bug: login form submits twice on slow networks. Before any patch, ask for: suspected cause, which file/function to touch, and a 3-step verify plan. Stack: React + basic fetch. Do not invent files I did not mention.

What good output looks like

  • Five bullets: suspected cause, file/function locus, why double-submit happens
  • Names only React + fetch pieces you mentioned—no invented files
  • Includes a 3-step verify plan you can run
  • Explicitly withholds patch code until you say OK
  • You could explain the bug to a teammate from the bullets alone

Step 3 — Teach-back check

Before merging:

Quiz me with 3 short questions about this bug and fix. Do not reveal answers until I reply.

If you miss two, re-read the explanation—do not ship yet.


Example

Filled prompt

Intermittent signature verify fail.
Explain 5 bullets then minimal fix in src/webhooks/ only. No secrets in chat.
Context: real workstream this week (Asia/Shanghai). Name actual files/people.
Constraints: no invented metrics/owners/prices; label Unknowns; stop before send/delete/pay.
Done check: I can mark pass/fail in one minute on the output.

What good output looks like

  • Three sharp questions aimed at wrong assumptions (locus, race, retry)
  • Questions would fail a model that guessed the wrong file
  • Still withholds patch code in this challenge turn
  • Each question is answerable from the pasted explanation
  • You pause shipping if you miss more than one

Save this card

Card: Explain current behavior before you accept a patch—wrong locus is expensive—date a refuse-line this week, or nothing changed. Keep this beside the tool; read before you start.

1. What I shipped: ___ 2. What I refused: ___ 3. What I will never-do again: ___ (date: Asia/Shanghai)

  • [ ] Tools/writes paused
  • [ ] Refuse-line dated
  • [ ] Artifact path saved
  • [ ] Next link chosen (or stop)

Before you start

Open the failing test, diff, or ticket for “Avoid blind copy-paste of code you do not.” Keep secrets out of the chat. Have the file path you will name. Guide: code-explain-then-change. If you only have a blank practice box, stop and fetch the real job first.

  • Goal in one line: ___
  • Allowed tools: ___
  • Forbidden: ___
  • Human approve needed for: ___

How to use this week

This week in code: before accepting a patch, demand an explanation of current behavior and the exact locus. Wrong locus → no merge on a live artifact—not a blank demo. Write one refuse-line and date the note (Asia/Shanghai). If you only skimmed code-explain-then-change, put 25 minutes on the calendar and redo once.

Mid-week cost check: if this habit disappeared tomorrow, what breakages would you notice in 24 hours? Write one line (Asia/Shanghai).

Wrong locus check

If the explanation names files you lack, stop—the model is guessing.

Teach-back before merge

After the patch draft, ask the model to quiz you with three short questions about the bug and fix—answers withheld until you reply. Miss two? Re-read the explanation; do not ship yet.

Example

Filled prompt

Webhook signature verify failing intermittently.
Explain 5 bullets then minimal fix in src/webhooks/ only.
Stop if secrets needed in chat.

What good output looks like

  • Names files/functions you provided for “Avoid blind copy-paste of code you do not understa”
  • No secrets in logs; no mystery whole-repo rewrite
  • Explain-before-patch or minimal repro respected
  • Pass/fail: you can restate the change in 3 bullets

Red flag

Pretty patch on the wrong locus; cannot state before/after behavior in three lines—do not merge.

Pitfalls

PitfallFix
“Fix this” in one messageHard split A/B
Accepting a rewrite as “simpler”Demand smallest patch
Skipping the reproMinimal repro first
Shipping without teach-back3-question quiz

Example

Filled prompt

Job: Avoid blind copy-paste of code you do not understa
Prior fail: [what missed the check]
Repair: keep the same Done; add one constraint + one concrete example from my notes.
Boundaries: draft only; label Unknowns [?]; no silent send.
Return: fixed output + the one-minute pass/fail I will mark.

What good output looks like

  • Names the prior fail without inventing a new job
  • Adds one constraint tied to “Avoid blind copy-paste of code you do not understa”
  • Still draft-only / Unknowns labeled
  • Pass/fail: you mark green on the same checklist (code-explain-then-change #4)

Practice now

Live card: one real code change under “Ask for an explanation before the patch”—diff-only + test note (Asia/Shanghai).

Today: pick one real failing test or stack trace. Ask: explain current behavior in five bullets, then propose a minimal change. Apply only if the explain matches reality. Quiz yourself with three questions before merge.

Today card (copy) — code-explain-then-change: 1. Artifact I will produce: ___ 2. Pass/fail check: ___ 3. Refuse-line if tempted to skip verify/send: ___ (date: Asia/Shanghai) 4. One never-do from this guide: ___

  • [ ] Artifact path written
  • [ ] Refuse example would say "yes"
  • [ ] Dated Asia/Shanghai

One sentence takeaway

Explain current behavior before you accept a patch—wrong locus is expensive—date a refuse-line this week, or nothing changed

  • You can point to a dated refuse-line
  • You have one artifact path from tonight
  • You can teach the red flag in one sentence

Next

Minimal repro · Tests first · PR description · Coding agent boundaries · Code path

Pair with today: open the first Next link (code-minimal-repro-first) only after you dated a refuse-line for this guide (Asia/Shanghai).

← Back to home · Learn · Tools · Compare · Start