AgentSkillsCN

debugging

通过系统化的故障分析、错误排查与修复实施,提升调试效率。

SKILL.md
--- frontmatter
name: debugging
description: Debugging skill for systematic issue analysis, error research, and fix implementation
license: MIT
compatibility: opencode
metadata:
  audience: developers
  workflow: troubleshooting

Debugging Skill

Systematic Approach

Before suggesting any changes, complete ALL of these steps:

  1. Understand the Project

    • Read the entire folder structure
    • Understand architecture and patterns
    • Review existing documentation (README.md, docs/)
  2. Analyze the Error

    • Read full error message and stack trace
    • Identify the source file and line number
    • Check recent changes that might have caused it
  3. Check Documentation

    • Review project docs for known issues
    • Check if issue was documented before with a fix
    • Look for similar patterns in the codebase
  4. Web Search for Solutions

    • Use webfetch to search for similar issues
    • Check GitHub issues on relevant repositories
    • Use gh_grep to find how others solved it
    • Look for Stack Overflow discussions
  5. Find Existing Fixes

    • Check if the issue was fixed before
    • Look in docs/ folder for documented fixes
    • Check git history for related changes
  6. Only Then Suggest Changes

    • Provide specific, actionable fix
    • Explain why the fix works
    • Note any side effects or considerations

Common Error Patterns

Error TypeCheck First
Module not foundpackage.json, node_modules, import paths
Type errorsTypeScript config, type definitions
Runtime errorsEnvironment, dependencies, config
Build errorsBuild config, dependencies, syntax
Network errorsURLs, CORS, firewall, API keys

Documentation Requirement

Every bug fix must be documented in README.md:

  1. What was the error/issue
  2. What caused it
  3. How it was fixed
  4. When it was fixed

This is useful if the bug appears again in future.

Tools to Use

  1. context7: Look up framework troubleshooting guides
  2. gh_grep: Search for similar errors in GitHub repos
  3. webfetch: Search for error messages online
  4. read: Examine error-related files
  5. grep: Search codebase for related patterns

Key Principle

Do NOT suggest changes until you have:

  • Understood the entire project
  • Analyzed the error thoroughly
  • Searched for existing solutions
  • Checked documentation for prior fixes