Agent skill
dev-coding-debug
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/dev-coding-debug
SKILL.md
π 체κ³μ λλ²κΉ (Dev Coding Debug)
μ΄ μν¬νλ‘μ°λ obra/superpowersμ **"The Iron Law"**λ₯Ό μ€μν©λλ€. κ·Όλ³Έ μμΈ κ·λͺ
μμ΄λ μ λ μ½λλ₯Ό μμ νμ§ μμ΅λλ€.
1. μ΄κΈ°ν (Initialization)
- μμΉ νμΈ:
this documentλ₯Ό μ½κ³ Iron Lawλ₯Ό μκΈ°ν©λλ€. - μ¦μ μ μ: μ¬μ©μλ‘λΆν° μ νν μλ¬ λ©μμ§μ νμμ μ λ ₯λ°μ΅λλ€.
2. μ‘°μ¬ (Phase 1: Root Cause Investigation)
"μΆμΈ‘νμ§ λ§κ³ μ¦κ±°λ₯Ό μμ§νμΈμ."
- μλ¬ λΆμ: μ€ν νΈλ μ΄μ€μ μλ¬ μ½λλ₯Ό μ λ° λΆμν©λλ€.
- μ¬ν (Reproduction): λ²κ·Έλ₯Ό νμ€νκ² λ°μμν€λ μ΅μ λ¨μμ μ€ν¬λ¦½νΈλ₯Ό μμ±ν©λλ€. (νμ)
- κΈ°κΈ°/λ‘κ·Έ μΆκ° (Instrumentation): λ°μ΄ν°κ° μ€μΌλλ μ§μ μ μ°ΎκΈ° μν΄ λ‘κ·Έλ₯Ό μΆκ°νκ³ , λ°μ΄ν° νλ¦μ μμΆμ (Trace)ν©λλ€.
3. λΆμ (Phase 2: Pattern Analysis)
"μ μμ μΈ ν¨ν΄κ³Ό 무μμ΄ λ€λ₯Έκ°μ?"
- μ μ μ¬λ‘ μ°ΎκΈ°: νλ‘μ νΈ λ΄μμ μ λμνλ μ μ¬ν μ½λλ₯Ό μ°Ύμ΅λλ€.
- λΉκ΅ λΆμ: μ μ μ½λμ λ¬Έμ κ° μλ μ½λμ μ°¨μ΄μ μ ν μ€ ν μ€ λΉκ΅ν©λλ€.
- μ°¨μ΄μ λͺ©λ‘: μ¬μν΄ λ³΄μ΄λ μ°¨μ΄μ μ΄λΌλ λͺ¨λ λμ΄ν©λλ€.
4. κ°μ€ (Phase 3: Hypothesis & Testing)
"κ³Όνμ λ°©λ²λ‘ μ μ μ©νμΈμ."
- κ°μ€ μ립: "X λλ¬Έμ Yκ° λ°μνλ€"λ κ°μ€μ νλ μΈμλλ€.
- μ΅μ κ²μ¦: κ°μ€μ νμΈνκΈ° μν΄ λ³μ νλλ§ λ³κ²½νμ¬ ν μ€νΈν©λλ€. (μμ μ΄ μλ)
- λ°λ³΅: κ°μ€μ΄ νλ Έλ€λ©΄ λ³κ²½ μ¬νμ λλλ¦¬κ³ (Revert), μλ‘μ΄ κ°μ€μ μΈμλλ€. κΈ°μ‘΄ λ³κ²½ μμ λ§μΉ κΈμ§.
5. ν΄κ²° (Phase 4: Implementation)
"μ¦μμ΄ μλ μμΈμ κ³ μΉμΈμ."
- μ€ν¨ ν μ€νΈ (Red): μλ³λ μμΈμ νκ²μΌλ‘ νλ μ€ν¨ ν μ€νΈ μΌμ΄μ€λ₯Ό νμ ν©λλ€.
- λ¨μΌ μμ (Green): κ·Όλ³Έ μμΈμ μ κ±°νλ μ΅μνμ μ½λλ₯Ό μμ±ν©λλ€.
- κ²μ¦ (Verification): ν μ€νΈ ν΅κ³Ό λ° νκ· ν μ€νΈ(Regression Test) μν.
- μ 리 (Cleanup): λλ²κΉ μ© λ‘κ·Έμ μμ μ½λλ₯Ό κΉ¨λμ΄ μμ ν©λλ€.
6. μ’ λ£ (Completion)
- νκ³ : μ΄λ€ λΆλΆμ΄ κ·Όλ³Έ μμΈμ΄μλμ§ μ¬μ©μμκ² μ€λͺ νκ³ μ’ λ£ν©λλ€.
Standards & Rules
Systematic Debugging (Dev Coding Debug)
Core Principles (The Iron Law)
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.
If you haven't completed Phase 1 (Root Cause) and Phase 2 (Pattern Analysis), you cannot propose fixes. Symptom fixes are failure.
ποΈ The Four Phases
Phase 1: Root Cause Investigation
Goal: Understand WHAT and WHY.
- Read Errors: sticky to the error message. Don't skip stack traces.
- Reproduce: Can you trigger it reliably? If not, gather more data.
- Instrumentation: For multi-component systems, log data flow at boundaries.
- Trace: Follow the bad value backwards to its source (
root-cause-tracing).
Phase 2: Pattern Analysis
Goal: Find the standard before fixing.
- Find Working Examples: Locate similar code that works.
- Compare: Read reference implementations completely.
- Identify Differences: List every difference, however small.
Phase 3: Hypothesis and Testing
Goal: Scientific Method.
- Single Hypothesis: "I think X is the root cause because Y".
- Test Minimally: Change ONE variable at a time to test the hypothesis.
- Verify: If it didn't work, revert and form a NEW hypothesis. NO layering fixes.
Phase 4: Implementation
Goal: Fix the root cause, not the symptom.
- Failing Test: Create a minimal reproduction test case (Red).
- Single Fix: Address the identified root cause (Green).
- Verify: Ensure no regressions.
οΏ½οΈ Supporting Techniques
1. Root Cause Tracing ("Why did this happen?")
Don't just fix the bad value. Find where it came from.
- Technique: Ask "What called this with a bad value?" repeatedly until you find the source.
- Rule: Fix at the source, not at the symptom.
2. Defense-in-Depth ("Make it impossible")
Don't just validate at one place.
- Layer 1 (Entry): Reject invalid input at IDL/API boundary.
- Layer 2 (Logic): Ensure data makes sense for the operation.
- Layer 3 (Guard): Environment checks (e.g., test vs prod).
- Layer 4 (Debug): Logging for forensics.
3. Condition-Based Waiting (No sleep)
Never guess how long something takes.
- Bad:
sleep(50) - Good:
waitFor(() => condition) - Why: Flaky tests often come from arbitrary timeouts.
οΏ½π© Red Flags (STOP immediately)
- "Quick fix for now"
- "Just try changing X"
- "One more fix attempt" (Limit: 3 attempts. Then question Architecture.)
- Proposing solutions before tracing.
β Quality Standards
- Reproduction Script: Must exist before fixing.
- Log Cleanup: All temporary instrumentation removed.
- Safe YAML: Frontmatter descriptions quoted.
Checklist
- Phase 1: Did you identify the exact line/reason for failure?
- Phase 2: Did you compare with a working example?
- Phase 4: Is there a test case that failed before and passes now?
- Cleanup: Are all
print/console.logremoved?
Didn't find tool you were looking for?