AgentSkillsCN

debug-code

通过分析错误、追踪执行流程、定位根本原因并提出修复建议,对代码问题进行调试。适用于用户说出“这个不工作”、“我遇到了错误”、“为什么这里会出问题?”或粘贴错误信息时使用。

SKILL.md
--- frontmatter
name: debug-code
description: Debugs code issues by analyzing errors, tracing execution flow, identifying root causes, and suggesting fixes. Use when the user says "this isn't working", "I'm getting an error", "why is this broken?", or pastes an error message.

When debugging code:

  1. Understand the symptom: What error message or unexpected behavior is occurring?
  2. Read the relevant code: Trace the execution path from entry point to the failure
  3. Identify the root cause: Pinpoint the exact line(s) causing the problem
  4. Draw a diagram: Use ASCII art to show what's happening vs what should happen
  5. Provide the fix: Show the corrected code
  6. Explain why: Teach the user what went wrong so they learn from it
  7. Check for related issues: Look for similar patterns elsewhere in the codebase that might have the same bug