让编程代理先写失败测试复现缺陷,再做最小修复,反复运行全部测试直至通过并排查相关问题。
填写变量
填写后,下方提示词与复制内容会同步替换。
我有一个 bug:{{bug}}。采用测试先行的方法:1) 阅读相关的源文件和现有测试。2) 编写一个失败的测试,精确复现该 bug。3) 运行测试套件以确认它失败。4) 实现最小化的修复。5) 重新运行完整的测试套件。6) 如果有任何测试失败,分析失败原因,调整代码并重新运行——重复此过程直到所有测试都通过。7) 然后在代码库中使用 grep 查找可能存在相同问题的相关代码路径,并为这些路径添加测试。8) 总结每一项所做的更改及其原因。不要向我提问——做出合理的假设并加以记录。I have a bug: {{bug}}. Take a test-first approach: 1) Read the relevant source files and existing tests. 2) Write a failing test that reproduces the exact bug. 3) Run the test suite to confirm it fails. 4) Implement the minimal fix. 5) Re-run the full test suite. 6) If any test fails, analyze the failure, adjust the code, and re-run—repeat until ALL tests pass. 7) Then grep the codebase for related code paths that might have the same issue and add tests for those too. 8) Summarize every change made and why. Do not ask me questions—make reasonable assumptions and document them.