# Diagnose a recurring bug

**At a glance**

1. [**Investigate before changing code**](#investigate-before-changing-code): Reproduce the bug and compare competing causes.
2. [**Verify the repair**](#verify-the-repair): A regression that fails without the fix, then the existing checks.
3. [**Review what is reusable**](#review-what-is-reusable): Keep the decisive check and when it does not apply.
4. [**Reuse it on the next change**](#reuse-it-on-the-next-change): Load the saved method in a fresh session and see what it catches.

A solo developer loses time when a bug keeps returning. A small team loses the reasoning again at every handoff. Use a debugging skill to investigate the cause, then preserve the verified method so the next session starts with it.

Use a local branch and a reproducible, non-sensitive example. The skill guides your existing coding agent; MassifyAI does not need a copy of the whole repository.

## 1. Investigate before changing code

**Ready-to-use example**

```text
First follow https://www.massifyai.com/docs-assets/setup/connection-check.md. Complete setup only if needed, then continue below.

Load MassifyAI's curated Pair Programmer profile and systematic-debugging skill for this personal news prototype symptom: begin a summary for article A, replace it with article B before the response arrives, then let A complete; A's old summary or citation must not appear as B's current briefing. Read the example notes at https://www.massifyai.com/docs-assets/examples/news-briefing-fix-notes.md.

In the current application repository, reproduce the ordering with controlled responses, inspect input identity and request cleanup, and compare competing causes before editing. Preserve unrelated work. Verify A finishing before and after B, and source/topic changes without a replacement request. Report actual executed evidence; if no application exists, provide a clearly labeled walkthrough only. Don't call the issue fixed from one successful rerun.
```

**Prompt template**

```text
First follow https://www.massifyai.com/docs-assets/setup/connection-check.md. Complete setup only if needed, then continue below.

Load MassifyAI's curated Pair Programmer profile and systematic-debugging skill for this personal news prototype symptom: <symptom and reproduction>. Read the example notes at <example notes>.

In the current application repository, reproduce the ordering with controlled responses, inspect input identity and request cleanup, and compare competing causes before editing. Preserve unrelated work. Verify A finishing before and after B, and source/topic changes without a replacement request. Report actual executed evidence; if no application exists, provide a clearly labeled walkthrough only. Don't call the issue fixed from one successful rerun.
```

## 2. Verify the repair

Agree the behavior to preserve. Ask for a regression that would fail without the fix, then run the relevant existing checks. For a flaky case, repeat under the conditions that triggered it and state what uncertainty remains. A skill name in the chat is not evidence that its method was followed.

## 3. Review what is reusable

**Ready-to-use example**

```text
First follow https://www.massifyai.com/docs-assets/setup/connection-check.md. Complete setup only if needed, then continue below.

From the verified fix, draft the smallest reusable debugging method that would help on a different instance of this problem. Preserve the decisive check and when it does not apply. Compare existing team skills before proposing a new one. Keep the draft local until I approve its destination and visibility.
```

**Prompt template**

```text
First follow https://www.massifyai.com/docs-assets/setup/connection-check.md. Complete setup only if needed, then continue below.

From the verified fix, draft the smallest reusable debugging method that would help on a different instance of this problem. Preserve the decisive check and when it does not apply. Compare existing team skills before proposing a new one. Keep the draft local until I approve its destination and visibility.
```

> **Tip:** A useful skill might encode how to trace a missing setting across process boundaries, rather than “read logs and retry.” Review the evidence and remove sensitive incident details.

## 4. Reuse it on the next change

After approval and publication, load the saved method in a fresh session working on a related task. Check whether it catches the boundary earlier. Revise it if the new case exposes a limit. The loop is **verified fix → reviewed method → shared skill → checked reuse**; it is not automatic distillation or a promise of a particular productivity gain.

Continue with [Share your team's expertise](/docs/tutorials/share-team-expertise) or [Turn a solved bug into a reusable skill](/docs/tutorials/mine-and-refine-a-skill).
