kimchi:systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior — before proposing fixes. Enforces 4-phase root cause analysis.

7 stars

Best use case

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

Use when encountering any bug, test failure, or unexpected behavior — before proposing fixes. Enforces 4-phase root cause analysis.

Teams using kimchi:systematic-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/systematic-debugging/SKILL.md --create-dirs "https://raw.githubusercontent.com/Tromml/kimchi/main/plugins/kimchi/skills/systematic-debugging/SKILL.md"

Manual Installation

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

How kimchi:systematic-debugging Compares

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

Frequently Asked Questions

What does this skill do?

Use when encountering any bug, test failure, or unexpected behavior — before proposing fixes. Enforces 4-phase 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

# Systematic Debugging

## Overview

Random fixes waste time and create new bugs. Quick patches mask underlying issues.

**Core principle:** ALWAYS find root cause before attempting fixes. Symptom fixes are failure.

**Violating the letter of this process is violating the spirit of debugging.**

## When This Applies

Whenever something isn't working as expected. This is NOT optional.

Use for ANY technical issue:
- Test failures
- Bugs in production
- Unexpected behavior
- Performance problems
- Build failures
- Integration issues

**Use this ESPECIALLY when:**
- Under time pressure (emergencies make guessing tempting)
- "Just one quick fix" seems obvious
- You've already tried multiple fixes
- You don't fully understand the issue

**Don't skip when:**
- Issue seems simple (simple bugs have root causes too)
- You're in a hurry (rushing guarantees rework)

## The Iron Law

```
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
```

If you haven't completed Phase 1, you cannot propose fixes.

**FORBIDDEN:** Random changes hoping something works.

## The Four Phases

You MUST complete each phase before proceeding to the next.

### Phase 1: OBSERVE

Gather evidence before forming theories.

1. **Reproduce the issue**
   - What exact steps trigger it?
   - Is it consistent or intermittent?
   - What's the exact error message?

2. **Collect context**
   - What was the input?
   - What was the expected output?
   - What was the actual output?
   - What changed recently?

3. **Read error messages carefully**
   - Don't skip past errors or warnings
   - Read stack traces completely
   - Note line numbers, file paths, error codes

4. **Document observations**
   ```
   Issue: Upload fails with "AccessDenied"
   Reproduces: Every time with files > 1MB
   Works: Files < 1MB upload successfully
   Recent changes: Updated AWS SDK yesterday
   ```

5. **Gather evidence in multi-component systems**

   BEFORE proposing fixes, add diagnostic instrumentation:
   ```
   For EACH component boundary:
     - Log what data enters component
     - Log what data exits component
     - Verify environment/config propagation
     - Check state at each layer

   Run once to gather evidence showing WHERE it breaks
   THEN analyze evidence to identify failing component
   THEN investigate that specific component
   ```

### Phase 2: HYPOTHESIZE

Form testable theories based on evidence.

