
AI Code Review — Catch Bugs Before You Merge
US$5, one-time purchase. Review a diff or pull request for real bugs before merge: four reviewer lenses (one model applying each in turn) check each other and tag findings CONFIRMED, CORROBORATED or DISPUTED. #엔지니어링
붙여 넣을 것: diff, 풀 리퀘스트 또는 코드 변경 사항.
받는 것: 네 가지 리뷰 관점(보안, 안정성, 유지보수성, 성능)에서 나온 지적 사항과 각 지적에 붙은 CONFIRMED / CORROBORATED / DISPUTED 태그, 그리고 병합 권고 한 줄.
작동 방식
붙여 넣은 코드 변경 사항을 3단계 위원회 절차로 리뷰합니다. 1단계: 네 가지 리뷰어 관점(보안, 안정성, 유지보수성, 성능)이 차례로 하나씩 리뷰합니다. 2단계: 각 관점이 다른 관점의 지적 사항에 이의를 제기하거나 뒷받침하여 오탐을 줄입니다. 3단계: 하나의 최종 판정이 모든 지적 사항에 CONFIRMED, CORROBORATED 또는 DISPUTED 태그를 붙이고 병합 권고로 마무리합니다. 이의가 제기된 항목은 해당 이의와 나란히 표시됩니다. diff에서 발견된 비밀 정보나 개인식별정보(PII)는 값을 그대로 되풀이하지 않고 파일/줄 번호로만 표시합니다. 코드를 실행하거나, CI를 설정하거나, 기억에 의존해 리뷰하지 않습니다. diff가 제공되지 않으면 diff를 요청합니다. 관점은 하나의 모델이 맡는 역할이거나(에이전트가 서브 에이전트를 지원하는 경우에는 서브 에이전트가 맡는 역할), 따라서 교차 검토는 자체 검토입니다. 지적 사항은 직접 표본 점검하시기 바랍니다.
샘플 출력
샘플 입력(가상의 예시):
Use the Code Review Board on this (a sample I wrote). Please tell me if it is safe to merge.
PR "Add webhook for order refunds" (fictional shop backend, Python/Flask):
--- a/app/refunds.py
+++ b/app/refunds.py
@@ -0,0 +1,20 @@
+import os, requests
+from flask import request, jsonify
+from app import app, db
+
+API_KEY = "demo_key_do_not_use_123"
+
[email protected]("/webhook/refund", methods=["POST"])
+def refund_webhook():
+ data = request.get_json()
+ order_id = data["order_id"]
+ order = db.execute(f"SELECT * FROM orders WHERE id = '{order_id}'").fetchone()
+ amount = order["total"]
+ r = requests.post("https://payments.example.com/refund",
+ json={"order": order_id, "amount": amount},
+ headers={"Authorization": API_KEY})
+ db.execute(f"UPDATE orders SET status='refunded' WHERE id='{order_id}'")
+ for item in db.execute("SELECT * FROM items WHERE order_id = ?", (order_id,)):
+ stock = db.execute("SELECT qty FROM stock WHERE sku = ?", (item["sku"],)).fetchone()
+ db.execute("UPDATE stock SET qty = ? WHERE sku = ?", (stock["qty"] + item["qty"], item["sku"]))
+ return jsonify(ok=True)
가공하지 않은 실제 출력:
## Phase 1 — Lens findings
Mode: one lens at a time (each lens finished before the next began)
### 🔒 Security Skeptic
- **S1. No authentication on the webhook** (`refund_webhook`, line 8). No signature check, shared secret, or IP allowlist. Anyone who finds `/webhook/refund` can POST `{"order_id": "<any id>"}` and trigger a real refund and a restock for any order.
- **S2. SQL injection via `order_id`** (lines 11 and 16, f-string queries). A payload like `x' OR '1'='1` on the UPDATE marks every order refunded; the SELECT can be abused to probe other data.
- **S3. Hardcoded payment credential** (line 5). It sits in source, so it ends up in forks, CI logs and backups. The value is not repeated here. `os` is already imported, so an env-var lookup was probably intended.
- **S4. No input validation.** `order_id` can be any JSON type or empty; nothing constrains it before it reaches SQL and the payment API.
### ⚙️ Reliability Realist
- **R1. Not idempotent.** Nothing checks whether the order is already refunded. Webhook senders retry routinely, so a duplicate delivery means a double refund and a double restock.
- **R2. Payment response ignored** (`r`, lines 13-15). On a 4xx/5xx the order is still marked refunded and stock is still returned.
- **R3. No timeout on `requests.post`.** If the payment host hangs, the worker hangs with it.
- **R4. Ordinary bad input crashes with a 500:** `get_json()` returning `None` (line 10 `TypeError`), missing `order_id` (`KeyError`), unknown order (`order` is `None`, line 12 `TypeError`), SKU missing from `stock` (line 19 `TypeError`, mid-loop).
- **R5. Side effects are ordered unsafely.** The external refund (line 13) happens before any local record exists. If the process dies after the POST, nothing marks the order as pending, so a retry refunds again.
- **R6. Lost-update race on stock** (lines 18-19). Read-modify-write in Python means two concurrent refunds, or a refund racing a sale, overwrite each other.
- **R7. No `db.commit()` visible** in the handler, so the status and stock updates may never persist.
### 🧹 Maintainability Pragmatist
- **M1. Inconsistent query style.** f-strings (lines 11, 16) sit next to parameterized queries (lines 17-19) in one function; the next editor will copy whichever they see first.
- **M2. Dead code that signals unfinished intent:** `os` is imported but unused, and `r` is assigned but never read.
- **M3. Everything is in the route handler** (parsing, lookup, payment call, state change, inventory), so none of it can be tested without Flask and a live payment endpoint.
- **M4. Always returns `ok=True`, bare `'refunded'` literal, and `SELECT *`** with column access by name. A caller or log reader cannot tell what happened, and a schema change breaks it silently.
### 🚀 Performance Pessimist
- **P1. N+1 queries in the restock loop.** Each item costs a SELECT plus an UPDATE, so a 50-line order is about 100 round trips; one `UPDATE stock SET qty = qty + ? WHERE sku = ?` per item does the same work.
- **P2. Blocking outbound HTTP call on the request thread with no timeout** (same root cause as R3). A slow provider ties up Flask workers.
## Phase 2 — Cross-examination
- [S1 no auth] Challenge: none, nothing in the diff verifies the caller. Corroborated by Reliability: "A forged or replayed request behaves like a duplicate delivery; with R1 an attacker can refund one order repeatedly."
- [S2 SQL injection] Challenge: none, `order_id` goes straight from JSON into an f-string. Corroborated by Reliability: "Even benign IDs containing `'` break the query." Corroborated by Maintainability (M1 is the root cause).
- [S3 hardcoded credential] Challenge from Maintainability: "The value is named as a demo placeholder, so it is not a live leak in this sample." Rebuttal from Security: "The pattern is the bug; the real key lands on the same line." The challenge lowers severity for this value only. Corroborated by Maintainability (M2: the unused `os` import points to the intended env-var fix).
- [S4 input validation] Challenge: none. Corroborated by Reliability (R4: wrong types and missing fields crash the handler).
- [R1 idempotency] Challenge: none, there is no status check anywhere. Corroborated by Security: "It turns S1 into repeatable theft."
- [R2 payment response ignored] Challenge: none. Corroborated by Security: "The record claims money moved when it did not, which poisons fraud and dispute investigations." Corroborated by Maintainability (M2: `r` is unused; M4: always `ok=True`).
- [R3 / P2 no timeout] Flagged independently by Reliability and Performance. Challenge: none.
- [R4 crashes on bad input] Corroborated by Security (S4) and Maintainability (M4: every failure looks the same to the caller). Challenge: none.
- [R5 side-effect ordering] Challenge from Maintainability: "`db` is not shown and may wrap the handler in a transaction." Rebuttal from Reliability: "The external refund cannot be rolled back by any DB transaction." The challenge only touches the DB part, which is covered under R7. Corroboration from other lenses: none.
- [R6 stock race] Corroborated by Performance: "The atomic `qty = qty + ?` fix for P1 also removes the race." Challenge: none.
- [P1 N+1] Challenge from Reliability: "Orders usually have few items, so impact is low." That argues severity, not correctness, so the finding stands. Corroborated by Reliability (R6 shares the same fix).
- [R7 missing `db.commit()`] Challenge from Maintainability: "`db` comes from `app` and is not in the diff; it may autocommit or commit in a teardown hook." Challenge from Security: none. This is a concrete reason for doubt.
- [M3, M4] No challenges and no cross-lens corroboration beyond what is noted above. These are testability and clarity issues.
## Phase 3 — Board verdict
1. **[CORROBORATED]** SQL injection through f-string queries (lines 11, 16). Fix: parameterized `?` placeholders as on lines 17-19, and validate `order_id` format first.
2. **[CORROBORATED]** Unauthenticated webhook (line 8). Fix: verify an HMAC signature header from the payment provider with `hmac.compare_digest` and reject otherwise.
3. **[CORROBORATED]** Not idempotent; duplicate or replayed deliveries double-refund and double-restock. Fix: `UPDATE orders SET status='refunding' WHERE id=? AND status='paid'` and proceed only if `rowcount == 1`; also send an idempotency key to the payment API.
4. **[CORROBORATED]** Payment API result ignored; the order is marked refunded even if the refund failed (lines 13-16). Fix: `r.raise_for_status()` or check the body, and only update status and stock on confirmed success.
5. **[CORROBORATED]** No timeout on the outbound call (R3/P2). Fix: `requests.post(..., timeout=(3, 10))` and handle `requests.RequestException`.
6. **[CORROBORATED]** Missing input validation and crashes on bad or missing data (S4/R4). Fix: 400 on missing or invalid JSON or `order_id`, 404 on unknown order, explicit handling of a missing stock row.
7. **[CORROBORATED]** Hardcoded API credential (line 5). Fix: `os.environ["PAYMENTS_API_KEY"]`. The value is a placeholder here and Maintainability's severity challenge is noted, but the pattern must not ship.
8. **[CORROBORATED]** Stock lost-update race plus N+1 queries (R6/P1). Fix: `UPDATE stock SET qty = qty + ? WHERE sku = ?`, which is atomic and removes the SELECT.
9. **[CONFIRMED]** Refund fires before any local record exists (R5). Fix: record a `refunding` state before the external call so a crash is recoverable and reconcilable.
10. **[CONFIRMED]** Handler does everything, always returns `ok=True`, uses `SELECT *` and a bare status literal (M3/M4, low priority). Fix: extract a `process_refund(order_id)` function, use named constants and explicit columns, return meaningful status codes.
11. **[DISPUTED]** Missing `db.commit()` / transaction scope (R7) — challenge: "`db` is not in the diff and may autocommit or commit on teardown." Human judgment call: check `app/__init__.py`.
**Merge recommendation:** Block merge — 8 CORROBORATED findings, including two independently exploitable security issues (unauthenticated refund trigger and SQL injection) that together let anyone refund arbitrary orders repeatedly. Fix items 1-6 at minimum before re-review.
diff 속 비밀 정보와 PII 처리
제공된 diff에 실제 비밀 정보, API 키, 토큰 또는 고객 PII가 들어 있으면, 그 자체를 Security Skeptic의 별도 지적 사항으로 취급하여 표시하고, 실제 비밀 값은 출력에 그대로 되풀이하지 않으며 파일/줄 번호로만 가리킵니다. 이 Skill은 붙여 넣은 diff를 그대로 모델에 전송합니다. 정말 민감한 내용은 가능하면 붙여 넣기 전에 가려 주십시오.
사용 사례
- CI 파이프라인을 구축하지 않고도 병합 전에 PR에 대해 구조화된 두 번째 검토를 받을 수 있습니다
- 지적 사항마다 구체적인 실패 시나리오를 요구하여 "전반적으로 괜찮아 보입니다" 식의 리뷰에 반박할 수 있습니다
- Claude Code용으로 만들어졌으며, SKILL.md 파일을 읽는 다른 에이전트(Codex CLI, OpenClaw 등)에서도 작동할 것으로 보입니다. 네트워크 접근이나 추가 도구는 필요하지 않습니다. diff를 붙여 넣고 시작하면 됩니다.
자주 묻는 질문
정적 분석 도구(린터, SAST)를 대체합니까? 아닙니다. 추론 기반의 리뷰 계층이며, 기존 린터/타입 검사기/테스트 스위트의 실행을 대체하지 않습니다.
diff에 비밀 정보나 실제 고객 데이터가 들어 있으면 어떻게 합니까? 붙여 넣기 전에 가려 주십시오. 이 Skill은 발견한 비밀 정보를 보안 지적 사항으로 취급하지만, 서버가 없으며 코드를 직접 수집하지 않습니다. 붙여 넣은 내용은 그대로 에이전트의 모델에 전송되고, 에이전트 또는 모델 제공자가 자체 정책에 따라 이를 보관할 수 있습니다.
네 가지 관점은 하나의 모델이 맡는 역할이거나(에이전트가 서브 에이전트를 지원하는 경우에는 서브 에이전트가 맡는 역할), 따라서 교차 검토는 자체 검토입니다. 지적 사항은 직접 표본 점검하시기 바랍니다.
Anthropic, OpenAI 및 OpenClaw는 각 소유자의 상표입니다. 이 Skill은 독립적인 제품이며 이들 중 어느 곳과도 제휴, 보증 또는 후원 관계가 없습니다.
