AgentSkillsCN

systematic-debugging

寻找并修复复杂Bug根源的严谨流程。当处理崩溃、竞态条件或间歇性问题时,可使用此功能。

SKILL.md
--- frontmatter
name: systematic-debugging
description: A rigorous process for finding and fixing root causes of complex bugs. Use when dealing with crashes, race conditions, or intermittent issues.

Systematic Debugging

"Random fixes waste time. Find the root cause first."

1. Investigation Phase

  • Reproduce: Find the exact steps to trigger the bug.
  • Isolate: Remove variables until you find the minimum code that fails.
  • Trace: Use logs or debugger to follow the data flow.

2. Pattern Analysis

  • Context: When does it happen? (e.g., "Only on Android," "Only after second scan").
  • State: What is the application state (Redux/Zustand/Context) at the moment of failure?
  • Logs: Check both client and server logs for error signatures.

3. Hypothesis & Testing

  • Formulate: "I think X is happening because of Y."
  • Test: Change one thing to verify the hypothesis.
  • Verify: Did the change fix the root cause or just the symptom?

4. Fix & Prevent

  • Implement: Apply the clean, permanent fix.
  • Guard: Add validation, types, or tests to prevent regression.
  • Cleanup: Remove debug logs and temporary code.