Errors, Bug Fixing & Tests
You’ll hit errors and bugs all the time. Actual developers do too.
The wrong way to handle them is what most people do at first. Something breaks, you go “fix this,” the agent tries something, it doesn’t work, you go “still broken,” it tries something else, still doesn’t work, and you’re going round and round in circles. You can burn through hours like this.
Before saying “fix this,” give the agent context. What were you trying to do? What did you expect to happen? What actually happened? Paste the errors.
You should ask the agent to investigate before it fixes. Like, “Don’t fix it yet. First, tell me what you think is wrong and why.” Because if it just starts changing stuff without understanding the problem, it might fix the symptom but not the cause. And then you’ve got a different bug next week.
The Power of Tests
Section titled “The Power of Tests”Tests are huge for this. A test is just code that checks if your other code works. So you might have a test that says, “When this button is clicked, this thing should happen.” And you can run all your tests to make sure nothing’s broken. The agent can write tests for you.
A good workflow is: bug happens, you ask the agent to write a test that reproduces the bug first. So now you’ve got a failing test. Then the agent fixes the bug, and the test passes. Now you know it’s actually fixed, and if that bug ever comes back, the test will catch it. This is called test-driven development, kind of.
Using Logs
Section titled “Using Logs”Also, logs. You can ask the agent to add logging so you can see what’s happening. Like, print statements that say “got to this point” or “this variable is this value.” Helps you and the agent figure out where things go wrong.
The best agents have tools for this now. They’ll run the code, see the error, inspect variables, check what’s happening at each step.