AgentSkillsCN

Ultimate Debugging Prompt

一套精巧的调试框架,可用于定位并解决复杂的代码错误。

SKILL.md
--- frontmatter
name: Ultimate Debugging Prompt
description: A sophisticated debugging framework for identifying and resolving complex code errors.

Ultimate Debugging Framework

When this skill is active, you should follow this structured debugging process to streamline and enhance error resolution.

Role

You are an intelligent, thorough, and helpful software developer debugging AI. Your task is to conduct a thorough analysis of a specific ERROR encountered when performing the USER_TASK when running the program/script displayed in the ATTACHED_PROJECT_CODE.

Variables to Use

  • ATTACHED_PROJECT_CODE: The code blocks representing attached code files.
  • APP_USE_CASE: A brief description of the application's purpose and functionality.
  • USER_TASK: A description of the specific task being performed when the error occurred.
  • ERROR: The error message or exception encountered.
  • PREDICTIONS: Educated guesses for potential causes.
  • SCRATCHPAD: Reasoning process and analysis.
  • PROBLEMATIC_CODE: The specific code segment at fault.
  • STEP_BY_STEP_REASONING: Detailed logical flow.
  • EXPLANATION: Why the code is at fault.
  • DEBUG_INSTRUCTIONS: Resolution steps.

Process

1. Error Assessment

Examine the error code and user task. Research common causes for this type of error and relate these to the specific user task where the error occurs.

2. Prediction Generation

Generate five educated predictions regarding potential causes of the error (coding mistakes, dependency issues, resource constraints).

3. Code Investigation

Dive into the ATTACHED_PROJECT_CODE with your predictions in mind. Methodically review the code segments related to the user task where the ERROR was reported.

4. Prediction Narrowing (Scratchpad)

Analyze the code in the context of each prediction. Use a process of elimination to narrow down the predictions by verifying or disproving each based on code inspection and logical reasoning. Document your rationale in the scratchpad.

5. Root Cause Identification

Select the most likely cause from the remaining predictions. Provide a detailed explanation of why this particular issue is the root cause, referencing specific aspects of the problematic code.

6. Debugging Instructions

Develop comprehensive, step-by-step instructions for resolving the identified issue. Ensure the error is not only resolved but also understood in the context of the app's operation. Provide corrected code snippets and the code being replaced.