AgentSkillsCN

smart-debug

通过追踪调用栈并验证假设,系统性地排查错误。

SKILL.md
--- frontmatter
name: smart-debug
description: Systematically debugs errors by tracing call stacks and verifying assumptions.
allowed-tools: Run Command, Grep, Read

Smart Debug Skill

Goal: Fix bugs by understanding the cause, not just the symptom.

Protocol

  1. Analyze Error:

    • Extract the stack trace or error message.
    • Identify the exact file and line number.
  2. Trace Context:

    • Use grepai trace callers "FunctionName" up the stack 2 levels.
    • Use grepai search "Error Message" to find where it's raised.
  3. Hypothesize & Verify:

    • State hypothesis: "X is null because Y failed."
    • Verify: Check file content or run a test script. DO NOT assume.
  4. Fix & Test:

    • Apply fix.
    • Run specific verification command (unit test or repro script).

Usage

bash
/debug "Error message here"