Use a context-isolated subagent to perform deep Bug analysis.
Trigger conditions
- The user requests analysis of a Bug root cause
- The user mentions keywords such as "bug analysis", "root cause analysis", "debugging", "debug", etc.
- The user reports an error or abnormal behavior that requires in-depth investigation
Steps
Step 1: Organize the user's requirements
Organize the user's Bug description into concise instructions, including:
- Bug symptoms (error messages, abnormal behavior)
- Trigger conditions or reproduction steps (if provided by the user)
- Relevant code locations (if already known by the user)
- Focus areas (if not specified by the user, do not restrict them)
If the user does not specify relevant code locations, organize it as "start analysis from the project entry point and related modules".
Step 2: Launch the analysis subagent
Read the bug-analyzer.mdin this directory, and concatenate itsfull contentwith the requirements organized in Step 1, then pass it as the prompt to the Agent tool to spawn the subagent.
description: "Bug root cause analysis"prompt:bug-analyzer.mdfull content + "\n\n## Analysis task\n" + user requirement instructionsmodel: read thebug-analyzer.mdfield in themodelfrontmatter to decide (if not specified, default to sonnet)
Key principles:
- Do not collect code content in the main agent, only pass the description of the analysis target
- The subagent has its own tools such as Bash and Read, and will read the code and diff itself
- You must pass the
bug-analyzer.md's entire content to the subagent; do not truncate or summarize it
Step 3: Output the analysis result
Output the analysis result returned by the subagent directly to the user, without summarizing or abbreviating it.