ANTIGRAVITY LABJP
Articles/Tips & Best Practices
Tips & Best Practices/2026-03-11Intermediate

Debugging and Testing with Antigravity — Prompt Patterns That Held Up in Solo Development

How to hand the first move of debugging and test generation to Google Antigravity's AI agents — the prompt patterns I rely on, and the context to add so the agent doesn't latch onto the wrong fix.

antigravity432debugging15testing17ai-agent18indie-development4

I once burned half a day on a crash that only happened on certain devices. The stack trace was right there, yet I couldn't narrow down which asynchronous path was at fault. Since I started handing that first move to an Antigravity agent, my sense of how long root-cause analysis takes has shifted noticeably. As an indie developer at Dolice, here are the debugging and testing prompt patterns I reach for again and again.

Paste the Error Log Together With "What I Did"

The simplest way to start debugging with Antigravity is to paste your error log straight into the Editor View. Hand it a stack trace or console output and the agent reasons across your whole codebase, suggesting likely causes and fixes.

But a log on its own tends to scatter the agent's investigation. What works is one extra sentence describing the action that triggered it. "A 500 is returned when I press submit on the registration form" pushes the agent to widen its search to the related endpoints and validation. Without that context, it tends to patch the surface line of the log and hand you a fix that misses the point.

Let It Narrate the Execution Flow Instead of Setting Breakpoints

Traditional debuggers ask you to place breakpoints and step through variable state. With Antigravity, I just ask it to "trace this function's execution flow and explain the arguments and return values at each step," and I get the internal flow back in plain words.

Where I felt this most was chasing an ad that intermittently failed to show in my AdMob mediation setup — a race during initialization. Having the agent explain the order the callbacks fired in surfaced a missing await before I'd placed a single breakpoint. The more a bug involves async work or multiple services talking to each other, the better this bird's-eye approach holds up.

Ask for Normal, Error, and Boundary Cases

Antigravity agents generate test cases from existing code. Point them at a function or module, ask them to "write unit tests," and you get normal cases, error cases, and boundary values in one pass.

It auto-detects the test runner from package.json or config files, so there's no need to name Jest, Vitest, or pytest. In practice I rarely keep the scaffold wholesale — I keep the error cases and rewrite the happy path to match my intent. Just having a starting shape there lowers the activation energy of writing tests considerably.

Add a Regression Test With Every Fix

The moment I fix a bug, I tell the agent to "add a regression test for this fix." It produces a test grounded in the change, and over time a net is woven that catches the same bug if it ever returns.

Wire that into CI such as GitHub Actions and tests run on every pull request. In solo development you're often the only reviewer you have, so that automatic net is a real psychological safety margin.

Three Pieces of Context That Keep It From the Wrong Fix

The agent's accuracy is mostly decided by the quality of the context you hand it. Three things I always include:

  • Concrete reproduction steps — not "sometimes crashes" but "crashes only on the first launch when Wi-Fi is off"
  • Expected versus actual behavior, kept separate — blur them and the agent guesses which one is correct
  • For test generation, the coverage target up front, such as 80% line coverage

Skip these and you get a plausible but off-target fix that costs you more time than it saves. Writing that first sentence carefully turned out to be the shortest path.

Doubt the Returned Fix Once, Before You Accept It

A proposed fix almost always arrives looking like it works. That's exactly where I pause and check whether I can explain, in my own words, why it resolves the bug. Accept it without that, and you tend to get a fix that hides the symptom rather than the root cause — and it resurfaces in a different shape weeks later.

What I do is ask one follow-up: "explain why this change fixes it, tied to the conditions under which the original bug occurred." If the reasoning lines up cleanly with the reproduction conditions, I accept it; if it doesn't, I send the investigation back. That single round trip has sharply cut the number of stopgap fixes I commit by accident.

Start by Delegating the Small Bugs

Debugging and testing with Antigravity quietly changes how you spend your time. Next time you hit a bug, hand the first few minutes of forming a hypothesis to the agent and take the role of putting the reproduction steps into words yourself. Once that division of labor feels right, widen the scope to test scaffolding a little at a time.

Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

Tips2026-06-17
Three Prompts I Tried When Antigravity's Code Felt Correct But Not Mine
When Antigravity's output runs but never quite fits your codebase, the gap is usually missing design context. Three prompting patterns for handing over intent — plus the cases where even that wasn't enough, from real indie development.
Tips2026-05-19
When Antigravity's AI rewrites your package.json dependencies and breaks the build
You asked Antigravity for a small visual change, and somehow twenty-three dependency lines in package.json got rewritten — carets stripped, pins bumped to latest, the build dead on arrival. Here is what triggers it, how to roll back cleanly, and three guardrails to keep it from recurring.
Tips2026-05-03
Retry Isn't Always the Answer in Antigravity — How to Tell When to Retry vs. When to Rethink
Learn when to use Antigravity's Retry feature and when it's time to change your approach entirely. A practical guide to diagnosing root causes before burning time on repeated failed attempts.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →