프롬프트 도감 › No.2108
테스트부터 하는 버그 수정
Test-First Bug Fixing
버그를 말하면 먼저 그 버그를 재현하는 테스트를 만들고, 고친 뒤 모든 테스트가 통과할 때까지 반복해요. 비슷한 곳도 찾아 같이 점검하고 바꾼 내용을 정리해 줘요.
이럴 때 버그 고치기, 코드 안전하게 수정, 비슷한 오류 점검
도구 ChatGPT · Claude · Gemini
프롬프트
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.팁
- ${bug} 자리에 증상과 재현 방법을 적어요
- 테스트 실행 명령을 미리 알려 줘요
출처
권리: CC0 (f/prompts.chat). 자유 사용. 기여자: ilkerulusoy.