Agent Upstart

Cool things people are building with agents — and practical help getting the most out of them.

Playbooks · Coding agents

Fix a bug with an agent without breaking the test suite

A solo builder reproduces a bug, hands Aider the failing case, and lets the suite decide whether the fix is safe.

Audience: Solo builder · Stack: A git repo with an existing automated test suite and a test command you already run · Tool: Aider (terminal)

Before you start

Steps

  1. Reproduce the bug first, by hand, and note the exact failing command and output. If you cannot reproduce it, do not hand it to the agent yet.
  2. Start Aider in the project directory with aider, then add only the files involved with /add <file>. Aider edits the files added to the chat; keeping that set small keeps the fix small.
  3. If you want tests run after every edit, start with the project's test command, for example aider --test-cmd "<your test command>" --auto-test. The author lint/test docs describe exactly these two switches. Otherwise, run tests yourself with /test <test-command> after each change; Aider runs the command and tries to fix errors when it returns a non-zero exit code.
  4. Give the agent the reproduction, the expected result, and one constraint: change the smallest amount of code that fixes the case, and do not change unrelated tests to make them pass.
  5. After each edit, read the diff with /diff. Aider commits each of its edits with a descriptive message, per its author git docs, so the history shows what it did step by step.
  6. Run the full suite, not just the failing test. A fix that passes one test and breaks three others is not a fix.
  7. If an edit makes things worse, use /undo, which the author docs describe as undoing the last git commit done by Aider. Then re-brief with the new information instead of piling more edits on a bad one.

Worked example

A solo builder's invoicing script totals an invoice wrong when a line item has a quantity of zero: the total includes a stray charge. They reproduce it with the project's test command, see one failing case, and start Aider with /add on the totals module and its test file only. The brief is: “Quantity zero must contribute nothing to the total. Change only the totals calculation. Do not change the tests.” Aider edits the calculation, /test shows the failing case now passing, the full suite is run, the diff shows a two-line change, and the fix is committed on its branch. When an earlier attempt also changed a rounding helper, /undo removed that attempt and the builder re-briefed with the narrower constraint.

What can go wrong

Limits

Time and cost: NOT_MEASURED. This page gives no time or cost figure because the tool docs fetched for it state none that applies to this task.

Verification

Checked 2026-10-23 against the author's own docs. The workflow on this page was not run end to end; every command, flag, and capability claim was checked against an author doc or repo fetched that day.

Cut from this page, with reason:

If a step here does not match what your installed tool shows, trust the tool's own docs for your version and stop before approving a change you cannot read.

Back to: Coding playbooks hub · Skills index