> ## Documentation Index
> Fetch the complete documentation index at: https://vlyai-1c28d863.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Debugging prompts

> When the agent gets it wrong, here's how to diagnose why and re-prompt cleanly.

When a prompt produces the wrong result, the temptation is to argue with the implementation. Don't. Roll back; refine the prompt; resubmit.

## Diagnosis checklist

<Steps>
  <Step title="Did the agent restate the prompt correctly?">
    Plan mode shows the agent's restatement. If it misses the point, the prompt was the issue.
  </Step>

  <Step title="Did it use the right entity names?">
    "the data" instead of "the `tasks` table" leaves room for misinterpretation.
  </Step>

  <Step title="Did it touch only what you asked?">
    Over-editing is a sign of missing constraints ("don't change X").
  </Step>

  <Step title="Did it pick the right integration?">
    "send an email" without specifying Resend may pick SendGrid; be explicit.
  </Step>
</Steps>

## Common fixes

<Tabs>
  <Tab title="Add a constraint">
    "Same change, but don't break the existing X."
  </Tab>

  <Tab title="Switch to Plan mode">
    The plan reveals the misread before code is written.
  </Tab>

  <Tab title="Switch agents">
    Codex for tight changes; Gemini for layout; Claude for everything else.
  </Tab>

  <Tab title="Reduce scope">
    Break a 3-thing prompt into 3 separate prompts.
  </Tab>
</Tabs>

## Tips

<Tip>
  **Roll back before re-prompting.** Don't iterate on top of broken output; you'll compound the issue.
</Tip>

## Related

<CardGroup cols={3}>
  <Card title="Iterating effectively" icon="repeat" href="/prompting/iterating-effectively">
    The mindset.
  </Card>

  <Card title="Common mistakes" icon="triangle-alert" href="/prompting/common-mistakes">
    Patterns to avoid.
  </Card>

  <Card title="Plan mode" icon="workflow" href="/building/plan-mode">
    The cheapest insurance.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.