AgentSkillsCN

bugfix

及时修复各类Bug、错误、异常以及意外行为。当您需要进行调试、修正错误、处理崩溃问题,或当用户提及Bug、错误、程序中断、功能失效、崩溃、异常、500错误或应用错误时,此技能将为您保驾护航。同时运用“5个为什么”根因分析法,深入挖掘问题根源。

SKILL.md
--- frontmatter
name: bugfix
description: Fix bugs, errors, exceptions, and unexpected behavior. Use when debugging, fixing errors, handling crashes, or when user mentions bug, error, broken, not working, crash, exception, 500 error, Application error. Uses 5 Whys Root Cause Analysis.

Bug Fix Protocol

Principle: FIX ROOT CAUSE, NOT SYMPTOM.

Workflow

  1. STOP -- Pause at the error
  2. CAPTURE -- Record all error information
  3. ANALYZE -- 5 Whys to find root cause
  4. FIX -- Minimal patch for root cause
  5. VERIFY -- Confirm the fix works
  6. PREVENT -- Add protection against recurrence

Error Capture Template

markdown
## ERROR CAPTURED
**Command:** [what caused the error]
**Error Output:**
[FULL output, don't truncate]
**Context:** File: [file], Action: [what I was doing]

Root Cause Analysis (5 Whys)

Use _base-5wh.mdc template. Dig at least 5 levels:

markdown
**Why 1:** [surface error]
  -> **Why 2:** [deeper cause]
    -> **Why 3:** [even deeper]
      -> **Why 4:** [structural issue]
        -> **Why 5:** [root cause]

ROOT CAUSE: [the real problem]
FIX: [minimal change to address root cause]

Common Error Patterns

Error TypeLikely Root CauseFix
ModuleNotFoundErrorMissing packagenpm install / pip install
TypeErrorWrong data typeCheck actual types
500 ErrorUnhandled exceptionAdd error handling
Connection refusedService not runningStart/restart service
401 UnauthorizedMissing authCheck Basic Auth + Session

Anti-patterns (FORBIDDEN)

  • try/catch that silences errors without fixing root cause
  • Workarounds without documentation
  • Multiple fixes at once (one change at a time!)
  • Ignoring recurring errors

Success Criteria

  • The same command that caused the error now works
  • Root cause is addressed, not just the symptom
  • No new errors introduced