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 ويثبّتها لك.
Use when the user says "ask grok", "get grok's take", "grok review", "have grok look at this", "delegate to grok", or any variation naming Grok/xAI as the perspective they want.
Use when starting any creative work - creating a feature, building a component, adding functionality, or changing designed behavior - before writing code or invoking any implementation skill. Small defect repairs and tweaks triage through razorback:fixing-small-issues first.
Use when a design question resists discussion — a state model with more edge cases than fit in your head, a UI the user keeps flip-flopping on because nobody can picture it, or behavior only knowable by running it — before writing a design doc or implementation plan for that question.
Use when the user says "ask claude", "fresh claude review", "second opinion from another claude", "have another claude look at this", "delegate to a fresh claude", or any variation naming Claude as the second perspective they want.
Use when the user says "ask codex", "get codex's take", "codex review", "have codex look at this", "delegate to codex", or any variation naming Codex/OpenAI as the perspective they want. Also use for a generic "second opinion from a different model" when no other model is named.
Use when planning or reviewing non-trivial code changes, refactoring architecture, evaluating module boundaries, repeated findings reveal coupling, tests are hard to write because interfaces are unclear, or the user asks for codebase design improvements, complexity reduction, deduplication, or cleanup of existing code.
استنادا إلى تصنيف SOC المهني
| 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:
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:
Use Miller for investigation:
inspect(target, depth=full) (the symbol at issue earns full)tracecontextFind the pattern before fixing:
Find Working Examples
searchcontextCompare Against References
Identify Differences
Understand Dependencies
inspect(target, depth=full)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
razorback:test-driven-development skill for writing proper failing testsImplement Single Fix
impact(target='<symbol being changed>') returns the impacted symbols plus the likely testsVerify Fix
If Fix Doesn't Work
If 3+ Fixes Failed: Question Architecture
Pattern indicating architectural problem:
STOP and question fundamentals:
In an approved autonomous run, route this through the blocker taxonomy: if a plan-consistent architecture fix exists, take it and log the decision; if the plan is contradicted or tests are unresolvable, stop as a real blocker. Outside an approved run, discuss the architecture before attempting more fixes.
This is NOT a failed hypothesis - this is a wrong architecture.
Every row below — whether it is your own thought or a redirection from the user — means the same thing: STOP. Return to Phase 1.
| Signal | 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" / "Quick fix for now, investigate later" | Systematic debugging is FASTER than guess-and-check thrashing. The "later" investigation never happens. |
| "Just try changing X and see if it works" / "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
| "It's probably X, let me fix that" / "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
| "Here are the main problems: [lists fixes without investigation]" — proposing solutions before tracing data flow | Fixes proposed before investigation are guesses wearing a diagnosis. |
| "Add multiple changes, run tests" / "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
| "Skip the test, I'll manually verify" / "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. |
| "Pattern says X but I'll adapt it differently" / "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read the reference completely. |
| "I don't fully understand but this might work" | Not understanding IS the finding. Investigate it, don't route around it. |
| "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question the pattern, don't fix again. |
| Each fix reveals a new problem in a different place | The coupling is the bug, not the symptom you just patched. |
| User asks "Is that not happening?" | You assumed without verifying. |
| User asks "Will it show us...?" | You should have added evidence gathering. |
| User says "Stop guessing" | You're proposing fixes without understanding. |
| User says "Ultra-think this" | Question fundamentals, not just symptoms. |
| User asks "We're stuck?" (frustrated) | Your approach isn't working. |
If 3+ fixes failed: the problem is structural, not local. Stop patching and question the architecture with razorback:architecture-quality.
| 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.
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: