Skip to main content
command CX Codex

team-debug — Claude Code command: debug with competing hypotheses

Spawns several debugger agents in parallel, each testing a different theory about the bug and gathering evidence for or against it.

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add wshobson/agents
/plugin install agent-teams@claude-code-workflows
Open on GitHub

What team-debug does

The command follows the Analysis of Competing Hypotheses method. It reads your error description or the file you point at, searches the codebase for related code and stack traces, and checks recent git changes and tests. Then it generates N hypotheses about the root cause — three by default — spread across logic errors, data issues, state problems, integration failures, resources and environment.

A team named debug-{timestamp} is created with TeamCreate, and each hypothesis gets its own agent-teams:team-debugger teammate spawned through the Agent tool. They investigate in parallel while you watch the completed-count. Afterwards the command compares the reports: which hypotheses were confirmed, which were falsified, which stayed inconclusive. Confirmed ones are ranked by confidence and strength of the causal chain, and you get a report with file:line citations plus a recommended fix.

Set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 before running it, otherwise the command stops at the pre-flight check. The --scope flag takes files, module or project. Wider scope means longer investigations, so for a small bug there is little reason to point it at the whole project.

What it helps with

  • trace a stack trace back to its source in the code
  • rule out wrong theories about a crash
  • test several bug hypotheses at once
  • get a report with file and line citations
  • tell a logic error apart from a data or state problem

Example prompts for the agent

  • /team-debug TypeError: cannot read property 'id' of undefined
  • /team-debug src/api/client.ts --hypotheses 4 --scope module
  • /team-debug auth test keeps failing --scope project

How to install team-debug

1Plugin marketplace

/plugin marketplace add wshobson/agents
/plugin install agent-teams@claude-code-workflows

2Manually: put the files in place

.claude/commands/team-debug.md

Call it with /team-debug. For all projects use ~/.claude/commands/

Questions about team-debug

How do I install team-debug in Claude?

Add the marketplace with /plugin marketplace add wshobson/agents, then install the plugin with /plugin install agent-teams@claude-code-workflows. The command file lives at .claude/commands/team-debug.md.

What does team-debug do?

It debugs an issue through competing hypotheses: several agents investigate different root-cause theories in parallel and report evidence. You end up with a ranked report naming the most likely cause and a suggested fix.

What do I need before running team-debug?

The CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 environment variable. Hypothesis count comes from --hypotheses, and --scope accepts files, module or project.

Source text

team-debug.md · MIT
---
description: "Debug issues using competing hypotheses with parallel investigation by multiple agents"
argument-hint: "<error-description-or-file> [--hypotheses N] [--scope files|module|project]"
---

# Team Debug

Debug complex issues using the Analysis of Competing Hypotheses (ACH) methodology. Multiple debugger agents investigate different hypotheses in parallel, gathering evidence to confirm or falsify each one.

## Pre-flight Checks

1. Verify `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is set
2. Parse `$ARGUMENTS`:
   - `<error-description-or-file>`: description of the bug, error message, or path to a file exhibiting the issue
   - `--hypotheses N`: number of hypotheses to generate (default: 3)
   - `--scope`: investigation scope — `files` (specific files), `module` (module/package), `project` (entire project)

## Phase 1: Initial Triage

1. Analyze the error description or file:
   - If file path: read the file, look for obvious issues, collect error context
   - If error description: search the codebase for related code, error messages, stack traces
2. Identify the symptom clearly: what is failing, when, and how
3. Gather initial context: recent git changes, related tests, configuration

## Phase 2: Hypothesis Generation

Generate N hypotheses about the root cause, covering different failure mode categories:

1. **Logic Error** — Incorrect algorithm, wrong condition, off-by-one, missing edge case
2. **Data Issue** — Invalid input, type mismatch, null/undefined, encoding problem
3. **State Problem** — Race condition, stale cache, incorrect initialization, mutation bug
4. **Integration Failure** — API contract violation, version mismatch, configuration error
5. **Resource Issue** — Memory leak, connection exhaustion, timeout, disk space
6. **Environment** — Missing dependency, wrong version, platform-specific behavior

Present hypotheses to user: "Generated {N} hypotheses. Spawning investigators..."

## Phase 3: Investigation

1. Use `TeamCreate` tool to create the team with `team_name: "debug-{timestamp}"` and `description`
2. For each hypothesis, use `Agent` tool to spawn a teammate:
   - `name`: `investigator-{n}` (e.g., "investigator-1")
   - `subagent_type`: "agent-teams:team-debugger"
   - `prompt`: Include the hypothesis, investigation scope, and relevant context
3. Use `TaskCreate` for each investigator's task:
   - Subject: "Investigate hypothesis: {hypothesis summary}"
   - Description: Full hypothesis statement, scope boundaries, evidence criteria

## Phase 4: Evidence Collection

1. Monitor TaskList for completion
2. As investigators complete, collect their evidence reports
3. Track: "{completed}/{total} investigations complete"

## Phase 5: Arbitration

1. Compare findings across all investigators:
   - Which hypotheses were confirmed (high confidence)?
   - Which were falsified (contradicting evidence)?
   - Which are inconclusive (insufficient evidence)?

2. Rank confirmed hypotheses by:
   - Confidence level (High > Medium > Low)
   - Strength of causal chain
   - Amount of supporting evidence
   - Absence of contradicting evidence

3. Present root cause analysis:

   ```
   ## Debug Report: {error description}

   ### Root Cause (Most Likely)
   **Hypothesis**: {description}
   **Confidence**: {High/Medium/Low}
   **Evidence**: {summary with file:line citations}
   **Causal Chain**: {step-by-step from cause to symptom}

   ### Recommended Fix
   {specific fix with code changes}

   ### Other Hypotheses
   - {hypothesis 2}: {status} — {brief evidence summary}
   - {hypothesis 3}: {status} — {brief evidence summary}
   ```

## Phase 6: Cleanup

1. Send `shutdown_request` to all investigators
2. Call `TeamDelete` to remove team resources

© Seth Hobson · MIT · wshobson/agents

Similar slash commands

All slash commands for Agent setup: memory, context, orchestration →

From the same set342

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor