이 플레이북에서는 Gemini에 범위가 엄격히 제한된 diff를 검토하도록 요청하고, 응답을 위치 확인과 검증이 가능한 문제 후보로 바꿉니다. 결과는 병합 승인이 아니라 사람이 하나씩 검증해야 하는 결과 모음입니다. 사람의 검토, 저장소 검사, 지속적 통합(CI)을 대체할 수 없습니다.
Gemini Apps로 코드 폴더를 가져온다면 먼저 모델이 요구 사항, diff, 테스트를 실제로 받았는지 확인하세요. 공식 도움말에서는 소스 자료가 많으면 세부 정보가 누락될 수 있다고 경고합니다. Google은 생성된 코드를 사용한 결과에 대한 책임이 사용자에게 있다는 점도 고지합니다. 응답이 자신 있게 들린다는 이유로 소스 코드, 테스트, CI를 건너뛰지 마세요.
쉽게 설명하면: diff는 판결이 아니라 근거입니다
섹션 제목: “쉽게 설명하면: diff는 판결이 아니라 근거입니다”효과적인 리뷰는 자료에서 직접 확인되는 사실, 그 사실에서 추론한 위험, 코드를 실행해야만 확인되는 결과라는 세 계층을 구분합니다. 예를 들어 “요구 사항에는 >=라고 되어 있지만 새 코드는 >를 사용한다”는 사실이고, “새 조건이 경곗값 입력을 제외한다”는 정적 추론이며, “전체 테스트 스위트가 실패했다”는 실제로 실행한 뒤에만 확인할 수 있습니다. 자료에 호출자가 없다면 사용자 영향을 “알 수 없음, 호출자 확인 필요”로 설명하세요.
최소 예시
섹션 제목: “최소 예시”좋지 않은 프롬프트:
이 변경 사항을 검토하고 모든 문제를 찾으세요.개선한 프롬프트:
정확성과 회귀만 검토하세요. 각 결과를“위치 | 문제 | 근거 | 심각도 | 권장 사항” 형식으로 출력하세요.근거 열에서 “사실”과 “추론”을 구분하세요. 요구 사항, diff, 테스트로 확인할 수 없는결론에는 “테스트 필요”라고 표시하세요. 기각한 우려 사항은 별도로 나열하세요.스타일 선호를 보고하거나 같은 근본 원인을 두 번 세지 마세요.전체 예시: 재고 보충 목록 리팩터링 검토하기
섹션 제목: “전체 예시: 재고 보충 목록 리팩터링 검토하기”시작 자료
섹션 제목: “시작 자료”다음은 완전한 합성 예시입니다.
restock-review/├── package.json├── requirements.md├── review.diff├── src/│ └── select-restock-items.js└── test/ └── select-restock-items.test.js{ "type": "module", "scripts": { "test": "node --test" }}알려진 환경은 ECMAScript 모듈을 사용하는 Node 24이며 테스트 명령은 node --test입니다.
재고 보충 목록은 매장으로 옮길 수 있는 항목을 선택합니다. `minimumStock`은 품절 기준이 아니라 이동 기준입니다.
- `stock >= minimumStock`인 항목을 입력 순서 그대로 재고 보충 목록에 포함하세요.- 출력 `sku`는 대소문자를 정규화하지 않고 입력과 정확히 일치해야 합니다.- 선택한 각 항목에 대해 `loadUnitPrice(sku)`를 한 번 호출하세요. 가격 조회 오류는 호출자에게 전파되어야 합니다.- `unitPrice: 0`은 유효한 가격이며 항목이 제거되는 원인이 되어서는 안 됩니다.변경 전 구현은 다음과 같습니다.
export function selectRestockItems(items, minimumStock, loadUnitPrice) { const selected = [];
for (const item of items) { if (item.stock < minimumStock) continue;
selected.push({ sku: item.sku, unitPrice: loadUnitPrice(item.sku), }); }
return selected;}기존 테스트는 대문자 SKU, 임계값을 넘는 재고, 0이 아닌 가격, 오류 없음이라는 정상 경로만 다룹니다.
import test from 'node:test';import assert from 'node:assert/strict';import { selectRestockItems } from '../src/select-restock-items.js';
test('selects stocked items in input order', () => { const prices = new Map([ ['PAPER-2', 12], ['INK-7', 28], ]); const items = [ { sku: 'PAPER-2', stock: 8 }, { sku: 'INK-7', stock: 6 }, ];
assert.deepEqual( selectRestockItems(items, 5, (sku) => prices.get(sku)), [ { sku: 'PAPER-2', unitPrice: 12 }, { sku: 'INK-7', unitPrice: 28 }, ], );});검토할 review.diff는 다음과 같습니다.
diff --git a/src/select-restock-items.js b/src/select-restock-items.js--- a/src/select-restock-items.js+++ b/src/select-restock-items.js@@ -1,14 +1,15 @@ export function selectRestockItems(items, minimumStock, loadUnitPrice) {- const selected = [];-- for (const item of items) {- if (item.stock < minimumStock) continue;-- selected.push({- sku: item.sku,- unitPrice: loadUnitPrice(item.sku),- });- }-- return selected;+ return items+ .filter((item) => item.stock > minimumStock)+ .map((item) => {+ try {+ return {+ sku: item.sku.toUpperCase(),+ unitPrice: loadUnitPrice(item.sku),+ };+ } catch {+ return null;+ }+ })+ .filter(Boolean); }허용되는 범위
섹션 제목: “허용되는 범위”- Gemini는
requirements.md, 변경 전 구현,review.diff, 기존 테스트만 검토합니다. 파일을 수정하거나 명령을 실행하지 않습니다. - 정확성, 오류 처리, 요구 사항 대비 회귀만 보고하세요. 이름이나 서식 선호를 결함으로 제시하지 마세요.
- 검증 중 격리된 브랜치나 임시 디렉터리에
test/review-cases.test.js를 추가할 수 있지만 리뷰 작업 자체는 제품 코드를 수정하지 않습니다. - 제공 자료에 근거가 없다면 호출자, 프로덕션 데이터, 배포 환경, 사업 손실을 추측하지 마세요.
전체 프롬프트
섹션 제목: “전체 프롬프트”아래의 합성 JavaScript 변경 사항을 검토하세요. 리뷰 결과부터 시작하세요. 파일을 수정하거나명령을 실행하거나 테스트를 실행했다고 주장하지 마세요.
[목표]requirements.md를 위반하거나 기존의 관찰 가능한 동작을 바꾸는 정확성 문제를 찾으세요.순수한 서식 문제나 개인적인 스타일 선호는 보고하지 마세요.
[자료]- requirements.md: 예상 동작의 기준 자료;- 변경 전 src/select-restock-items.js 구현: 이전 동작의 근거;- review.diff: 현재 변경 사항;- test/select-restock-items.test.js: 기존 테스트 범위.
[절차]1. 먼저 실제로 받은 자료를 나열하세요. 누락되거나 잘린 항목이 있다면 추측하지 말고 중단하세요.2. 요구 사항, 삭제된 줄, 추가된 줄을 항목별로 비교하세요. 정상 경로, 경계 입력, 오류 경로, 0 값을 확인하세요.3. 모든 후보에 위치 | 문제 | 근거 | 심각도 | 권장 사항 형식을 사용하세요.4. 근거 열에서 “사실”과 “추론”을 구분하세요. 사실은 제공된 자료에서만 가져올 수 있습니다. 코드를 실행해야 확인할 수 있는 내용에는 “테스트 필요”라고 쓰고 이미 일어난 일처럼 제시하지 마세요.5. 높음 / 중간 / 낮음 심각도를 사용하고 직접 관찰 가능한 영향을 설명하세요. 자료가 부족하면 사용자 영향에 “알 수 없음, 호출자 확인 필요”라고 쓰세요.6. 권장 사항은 최소화하세요. 기회성 리팩터링 없이 재현 가능한 입력이나 권장 테스트를 제시하세요.7. “기각한 우려 사항”을 별도로 나열하고 문제가 아닌 이유를 설명하세요. 같은 근본 원인을 두 번 세지 마세요.8. 마지막으로 제가 직접 실행해야 할 테스트와 사람의 판단이 필요한 항목을 나열하세요.
[제약 조건]- 호출자, 프로덕션 영향, 파일, 테스트 결과를 지어내지 마세요.- 이전 코드가 옳거나 새 접근 방식이 문제라고 자동으로 가정하지 마세요.- 각 근본 원인은 한 번만 보고하세요.- 리뷰 결과는 사람의 검토나 CI를 대체할 수 없습니다.예상 결과물
섹션 제목: “예상 결과물”리뷰에서는 다음 세 가지 실제 문제를 찾아야 합니다.
| 위치 | 문제 | 근거 | 심각도 | 권장 사항 |
|---|---|---|---|---|
.filter((item) => item.stock > minimumStock) |
재고가 정확히 최솟값인 항목 제외 | 사실: 요구 사항은 stock >= minimumStock이지만 새 조건은 >를 사용합니다. 추론: 사용자 영향은 알 수 없으므로 호출자의 경곗값 전달 여부를 확인해야 합니다. |
중간 | >=를 복원하고 동등 경계 테스트를 추가합니다. |
새 try / catch, return null, 마지막 필터 |
가격 조회 오류를 삼킴 | 사실: 요구 사항은 오류 전파를 요구하지만 새 구현은 오류를 null로 바꿔 제거합니다. 추론: 사용자 영향은 알 수 없으므로 호출자의 오류 전파 의존성을 확인해야 합니다. |
높음 | catch를 제거하거나 다시 던지고 assert.throws를 추가합니다. |
sku: item.sku.toUpperCase() |
정확히 보존해야 하는 sku 변경 |
사실: 요구 사항은 값을 정확히 보존하라고 하지만 혼합 대소문자 입력이 바뀝니다. 추론: 사용자 영향은 알 수 없으므로 호출자가 원래 sku로 레코드를 연결하는지 확인해야 합니다. |
중간 | item.sku를 반환하고 혼합 대소문자 테스트를 추가합니다. |
그럴듯해 보이지만 문제가 아닌 다음 우려 사항도 별도로 나열해야 합니다.
| 위치 | 문제 | 근거 | 심각도 | 권장 사항 |
|---|---|---|---|---|
.filter(Boolean) |
기각된 오탐: unitPrice: 0인 성공 항목을 제거하지 않음 |
사실: 필터는 객체 전체를 받으며 숫자 0을 포함한 객체도 truthy입니다. null 제거는 앞선 오류 삼킴 문제의 일부입니다. |
문제 아님 | 코드를 바꾸지 말고 가격 0 검증 사례를 추가합니다. |
이 결과는 정적 근거와 잠재적 영향을 구분하며 동일한 catch 근본 원인을 두 번 보고하지 않습니다.
검증: 각 리뷰 결과를 테스트로 바꾸기
섹션 제목: “검증: 각 리뷰 결과를 테스트로 바꾸기”먼저 격리된 브랜치나 임시 디렉터리에서 review.diff를 적용한 다음 다음 검증 파일을 추가하세요.
import test from 'node:test';import assert from 'node:assert/strict';import { selectRestockItems } from '../src/select-restock-items.js';
test('includes stock exactly at the minimum', () => { const items = [{ sku: 'PAPER-5', stock: 5 }];
assert.deepEqual(selectRestockItems(items, 5, () => 16), [ { sku: 'PAPER-5', unitPrice: 16 }, ]);});
test('propagates price lookup errors', () => { const items = [{ sku: 'INK-404', stock: 7 }];
assert.throws( () => selectRestockItems(items, 5, () => { throw new Error('price unavailable'); }), /price unavailable/, );});
test('preserves the original SKU spelling', () => { const items = [{ sku: 'Paper-Mix', stock: 7 }];
assert.deepEqual(selectRestockItems(items, 5, () => 19), [ { sku: 'Paper-Mix', unitPrice: 19 }, ]);});
test('keeps an item whose unit price is zero', () => { const items = [{ sku: 'SAMPLE-0', stock: 7 }];
assert.deepEqual(selectRestockItems(items, 5, () => 0), [ { sku: 'SAMPLE-0', unitPrice: 0 }, ]);});먼저 기존 테스트를 실행하세요.
node --test test/select-restock-items.test.js예상되는 최소 결과는 tests 1, pass 1, fail 0입니다. 이는 정상 경로 검증만으로는 부족하다는 사실을 보여 줄 뿐, diff에 문제가 없다는 뜻은 아닙니다.
그런 다음 모든 테스트를 실행하세요.
node --test이는 예상되는 실패입니다. 결함이 있는 diff의 예상 최소 결과는 tests 5, pass 2, fail 3입니다.
- The equality-boundary case fails, with an actual value of
[]. - The error-propagation case fails because the expected exception is missing.
- The original-
skucase fails, with an actual value of'PAPER-MIX'and an expected value of'Paper-Mix'. - The zero-price case passes, ruling out the false positive that “
.filter(Boolean)dropsunitPrice: 0.” - The original happy-path test passes.
이 예상 실패 명령은 종료 코드 1로 끝나야 합니다. To check that each recommendation matches its root cause, change > back to >= in a temporary directory, remove the try / catch that swallows errors, and change the output back to sku: item.sku. Even if you keep .filter(Boolean), running node --test again should produce tests 5, pass 5, and fail 0. Do not delete or weaken tests to manufacture a green result.
요구 사항과 diff만으로 세 정적 충돌을 입증할 수 있지만 다음 질문은 직접 검사하거나 저장소를 살펴봐야 합니다.
- 실패가 재현되는지 in the Node version and dependency environment specified by the project.
- 대상 테스트가 통과하는지, full test suite, type checks,
lint, and CI all pass after the fix. - 실제 호출자가 처리하는 방식 handle price lookup errors and whether the severity should change.
- 다른 저장소 모듈의 의존 여부 depend on case conversion or boundary behavior.
- diff에 포함 여부 files or generated artifacts not shown in the current materials.
이 페이지를 준비하면서 연습용 저장소를 실행하지 않았습니다. source-checked 상태는 제품 관련 사실만 확인했다는 뜻이며, 이 코드가 사용자의 환경에서 run-tested되었다는 뜻은 아닙니다.
검증 체크리스트
섹션 제목: “검증 체크리스트”- You received the requirements, implementation before the change, complete diff, and relevant tests without filling in missing materials through speculation.
- Every finding identifies a specific location and includes the issue, factual evidence, an inference, severity, and a minimal recommendation.
- The three real issues cover the equality boundary, error propagation, and exact preservation of
sku, without counting any root cause twice. - The zero-price concern about
.filter(Boolean)has been dismissed using object truthiness and a targeted test case. - The existing happy-path test and
test/review-cases.test.jshave both actually been run. - Every failure is caused by the expected conflict with the requirements, not by an environment error misclassified as a code regression.
- The full test suite and CI have been run after the fix, or every unrun check and its reason have been recorded explicitly.
- A person with the necessary context still makes the final merge decision; Gemini’s findings are not treated as approval.
복구 및 안전 경계
섹션 제목: “복구 및 안전 경계”- The diff or requirements are truncated: Stop drawing conclusions. After supplying the missing materials, ask the model to list the files and excerpts it received again.
- The response cites a caller that does not exist: Remove any impact description that cannot be located, keep only the static facts, and have a person search for the real call sites.
- A zero price is falsely reported as a defect: Check whether the filter receives an object or a number, and verify it with a minimal test. Do not accept a claim just because it is phrased confidently.
- There are many findings but no evidence: Require each one to cite an added or deleted line, a requirement, and a reproducible input. Move pure style feedback out of the blocking findings.
- Test results differ from expectations: First confirm that you applied the same diff, ran the same test file, and used the same Node version before reassessing the review’s conclusions.
- Severity cannot be determined: Mark user impact as an inference. Inspect callers, logs, and the release scope, then have a person adjust the severity.
- The recommendation expands into a large rewrite: Limit the fix to one root cause and its corresponding test. Open a separate task for refactoring.
- The materials involve secrets, customer data, or an undisclosed vulnerability: Do not upload them through an inappropriate interface. Follow your organization’s access controls and security response process.
- The recommendation includes destructive commands: Do not perform deletions, resets, force pushes, or production changes. First constrain the target and obtain authorization.
Gemini는 리뷰에 또 다른 관점을 더할 수 있지만 병합 결정은 여전히 사람의 책임입니다. 다음 단계: 경계 테스트가 없다면 기존 함수에 테스트 추가하기를 읽으세요. 문제를 확인한 후에는 버그를 찾아 수정하기로 계속 진행하세요. 답변을 확인하는 일반적인 방법은 답변 검증하기를 읽으세요.