deep-debugging

Systematic debugging protocol for bugs that resist quick fixes. Use bisection, hypothesis trees, and scientific method when a bug isn't obvious from the stack trace. Goes beyond bugfix-quick for production-grade root cause analysis.

Best use case

deep-debugging is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Systematic debugging protocol for bugs that resist quick fixes. Use bisection, hypothesis trees, and scientific method when a bug isn't obvious from the stack trace. Goes beyond bugfix-quick for production-grade root cause analysis.

Teams using deep-debugging should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/deep-debugging/SKILL.md --create-dirs "https://raw.githubusercontent.com/nguyenthienthanh/aura-frog/main/aura-frog/skills/deep-debugging/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/deep-debugging/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How deep-debugging Compares

Feature / Agentdeep-debuggingStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Systematic debugging protocol for bugs that resist quick fixes. Use bisection, hypothesis trees, and scientific method when a bug isn't obvious from the stack trace. Goes beyond bugfix-quick for production-grade root cause analysis.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

> **AI-consumed reference.** Optimized for Claude to read during execution.
> Human-readable explanation: see [docs/architecture/HIERARCHICAL_PLANNING.md](../../../docs/architecture/HIERARCHICAL_PLANNING.md)
> or [docs/getting-started/](../../../docs/getting-started/) depending on topic.


# Deep Debugging

For bugs where `bugfix-quick` fails. Apply scientific method, not vibes.

**Escalation path:** `bugfix-quick` (< 15 min, clear cause) → `deep-debugging` (scientific method)
**Uses:** `tree-of-thoughts` skill for hypothesis trees, `chain-of-verification` for claim validation

---

## When to Use vs. bugfix-quick

| Signal | Use |
|--------|-----|
| Stack trace points to clear line | bugfix-quick |
| Reproduces 100% of the time | bugfix-quick |
| Happens in known edge case | bugfix-quick |
| Intermittent / flaky | **deep-debugging** |
| Multiple plausible causes | **deep-debugging** |
| "Works on my machine" class | **deep-debugging** |
| Timing / race conditions | **deep-debugging** |
| Production-only, can't repro locally | **deep-debugging** |

---

## The Protocol

### Step 1 — Reproduce reliably

Cannot debug what you can't reproduce. Goals:

- Minimum reproduction case (strip all non-essential code)
- Document trigger conditions (env, timing, order of operations)
- If intermittent: repeat N times, calculate failure rate

**If can't reproduce: STOP.** You can't debug. Alternative: add observability (logging, metrics, traces) to production to catch the next occurrence. Don't guess.

### Step 2 — Form a hypothesis tree (via tree-of-thoughts)

Don't jump to the first suspicion. Enumerate possibilities:

```
Root: Login fails intermittently in production
├── Branch A: Session store issue
│   ├── A1: Redis connection pool exhausted
│   ├── A2: Cookie domain mismatch
│   └── A3: Session expiry race condition
├── Branch B: Load balancer / infra
│   ├── B1: Sticky session misconfigured
│   └── B2: TLS termination timing
└── Branch C: Auth service
    ├── C1: JWT clock drift
    └── C2: Rate limit hit
```

Score each branch 0-10 on:
- Fits observed symptoms
- Matches recent changes (diff since last known good)
- Matches failure pattern (timing, frequency, environment)

Prune branches below 5/10. Expand survivors.

### Step 3 — Bisect when possible

If bug was introduced recently:

```bash
git bisect start
git bisect bad HEAD
git bisect good <known-good-commit>
git bisect run ./scripts/reproduce-bug.sh  # automated narrowing
```

Bisection narrows to a single commit in O(log n) steps.

If not in git history — **bisect the codebase**:
- Comment out half the suspect module
- Does the bug persist? Narrow to the remaining half.
- Repeat until one file/function isolates it.

### Step 4 — Test hypothesis (one at a time)

For the top-scoring hypothesis:

1. **Predict:** "If A1 is true, then metric X should show pool saturation at failure time"
2. **Observe:** run the experiment or check the metric
3. **Match?**
   - Yes → likely cause, go to Step 5
   - No → prune this hypothesis, move to next

**Anti-pattern:** changing multiple things at once. You won't know which fix worked.

### Step 5 — Verify root cause (via chain-of-verification)

Before claiming the fix:

1. Draft explanation of root cause + fix
2. Generate 3–5 verification questions:
   - "Does the fix change the failure rate from X% to 0%?"
   - "Does removing the fix reintroduce the bug?"
   - "Do similar code paths have the same issue (broader impact)?"
