← All guides

Troubleshooting

Ask AI to Fix One Bug Without Rewriting Your App

Official VS Code example of reviewing an AI-suggested code change; the example code is not a project claimed by this publication.
Official VS Code example of reviewing an AI-suggested code change; the example code is not a project claimed by this publication. Image source. © Microsoft. Interface versions may differ.

A narrow bug report helps preserve working behaviour. Describe the difference between expected and actual results before asking for a patch.

A practical sequence

  1. Reduce the problem to the smallest reproducible case. Record the exact input, error text and relevant version, removing secrets and personal data.
  2. Share the relevant file or function and explain which surrounding behaviour must remain unchanged. Ask for a diagnosis before a large rewrite.
  3. Review the proposed change line by line and run the reproduction again. Add a meaningful check for the failure where the project supports tests.
  4. Test one nearby working case and save the fix as a small revision. If it fails, revert the change and update the evidence rather than stacking speculative edits.

An example to adapt

Bug report: expected / actual / steps / minimal input / relevant code / constraints. Ask for the smallest patch and how to verify it.

Try the example in a copy or a small project before applying it to live work. Keep the working version available and record the exact change you made. For a college project or a freelance handoff, being able to explain the decision and demonstrate the result is more valuable than adding features you cannot maintain.

What to check before you finish

A disappearing error message is not proof that the underlying bug is fixed. Check the actual output and any data affected by the operation.

Verify the intended behaviour as well as one failure case. Record what worked, what remains uncertain and how to reverse the change. An AI-generated explanation can help you investigate, but the running project and its actual output are the evidence.