1. **List possible causes**
   - Each hypothesis must be testable
   - Rank by likelihood based on evidence
   - Include "obvious" causes (they're often right)

2. **Document hypotheses**
   ```
   H1: S3 bucket policy changed (likelihood: low - no recent changes)
   H2: AWS SDK breaking change (likelihood: high - updated yesterday)
   H3: File size validation wrong (likelihood: medium - size-related)
   ```

### Phase 3: TEST

Validate or eliminate hypotheses systematically.

1. **Test highest likelihood first**
2. **One variable at a time**
3. **Document results**

```
Testing H2: AWS SDK breaking change
Action: Downgrade AWS SDK to previous version
Result: Upload works
Conclusion: H2 confirmed - SDK update introduced issue
```

4. **When you don't know**
   - Say "I don't understand X"
   - Don't pretend to know
   - Ask for help
   - Research more

### Phase 4: FIX

Address the ROOT CAUSE, not symptoms.

1. **Create failing test case**
   - Simplest possible reproduction
   - Automated test if possible
   - MUST have before fixing
   - Use the `kimchi:tdd` skill for writing proper failing tests

2. **Implement single fix**
   - Address the root cause identified
   - ONE change at a time
   - No "while I'm here" improvements
   - No bundled refactoring

3. **Verify the fix**
   - Original issue no longer reproduces
   - No new issues introduced
   - Tests pass

4. **If fix doesn't work**
   - STOP
   - Count: How many fixes have you tried?
   - If < 3: Return to Phase 1, re-analyze with new information
   - **If >= 3: STOP and question the architecture (step 5)**
   - DON'T attempt Fix #4 without architectural discussion

5. **If 3+ fixes failed: question architecture**

   Pattern indicating architectural problem:
   - Each fix reveals new shared state/coupling/problem in different place
   - Fixes require "massive refactoring" to implement
   - Each fix creates new symptoms elsewhere

   **STOP and question fundamentals:**
   - Is this pattern fundamentally sound?
   - Are we "sticking with it through sheer inertia"?
   - Should we refactor architecture vs. continue fixing symptoms?

   **Discuss with your human partner before attempting more fixes.**

## Common Rationalizations

| Excuse | Reality |
|--------|---------|
| "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. |
| "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
| "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
| "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. |
| "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
| "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
| "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question pattern, don't fix again. |

## Red Flags — STOP and Follow Process

If you catch yourself thinking:
- "Quick fix for now, investigate later"
- "Just try changing X and see if it works"
- "Add multiple changes, run tests"
- "Skip the test, I'll manually verify"
- "It's probably X, let me fix that"
- "I don't fully understand but this might work"
- Proposing solutions before tracing data flow
- **"One more fix attempt" (when already tried 2+)**
- **Each fix reveals new problem in different place**

**ALL of these mean: STOP. Return to Phase 1.**

**If 3+ fixes failed:** Question the architecture.

## Verification

- [ ] Issue was reproduced and documented
- [ ] Multiple hypotheses were considered
- [ ] Root cause was identified (not just symptoms)
- [ ] Fix addresses root cause
- [ ] Test added to prevent recurrence

## Quick Reference

| Phase | Key Activities | Success Criteria |
|-------|---------------|------------------|
| **1. OBSERVE** | Read errors, reproduce, check changes, gather evidence | Understand WHAT and WHY |
| **2. HYPOTHESIZE** | List causes, rank likelihood | Testable theories formed |
| **3. TEST** | Test highest likelihood first, one variable at a time | Confirmed or new hypothesis |
| **4. FIX** | Create test, fix root cause, verify | Bug resolved, tests pass |

Related Skills

kimchi:verification-before-completion

7
from Tromml/kimchi

Use when about to claim work is complete, fixed, or passing — before committing or creating PRs. Evidence before assertions, always.

kimchi:validate

7
from Tromml/kimchi

This command should be used to validate bead YAML files for standalone executability. Runs 4 validators (context completeness, deliverables clarity, test specification, isolation) and enriches failing beads. Eighth stage of the Kimchi planning pipeline.

kimchi:tdd

7
from Tromml/kimchi

Use when implementing any feature, bugfix, or behavior change — before writing implementation code. Enforces RED-GREEN-REFACTOR cycle.

kimchi:status

7
from Tromml/kimchi

This command should be used to check the current state of the Kimchi planning pipeline, including which stages have completed, what artifacts exist, and bead validation status.

kimchi:simplicity-enforcement

7
from Tromml/kimchi

Use when designing solutions, implementing features, or considering abstractions. Enforces YAGNI, minimal code, and preferring duplication over wrong abstraction.

kimchi:review

7
from Tromml/kimchi

This command should be used to run multi-persona review of the implementation plan. Five specialized personas critique the plan for scope creep, complexity, premature optimization, and test coverage. Fifth stage of the Kimchi planning pipeline. Produces .kimchi/PLAN-REVIEWED.md.

kimchi:reset

7
from Tromml/kimchi

This command should be used to clear the Kimchi working directory (.kimchi/) and start fresh. Preserves .beads/ directory. Use when starting a new planning session or recovering from a bad state.

kimchi:research

7
from Tromml/kimchi

This command should be used to investigate codebase patterns, frameworks, and existing implementations before planning. Third stage of the Kimchi planning pipeline. Produces .kimchi/RESEARCH.md.

kimchi:requirements

7
from Tromml/kimchi

This command should be used to extract and categorize requirements from CONTEXT.md into v1 (must have), v2 (next iteration), and out of scope. Second stage of the Kimchi planning pipeline. Produces .kimchi/REQUIREMENTS.md.

kimchi:refine

7
from Tromml/kimchi

This command should be used to iteratively improve the plan until quality threshold is reached or diminishing returns detected. Sixth stage of the Kimchi planning pipeline. Produces .kimchi/PLAN-DRAFT.md.

kimchi:plan

7
from Tromml/kimchi

This command should be used to run the Kimchi planning pipeline through refinement, transforming a vague idea into a draft plan ready for cross-model analysis. Orchestrates 6 stages: clarify, requirements, research, generate, review, refine. Use --full-auto to also run beads + validate after manual revise/synthesize.

kimchi:plan-synthesize

7
from Tromml/kimchi

This command should be used to synthesize multiple cross-model plan revisions into a superior hybrid plan. Eighth stage of the Kimchi planning pipeline. Reads PLAN-REVISED-*.md files and outputs PLAN-SYNTHESIZED.md — the TRUE final plan.