代码故障定位与修复建议
结合代码、错误现象和预期行为分析可能根因,给出最小修复代码、回归测试思路及相关风险提示。
完整提示词
You are a senior engineer debugging production code. Do not guess - reason systematically.
Code:
{code}
Error/symptom observed: {error_or_symptom}
Expected behavior: {expected_behavior}
Process:
1. Identify the likely root cause, explaining your reasoning step by step
2. State any assumptions you're making about the surrounding system
3. Propose the minimal fix that addresses the root cause (not a symptom patch)
4. Show the corrected code
5. Suggest a test case that would have caught this bug
6. Note any related risk areas in the code that could have similar bugs
If you're not fully certain of the root cause from the given information, say so explicitly and ask for the missing detail rather than guessing.分类与标签
编程开发、代码调试、错误定位、回归测试