원클릭으로
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
MUST USE for ANY git operations. Enforces GPG-signed commits (-S flag always required; stop and ask user to unlock GPG agent on failure) and 50/72 commit message rule. Triggers: 'commit', 'rebase', 'squash', 'who wrote', 'when was X added', 'find the commit that'.
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Use when executing implementation plans with independent tasks in the current session
| name | systematic-debugging |
| description | Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes |
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.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
If you haven't completed Phase 1, you cannot propose fixes.
Use for ANY technical issue:
Use this ESPECIALLY when:
Don't skip when:
For straightforward bugs, use this abbreviated 5-step protocol:
Reproduce the issue consistently
Isolate the minimal failing case
Check error messages and stack traces carefully
Search codebase for similar working patterns
Consult documentation before guessing
When this protocol isn't enough: Use the full Four Phases process below for complex multi-component issues.
You MUST complete each phase before proceeding to the next.
BEFORE attempting ANY fix:
Read Error Messages Carefully
Reproduce Consistently
Check Recent Changes
Gather Evidence in Multi-Component Systems
WHEN system has multiple components (CI → build → signing, API → service → database):
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
Example (multi-layer system):
# Layer 1: Workflow
echo "=== Secrets available in workflow: ==="
echo "IDENTITY: ${IDENTITY:+SET}${IDENTITY:-UNSET}"
# Layer 2: Build script
echo "=== Env vars in build script: ==="
env | grep IDENTITY || echo "IDENTITY not in environment"
# Layer 3: Signing script
echo "=== Keychain state: ==="
security list-keychains
security find-identity -v
# Layer 4: Actual signing
codesign --sign "$IDENTITY" --verbose=4 "$APP"
This reveals: Which layer fails (secrets → workflow ✓, workflow → build ✗)
Trace Data Flow
WHEN error is deep in call stack:
See root-cause-tracing.md in this directory for the complete backward tracing technique.
Quick version:
Find the pattern before fixing:
Find Working Examples
Compare Against References
Identify Differences
Understand Dependencies
Scientific method:
Form Single Hypothesis
Test Minimally
Verify Before Continuing
When You Don't Know
Fix the root cause, not the symptom:
Create Failing Test Case
test-driven-development skill for writing proper failing testsImplement Single Fix
Verify Fix
If Fix Doesn't Work
If 3+ Fixes Failed: Question Architecture
Pattern indicating architectural problem:
STOP and question fundamentals:
Discuss with your human partner before attempting more fixes
This is NOT a failed hypothesis - this is a wrong architecture.
If you catch yourself thinking:
ALL of these mean: STOP. Return to Phase 1.
If 3+ fixes failed: Question the architecture (see Phase 4.5)
Watch for these redirections:
When you see these: STOP. Return to Phase 1.
| 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. |
| "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. |
| "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. |
| Phase | Key Activities | Success Criteria |
|---|---|---|
| 1. Root Cause | Read errors, reproduce, check changes, gather evidence | Understand WHAT and WHY |
| 2. Pattern | Find working examples, compare | Identify differences |
| 3. Hypothesis | Form theory, test minimally | Confirmed or new hypothesis |
| 4. Implementation | Create test, fix, verify | Bug resolved, tests pass |
If systematic investigation reveals issue is truly environmental, timing-dependent, or external:
But: 95% of "no root cause" cases are incomplete investigation.
Git provides safe recovery mechanisms for when changes go wrong:
Always use git diff to review all changes:
# See all unstaged changes
git diff
# See staged changes
git diff --staged
# Compare specific file
git diff path/to/file
Before committing:
For uncommitted changes:
# Revert specific file (Git 2.23+)
git restore <file>
# Revert specific file (older Git)
git checkout -- <file>
# Discard all unstaged changes (use cautiously)
git restore .
For committed changes:
# Create new commit that undoes changes (preserves history - PREFERRED)
git revert <commit>
# Undo commit but keep changes staged (use cautiously)
git reset --soft HEAD~1
# Undo commit and discard changes (DANGEROUS - rarely needed)
git reset --hard HEAD~1
Choosing the right approach:
| Situation | Command | Why |
|---|---|---|
| Wrong code, not committed | git restore <file> | Safe, only affects working directory |
| Wrong commit, not pushed | git reset --soft HEAD~1 | Keeps changes, lets you recommit |
| Wrong commit, already pushed | git revert <commit> | Preserves history, safe for shared branches |
| Multiple bad commits | git revert <commit1> <commit2>... | Reverts each commit individually |
Key principle: git revert preserves history (safe for shared branches). git reset rewrites history (use only on unpushed commits).
Don't thrash endlessly. Escalate when:
| Situation | Escalation Trigger | Action |
|---|---|---|
| Repeated failures | After 2+ failed attempts at same problem | Stop, document what you tried, ask human |
| Ambiguous requirements | Requirements contradict or unclear | Ask for clarification before implementing |
| Multiple valid approaches | Significant trade-offs between approaches | Present options with pros/cons, ask user to choose |
| Unfamiliar domain | Don't understand technology stack or patterns | Research first, then ask if still unclear |
| Breaking changes | Fix requires changing public API or breaking compatibility | Discuss impact before implementing |
When asking:
Don't ask for help:
Remember: Asking for help after systematic investigation is strength, not weakness. Thrashing without asking IS weakness.
These techniques are part of systematic debugging and available in this directory:
root-cause-tracing.md - Trace bugs backward through call stack to find original triggerdefense-in-depth.md - Add validation at multiple layers after finding root causecondition-based-waiting.md - Replace arbitrary timeouts with condition pollingRelated skills:
From debugging sessions: