Bug Investigation and Fix

Systematic bug fixing with root cause analysis using Kaizen methodology to eliminate problems at their source.

For simple, obvious bugs (typos, single-line fixes), use Feature Development workflow.

When to Use

  • Bugs with unclear root cause requiring investigation

  • Recurring issues that need systematic analysis

  • Production incidents requiring post-mortem

  • Complex bugs spanning multiple components

Plugins needed for this workflow

Workflow

How It Works

1. Load issue context

Use the /git:analyze-issue command to load the bug report from GitHub and extract technical details.

After LLM completes, you will have a structured understanding of the bug symptoms, reproduction steps, affected areas, and any related issues or context from the discussion.

2. Trace root cause

Use the /kaizen:root-cause-tracing command to systematically trace the bug backward through the call stack.

After LLM completes, you will have identified where invalid data originates or where incorrect behavior starts. This traces from the symptom (e.g., wrong output) back to the source (e.g., missing validation in input handler).

3. Analyze with Five Whys

Use the /kaizen:why command to drill deeper into why the root cause exists in the first place.

After LLM completes, you will understand not just what went wrong, but why the codebase allowed it to happen. This reveals systemic issues like missing tests, unclear specifications, or architectural gaps that enabled the bug.

4. Implement fix

With a clear understanding of the root cause and its underlying reasons, implement a fix that addresses the fundamental issue.

After LLM completes, verify the fix addresses the actual root cause identified in steps 2-3, not just the surface symptoms. A proper fix should prevent the entire class of similar bugs, not just this specific instance.

5. Review fix

Use the /code-review:review-local-changes command to ensure the fix is correct and doesn't introduce new issues.

After LLM completes, address any findings from the multi-agent review. Pay special attention to Bug Hunter findings (new edge cases) and Test Coverage (ensuring the bug has regression tests).

6. Preserve learnings

Use the /reflexion:memorize command to capture insights from this bug investigation for future reference.

After LLM completes, your CLAUDE.md will be updated with learnings about this bug pattern, helping prevent similar issues in future development. This builds institutional knowledge about your codebase's pitfalls.

7. Commit with context

Use the /git:commit command to create a well-documented commit that links to the issue and explains the fix.

After LLM completes, your commit will follow conventional commit format with the bug fix type, proper scope, and reference to the issue (e.g., Fixes #123). This creates a searchable history for future debugging.

Alternative Analysis Methods

The Kaizen plugin offers additional analysis techniques for different scenarios:

For complex, multi-factor bugs

Use Fishbone (Cause-and-Effect) analysis to explore causes across six categories:

For comprehensive problem documentation

Use A3 analysis for a one-page problem summary with root cause and action plan:

For iterative experimentation

Use PDCA (Plan-Do-Check-Act) cycle when the fix requires testing hypotheses:

Last updated