Source: https://arara.code.app.br/en/articles/debugging-code-with-ai
Language: en-US
Published: 2026-11-16T08:40:00-03:00

Guides and comparisons

# Debugging code with AI: how to find bugs faster

To debug with AI, give the agent a minimal reproduction, the full error message and the expected behavior, and ask for hypotheses that can be tested one by one. The agent speeds up the search, but the cause is only confirmed when a test or a log proves it.

Arara Code

Published and sources checked on November 16, 2026.

Published by the Arara Code project based on the official documentation cited.

## Start with the reproduction and the right context

Debugging is the process of finding and fixing the cause of a defect. The agent works best with the steps that reproduce the error, the dependency versions and the full stack trace, without cuts.

State the expected and the actual result. "It does not work" forces the model to guess; "returns 500 when submitting the form with an empty field" points to validation.

[Wikipedia: Debugging](https://en.wikipedia.org/wiki/Debugging)

## Ask for hypotheses, not immediate fixes

Ask for two or three hypotheses ordered by likelihood, each with a way to verify it: a log, a breakpoint or a failing test. This avoids fixes that only hide the symptom.

Rubber duck debugging, explaining the problem out loud, works with the agent too, because writing out the reasoning exposes wrong assumptions.

[Wikipedia: Rubber duck debugging](https://en.wikipedia.org/wiki/Rubber_duck_debugging)

Related

[Prompts for coding with AI: rules and examplesHow to write prompts for coding with AI: goal, files and checks, a plan before code, AGENTS.md and CLAUDE.md, with examples from the official guides.](https://arara.code.app.br/en/articles/prompts-for-coding-with-ai)

## Isolate the commit with git bisect

git bisect uses binary search on the history to find the commit that introduced a bug. With N commits between a good and a bad version, about log2(N) tests are enough.

The agent can write the test script that returns success or failure and run git bisect run, making the search automatic. Review the script before running it.

[Git: git bisect documentation](https://git-scm.com/docs/git-bisect)

## Debugging with agents in Arara Code

In Arara Code, the agent reads the integrated terminal, runs the failing test and proposes the fix as a diff. You approve each command and check the change.

After fixing, ask for a regression test that fails before the fix and passes after it. The test documents the bug and keeps it from coming back.

[Arara Code repository on GitHub](https://github.com/arara-ide/arara-code)

## Sources and further reading

- [Wikipedia: Debugging](https://en.wikipedia.org/wiki/Debugging)
- [Wikipedia: Rubber duck debugging](https://en.wikipedia.org/wiki/Rubber_duck_debugging)
- [Git: git bisect documentation](https://git-scm.com/docs/git-bisect)
- [Arara Code repository on GitHub](https://github.com/arara-ide/arara-code)

[Read as Markdown](https://arara.code.app.br/en/articles/debugging-code-with-ai.md)

## Keep exploring

### [How to reduce token usage when coding with AI](https://arara.code.app.br/en/articles/reduce-token-usage-when-coding-with-ai)

Cut cost and usage-limit consumption in coding agents: lean context, prompt caching, the right model for each task and short sessions.

[Read the guide](https://arara.code.app.br/en/articles/reduce-token-usage-when-coding-with-ai)

### [Vibe coding: what it is, the risks and how to start safely](https://arara.code.app.br/en/articles/vibe-coding)

Learn what vibe coding is, what 2025 data shows about trust and security, and how to start safely with a branch, tests and diff review.

[Read the guide](https://arara.code.app.br/en/articles/vibe-coding)

## Make room for your next idea.

Get to know Arara Code in your own project. Start with the installer and review the changes your assistant makes.

Download Arara Code
