From nextc-core
Evidence-driven bug investigation and fix pipeline. Use when something is broken, not working, or the root cause is ambiguous. Hypothesizes, investigates with parallel agents, fixes, reviews, and updates docs.
How this skill is triggered — by the user, by Claude, or both
Slash command
/nextc-core:bug-fixThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Evidence-driven bug investigation pipeline. Generates competing hypotheses,
Evidence-driven bug investigation pipeline. Generates competing hypotheses,
gathers evidence in parallel, runs a rebuttal round, implements the minimal fix,
then runs through review, cleanup, and documentation — a full lifecycle like
/feature-dev but optimized for diagnosis-first bug work.
Inspired by scientific method: observe, hypothesize, test, conclude.
Assess if the bug report has enough detail to investigate.
Passes (has concrete signals):
Fails (too vague to investigate):
On failure: Ask targeted clarifying questions via AskUserQuestion:
Do NOT invoke /clarify for bugs — bugs need targeted diagnostic questions,
not a full Socratic interview. Ask 1-3 focused questions, then proceed.
{{ARGUMENTS}} and clarifying answersgit log --oneline -20 on relevant paths)docs/tasks.md for known bugs section,
docs/spec/ for the feature's expected behaviorPresent the observation summary to the user for confirmation before proceeding.
Generate 3 deliberately different hypotheses. Do NOT generate 3 variations of the same idea.
Default hypothesis lanes (use unless the bug strongly suggests a different partition):
| Lane | Focus | Example |
|---|---|---|
| H1: Code-path / implementation | Logic error, wrong condition, missing case, state mutation, race condition | "The provider doesn't reset state when navigating back, causing stale data" |
| H2: Data / config / environment | Wrong data shape, missing field, config mismatch, env-specific behavior | "The Supabase RLS policy blocks the query for non-owner users" |
| H3: Assumption / integration mismatch | API contract changed, version mismatch, timing assumption wrong | "The widget rebuilds before the async operation completes, reading null" |
For each hypothesis, state:
Spawn 3 Explore agents in parallel (model: haiku, one per hypothesis lane). Each agent:
Each agent returns a structured report:
## Lane: {H1/H2/H3}
### Hypothesis
{one sentence}
### Evidence For
- {evidence} — strength: {strong/moderate/weak} — source: {file:line / log / config}
### Evidence Against
- {evidence} — strength: {strong/moderate/weak}
### Critical Unknown
{what's missing}
### Best Discriminating Probe
{specific action to confirm or kill this hypothesis}
### Confidence: {high / medium / low}
After all 3 agents return:
Present the synthesis:
## Bug Investigation Summary
### Observation
{what happened vs what was expected}
### Ranked Hypotheses
| Rank | Hypothesis | Confidence | Evidence Strength | Key Evidence |
|------|------------|------------|-------------------|--------------|
| 1 | ... | High | Strong | file:line shows... |
| 2 | ... | Medium | Moderate | ... |
| 3 | ... | Low | Weak | ... |
### Rebuttal Round
- Best rebuttal to leader: {argument}
- Leader's response: {evidence-backed answer}
- Outcome: {leader held / leader weakened / re-ranked}
### Root Cause (Most Likely)
{clear statement of the root cause with evidence citations}
### Critical Unknown (if any)
{what would confirm this with certainty}
Ask the user: "This is my diagnosis. How should I proceed?"
Options:
Once the user approves (or if confidence is high and the fix is low-risk):
flutter analyze or project equivalent — must be zero errorsSpawn a code-reviewer agent (use everything-claude-code:code-reviewer):
Handle review results:
For fixes touching auth, payments, or user data, also spawn
everything-claude-code:security-reviewer in parallel.
If the fix touched 3+ files or introduced helper functions:
Invoke /cleanup on the files changed during this fix:
/cleanup {list of files changed}
After cleanup:
Skip cleanup if the fix was a 1-2 line change in a single file — cleanup overhead isn't justified for surgical fixes.
Spawn doc-keeper agent in the background to update:
docs/tasks.md — remove from known bugs section (or add if newly discovered)docs/spec/{feature}.md — update if the fix changes documented behaviordocs/changelog.md — add bug fix entrydocs/qc/{feature}.md — add regression test case for the fixed bugCLAUDE.md — update only if the fix changes architecture or project statusPresent the final report:
## Bug Fix Report
### Root Cause
{one-sentence summary}
### Evidence
{key evidence that confirmed the diagnosis — cite file:line}
### Fix Applied
| File | Change |
|------|--------|
| {file:line} | {what changed} |
### Verification
- Analyzer: passed (0 errors)
- Build: passed
- Symptom check: {resolved / needs manual verification}
### Review
- Code review: {passed / issues fixed}
- Security review: {passed / N/A}
### Hypotheses Eliminated
| Hypothesis | Why Eliminated |
|------------|----------------|
| {H2} | {contradicted by evidence X} |
| {H3} | {evidence insufficient, leader explains all symptoms} |
### Remaining Risk (if any)
{anything the fix doesn't cover, edge cases to watch}
┌────────────────────────────────────────────────────────────┐
│ Gate 0: Clarity Check │
│ Too vague? → ask 1-3 targeted questions │
└──────────────────────┬─────────────────────────────────────┘
│
┌──────────────────────▼─────────────────────────────────────┐
│ Phase 1: Observe │
│ Restate symptom, gather codebase context, check docs │
└──────────────────────┬─────────────────────────────────────┘
│
┌──────────────────────▼─────────────────────────────────────┐
│ Phase 2: Hypothesize │
│ 3 deliberately different hypotheses │
└──────────────────────┬─────────────────────────────────────┘
│
┌──────────────────────▼─────────────────────────────────────┐
│ Phase 3: Investigate (Parallel) │
│ 3 Explore agents — evidence FOR and AGAINST each lane │
└──────────────────────┬─────────────────────────────────────┘
│
┌──────────────────────▼─────────────────────────────────────┐
│ Phase 4: Synthesize & Rebuttal │
│ Rank → rebuttal round → user approves diagnosis │
└──────────────────────┬─────────────────────────────────────┘
│
┌────────▼─────────┐
│ Phase 5: Fix │
│ Minimal change │
│ Verify (3 max) │
└────────┬─────────┘
│
┌────────▼─────────┐
│ Phase 6: Review │
│ Code reviewer │
│ Security (opt) │
└────────┬─────────┘
│
┌────────▼─────────┐
│ Phase 7: Cleanup │
│ If 3+ files │
│ Re-verify after│
└────────┬─────────┘
│
┌────────▼─────────┐
│ Phase 8: Docs │
│ doc-keeper (bg)│
└────────┬─────────┘
│
┌────────▼─────────┐
│ Phase 9: Report │
└──────────────────┘
no-auto-testing rule — verify via analyzer and manual checks, not by writing tests| Tier | Type | Example |
|---|---|---|
| 1 (strongest) | Direct reproduction | "Reproduced: tapping Back on quest detail shows stale data every time" |
| 2 | Primary source artifact | "quest_feed_provider.dart:142 — state not cleared in dispose()" |
| 3 | Multiple sources converging | "Both the provider and the repository show the same missing null check" |
| 4 | Single-source inference | "The widget tree rebuilds suggest the state is stale" |
| 5 | Circumstantial | "Similar bug was fixed in tale_provider last month" |
| 6 (weakest) | Speculation | "Might be a timing issue" |
Explicitly down-rank hypotheses that depend on tier 5-6 evidence when stronger contradictory evidence exists.
| Phase | Skill / Agent | Model | When |
|---|---|---|---|
| Phase 1 | Explore agent | haiku | Gather codebase context |
| Phase 3 | Explore agents (parallel) | haiku | One per hypothesis lane — evidence gathering |
| Phase 6 | everything-claude-code:code-reviewer | sonnet | Always |
| Phase 6 | everything-claude-code:security-reviewer | sonnet | Auth/payments/user data |
| Phase 7 | /cleanup skill | — | Fix touched 3+ files |
| Phase 8 | doc-keeper agent | haiku | Always (background) |
Task: {{ARGUMENTS}}
npx claudepluginhub nextc/nextc-claude --plugin nextc-coreRoot cause based one-shot bug fix. Runs a full investigation pipeline: debugger diagnosis, gap analysis, requirements generation, execution, and verification. Includes QA suggestions after successful fix.
Enforces a structured bug-fix workflow: reproduce, isolate, apply smallest fix, and verify. Helps investigate errors, debug crashes, and make failing tests pass.