3. Answer each via tool (test, metrics, code search) — not from memory
4. Revise explanation based on actual results

Outcome: high-confidence claim backed by evidence, not "works on my machine."

### Step 6 — Write the regression test

Bug without a regression test = bug that returns. Add a test that:

- Fails on the unfixed code
- Passes on the fixed code
- Documents the exact scenario (comment the *why* — timing, race, input shape)

---

## Anti-Patterns

- **Blame the flake** — "Just retry the test." 80% of flaky tests are real bugs exposing timing issues; investigate instead of masking.
- **Shotgun fixes** — changing 5 things hoping one works. You learn nothing about root cause.
- **Reasoning from stack trace only** — the stack trace shows *where* it crashed, not *why*.
- **Skipping reproduction** — if you can't reproduce, you can't verify the fix. Get reproduction first.
- **No regression test** — fix without test = bug waiting to come back. Always close with a test.

---

## Output Format

```markdown
## Bug: [short description]

**Symptoms:** [what the user observed]
**Reproduction:** [minimum case, N trials, failure rate]
**Root Cause:** [verified explanation]
**Evidence:** [verification questions answered]
**Fix:** [what changed + commit ref]
**Regression Test:** [test file + name]
**Similar Impact:** [other places checked — immune / also vulnerable]
```

---

## Tie-Ins

- `skills/bugfix-quick/SKILL.md` — escalate here if quick path fails
- `skills/tree-of-thoughts/SKILL.md` — hypothesis branching
- `skills/chain-of-verification/SKILL.md` — verify root cause claim
- `rules/core/no-assumption.md` — don't guess at causes
- `rules/core/verification.md` — prove before shipping
- `rules/core/simplicity-over-complexity.md` — once root cause is known, the fix should be minimal — resist the urge to refactor "while we're here"

Related Skills

vue-expert

14
from nguyenthienthanh/aura-frog

Vue 3 gotchas and decision criteria. Covers reactivity traps, Composition API pitfalls, and Pinia patterns.

typescript-expert

14
from nguyenthienthanh/aura-frog

TypeScript gotchas and decision criteria covering nullish coalescing pitfalls (|| vs ??), strict tsconfig settings (noUncheckedIndexedAccess, exactOptionalPropertyTypes), type guard patterns, discriminated unions, and as const vs enum. Use when writing TypeScript, configuring tsconfig, implementing type guards, or debugging null/undefined errors.

tree-of-thoughts

14
from nguyenthienthanh/aura-frog

Branch, evaluate, prune, expand — structured search over solution space. Use for architecture with multi-step decisions, refactor planning, or complex debug hypothesis trees. Paper: Yao et al. 2023.

test-writer

14
from nguyenthienthanh/aura-frog

Write tests with TDD following structured patterns. Ensures consistent AAA structure, proper coverage targets, and framework-specific conventions. Without this skill, tests lack consistent naming, miss coverage targets, and skip anti-pattern checks.

stitch-design

14
from nguyenthienthanh/aura-frog

Generate UI designs using Google Stitch AI with optimized prompts

session-continuation

14
from nguyenthienthanh/aura-frog

Manage workflow state across sessions with handoff and resume. TOON-based state persistence.

sequential-thinking

14
from nguyenthienthanh/aura-frog

Structured thinking process for complex analysis. Supports revision, branching, and dynamic adjustment.

self-improve

14
from nguyenthienthanh/aura-frog

Apply learned improvements to the Aura Frog plugin. Updates rules, adjusts agent routing, modifies workflow configurations, and generates knowledge base entries.

self-healing-orchestrator

14
from nguyenthienthanh/aura-frog

Proposes patches for F2 (local-logic) and F3 (local-design) failures. NEVER applies without user approval. Confidence ≥0.7 to propose; below that, escalates raw findings. Counts toward replan_budget. Per-task: max 1; per-session: max 5.

self-consistency

14
from nguyenthienthanh/aura-frog

Generate N independent reasoning paths and vote on the answer. Use for architectural trade-offs, ambiguous design decisions, or when single-path reasoning risks locking onto the first plausible answer. Paper: Wang et al. 2022.

scalable-thinking

14
from nguyenthienthanh/aura-frog

Design for scale while keeping implementation simple (KISS).

run-orchestrator

14
from nguyenthienthanh/aura-frog

Execute 5-phase TDD workflow for complex features. Use when the user invokes /run, asks to build/create/implement a feature, requests a complex multi-file change, or types 'fasttrack:'. Enforces phase gates, sprint contracts, and builder!=reviewer discipline.