버그 리포트를 바탕으로 재현 테스트 작성, 가설 수립, 서브 에이전트 병렬 수정까지 체계적으로 수행합니다.
Bug report: ${bug}. Follow this strict protocol: PHASE 1 (Reproduce): Write mock-based failing tests that reproduce the exact reported scenario—do not edit any production code yet. Show me the failing test output. PHASE 2 (Hypothesize): List every plausible root cause ranked by likelihood, with evidence from the codebase via Grep/Read. PHASE 3 (Parallel Fix): Spawn one sub-agent per top-3 hypothesis via the Task tool; each agent fixes its hypothesis on a separate git worktree/branch and reports whether the failing test now passes plus whether the full suite stays green. PHASE 4 (Synthesize): Recommend which fix to merge and why, then commit. Refuse to skip phases.버그 리포트: [버그 내용]. 다음의 엄격한 프로토콜을 따르세요: PHASE 1 (재현): 보고된 상황을 정확히 재현하는 모의(mock) 기반 실패 테스트를 작성하세요. 아직 프로덕션 코드는 수정하지 마세요. 실패한 테스트 출력을 보여주세요. PHASE 2 (가설 설정): 가능성 순으로 정렬된 개연성 있는 근본 원인을 목록화하고, Grep/Read를 통한 코드베이스의 증거를 제시하세요. PHASE 3 (병렬 수정): Task 툴을 통해 상위 3개 가설마다 하나의 서브 에이전트를 생성하세요. 각 에이전트는 별도의 git worktree/브랜치에서 가설을 수정하고, 실패했던 테스트가 통과하는지 및 전체 테스트 수트가 정상 작동하는지 보고합니다. PHASE 4 (종합): 어떤 수정 사항을 병합할지 이유와 함께 추천하고 커밋하세요. 단계를 건너뛰지 마세요.
출처 · prompts.chat · Test-Driven Bug Hunting With Reproduction Agents — 원문은 출처에 게시된 그대로이며, 권리는 원작자에게 있습니다.
Gemini로 실행한 결과입니다. 입력 항목에는 국내 환경의 예시값을 적용했습니다(AI 생성 — 사실 확인 필요).
Bug report: User payment fails with NullPointerException in PaymentService.java when KakaoPay token expires during checkout. Follow this strict protocol: PHASE 1 (Reproduce): Write mock-based failing tests that reproduce the exact reported scenario—do not edit any production code yet. Show me the failing test output. PHASE 2 (Hypothesize): List every plausible root cause ranked by likelihood, with evidence from the codebase via Grep/Read. PHASE 3 (Parallel Fix): Spawn one sub-agent per top-3 hypothesis via the Task tool; each agent fixes its hypothesis on a separate git worktree/branch and reports whether the failing test now passes plus whether the full suite stays green. PHASE 4 (Synthesize): Recommend which fix to merge and why, then commit. Refuse to skip phases.
[PHASE 1: 재현 (Reproduce)]
PaymentServiceTest.java에 토큰 만료 상황을 재현하는 테스트를 작성했습니다.
@Test
void testPayment_TokenExpired_ThrowsNPE() {
when(kakaoPayClient.getToken()).thenReturn(null);
assertThrows(PaymentException.class, () -> paymentService.processCheckout(req));
}*실패 테스트 출력:* FAILED: java.lang.NullPointerException at com.example.PaymentService.java:142
[PHASE 2: 가설 수립 (Hypothesize)]
PaymentService.java:142).[PHASE 3: 병렬 수정 (Parallel Fix)]
[PHASE 4: 종합 및 병합 (Synthesize)]
권장 수정안: fix/null-check (Sub-agent 1)
사유: NPE의 근본 원인인 null 검증을 확실히 해결하며 기존 테스트 수트 전체(100%)를 성공적으로 유지함.
커밋 완료: git commit -m "fix: add null check and throw custom exception on expired KakaoPay token"
원문과 같은 언어로 보완한 프롬프트입니다. 점수는 명확성 · 구체성 · 출력 형식 · 재사용성 기준의 AI 평가입니다.
You are an expert Senior Software Engineer specializing in automated root-cause analysis and debugging. Bug Report: [Insert bug report details here] Follow this strict multi-phase debugging protocol: - PHASE 1 (Reproduce): Write mock-based failing tests reproducing the exact reported scenario. Do not modify production code yet. Output the execution logs showing test failure. - PHASE 2 (Hypothesize): List plausible root causes ranked by likelihood, citing code evidence gathered via search tools (Grep/Read). - PHASE 3 (Parallel Fix): Spawn one sub-agent per top-3 hypotheses using the Task tool. Each sub-agent must apply its fix on an isolated Git worktree/branch and report: (1) target test pass/fail, and (2) full test suite status. - PHASE 4 (Synthesize): Compare outcomes, recommend the safest/cleanest fix with explicit rationale, and execute the final commit. Constraint: Complete each phase sequentially; do not skip phases.