---
title: Track down a flaky test
description: Find out why a test fails some of the time before anyone changes the test.
url: https://openplanr.dev/docs/prompts/track-down-a-flaky-test
updated: 2026-10-06
related:
  - https://openplanr.dev/docs/prompts/diagnose-without-fixing.md
  - https://openplanr.dev/docs/prompts/investigate-first.md
  - https://openplanr.dev/docs/prompts/browser-qa-flow.md
---

# Track down a flaky test

Find out why a test fails some of the time before anyone changes the test.

## Prompt

Claude Code:

```text
/investigate The checkout total test fails about one run in ten in CI. Find the cause before changing the test.
```

If /investigate runs another command, use /planr:investigate.

Codex:

```text
$investigate The checkout total test fails about one run in ten in CI. Find the cause before changing the test.
```

With the OpenPlanr plugin for Codex, use $planr:investigate.

Cursor:

```text
@planr-investigate The checkout total test fails about one run in ten in CI. Find the cause before changing the test.
```

Cursor applies the planr-investigate rule when you mention it in chat.

Parts to fill in, shown with their example text:

- The flaky test: The checkout total test
- How it fails: fails about one run in ten in CI

## Why this works

Investigate traces the call path, state, configuration, and recent changes, then runs the cheapest checks that tell competing causes apart. Asking for the cause first keeps the fix on the code instead of on the test.

## Make it stick

[OpenPlanr Investigate](https://openplanr.dev/docs/skills/investigate.md)
