원클릭으로
debug
Systematic four-phase debugging (reproduce, isolate, root-cause, fix)
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Systematic four-phase debugging (reproduce, isolate, root-cause, fix)
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
Initialize a Megazord project with configuration and planning structure
Socratic brainstorming to explore approaches before implementation
Execute the current phase plan (subagent or Agent Teams mode)
Show all available Megazord skills with descriptions and usage examples
Complete milestone lifecycle -- audit, archive, deferred items, and next version preparation
Plan a phase into executable tasks with dependencies and waves
SOC 직업 분류 기준
| name | debug |
| description | Systematic four-phase debugging (reproduce, isolate, root-cause, fix) |
| disable-model-invocation | false |
Guide systematic four-phase debugging with observable state transitions. Each phase has a distinct banner so the user always knows which stage the debugging process is in. Adapts techniques based on issue type (runtime error, build failure, test failure, performance, logic bug).
Reference @skills/init/design-system.md for visual output formatting.
Reference @skills/shared/terminology.md for official term definitions.
Output the stage banner:
+===============================================+
| MEGAZORD > DEBUG |
+===============================================+
Parse the user's description from the text after /mz:debug. If the description is insufficient (vague, missing key details), ask targeted clarifying questions:
If a file path, error message, stack trace, or test name is provided, use it as the starting point.
Issue Type Detection:
Categorize the issue to adapt techniques within each phase:
| Type | Signals | Adapted Approach |
|---|---|---|
| Runtime error | Stack trace, exception, crash, unhandled rejection | Trace from stack, check inputs at each frame |
| Build failure | Compile error, bundler error, type error at build time | Check imports, types, config, dependency versions |
| Test failure | Test name, assertion error, expected vs received | Run specific test in isolation, check assertion values |
| Performance | Slow, timeout, memory leak, high CPU | Profile, measure baselines, compare before/after |
| Logic bug | Wrong output, incorrect behavior, data corruption | Add logging, trace data flow, check conditionals |
Display the detected type:
> Issue type: {type}
Read quality.debug from .planning/megazord.config.json (if config exists). If config does not exist, default to "systematic".
If mode is "systematic" (default):
If mode is "quick":
> Quick Debug: {issue type}
Display the active mode:
> Debug mode: {systematic | quick}
Note: /mz:debug always works when invoked manually, regardless of any config toggle. The quality.debug setting only controls the approach depth (systematic vs quick), not whether debugging is available.
Display phase banner:
+-----------------------------------------------+
| REPRODUCE: Establishing reliable reproduction |
+-----------------------------------------------+
Goal: Confirm the issue exists and establish reliable reproduction steps.
Run the failing test or command to confirm the issue:
{test command or reproduction command}
If not immediately reproducible: ask for more context, try variations, check environment differences.
Document reproduction steps clearly:
> Reproduction steps:
1. {step}
2. {step}
Expected: {expected behavior}
Actual: {actual behavior}
Exit criteria: Issue reliably reproduced with clear steps.
Shortcut: If the issue is inherently reproducible (build error, static analysis finding, compile error), note this and move directly to ISOLATE without ceremony:
> Reproduction: Inherent (build error reproduces on every build)
Display phase banner:
+-----------------------------------------------+
| ISOLATE: Narrowing down the failing component |
+-----------------------------------------------+
Goal: Narrow the scope from "something is broken" to "this specific component is broken."
Display the isolated component:
> Isolated to: {component/file/function}
Shortcut: If the error includes an obvious stack trace pointing to a specific location, skip extensive binary search and proceed directly to that location.
Display phase banner:
+-----------------------------------------------+
| ROOT CAUSE: Identifying why it fails |
+-----------------------------------------------+
Goal: Understand not just WHERE it fails, but WHY it fails. Causation, not correlation.
Apply Issue Tree + Ishikawa MECE decomposition when the issue is NOT trivially obvious. Use this decision logic:
Full decomposition (apply Issue Tree + Ishikawa):
Skip formal decomposition:
When skipping, display: > Issue Tree: Skipped (root cause obvious from {error type/stack trace})
When applying, display: > Issue Tree: Applying MECE decomposition with Ishikawa categories
This is the CORTEX-04 implementation: structured root-cause analysis using Issue Tree (MECE decomposition) and Ishikawa cause categories adapted for software.
Before investigating, structure the problem as an Issue Tree — a MECE (Mutually Exclusive, Collectively Exhaustive) breakdown of possible causes:
<issue-tree>
PROBLEM: [root problem statement]
├── {category 1}: [hypothesis]
│ ├── {sub-cause}: [evidence for/against]
│ └── {sub-cause}: [evidence for/against]
├── {category 2}: [hypothesis]
│ └── {sub-cause}: [evidence for/against]
└── {category 3}: [hypothesis]
└── {sub-cause}: [evidence for/against]
LIKELY-ROOT: [{category}/{sub-cause}] — {evidence}
</issue-tree>
Use these software-adapted cause categories to structure the Issue Tree branches:
| Category | What to check |
|---|---|
| Code | Logic errors, type mismatches, edge cases, off-by-one, null handling |
| Data | Schema mismatch, null/undefined values, encoding issues, malformed input |
| Environment | Node/runtime versions, OS differences, config mismatches, env vars |
| Dependencies | Version conflicts, breaking changes, missing packages, peer deps |
| Timing | Race conditions, async ordering, timeouts, event loop blocking |
| State | Stale cache, leaked state, initialization order, shared mutable state |
Not every category applies to every bug. Select 2-4 categories most relevant to the issue type detected in Step 2.
CORTEX boundary: When /mz:debug is invoked manually, the debug skill owns the analysis — CORTEX classification from the executor is NOT applied separately. The debug skill's own systematic methodology (REPRODUCE -> ISOLATE -> ROOT CAUSE -> FIX) governs. When debugging happens during execution (executor encounters a bug and applies auto-fix deviation rules), the executor's CORTEX classification governs instead.
Display the root cause:
> Root cause: {explanation}
> Evidence: {what proves this is the cause, not just a correlation}
> Category: {Ishikawa category}
Direct tone: "This fails because X" -- never "This might be related to X" or "This could possibly be caused by X." If the root cause is uncertain, say so explicitly: "Root cause is uncertain. Two candidates: {A} or {B}. Next step: {how to distinguish}."
Display phase banner:
+-----------------------------------------------+
| FIX: Implementing and verifying the fix |
+-----------------------------------------------+
Goal: Implement the minimal fix that addresses the root cause, verify it works, and confirm no regressions.
Design the minimal fix: smallest change that addresses the root cause. Avoid fixing adjacent issues -- scope the fix to THIS root cause only.
Check TDD mode: Read .planning/megazord.config.json for quality.tdd:
Verify the fix:
bun test
Commit the fix (if within an execution context or if the user requests):
git add {fixed_files}
git commit -m "fix: {concise description of what was fixed and why}"
Exit criteria: Fix verified, reproduction passes, no regressions.
Display the debug summary:
+===============================================+
| Debug Complete |
+-----------------------------------------------+
| Issue: {brief description} |
| Type: {issue type} |
| Root cause: {one-line root cause} |
| Fix: {one-line fix description} |
| Regressions: None |
+===============================================+
Display the Next Up block:
===============================================
> Next Up
**Issue resolved.** Continue with your current task.
===============================================
quality.tdd is true in config.| Error | Step | Action |
|---|---|---|
| No issue description provided | Step 2 | Ask the user to describe the issue. Do not proceed without context. |
| Issue not reproducible | Step 3 | Ask for more context (environment, timing, inputs). If still not reproducible after 3 attempts, document as intermittent and proceed to ISOLATE with best-available reproduction. |
| Multiple root causes found | Step 5 | Document all candidates, prioritize the most likely. Fix the primary root cause first. Note secondary causes for follow-up. |
| Fix introduces regressions | Step 6 | Revert the fix. Re-analyze the root cause -- the original analysis may be incomplete. Try a different fix approach. |
| Config file missing | Step 6 | Assume TDD is not enabled. Implement fix directly. |
/mz:go execution, the fix should follow the executor's commit conventions.