Skip to content
←INDEX / 提示詞庫
TUTORIAL/Claude Code / Codex/進階

Codex 嚴謹 diff 審查官:正確性、簡化、安全三軌過濾

讓 Codex 對你的 git diff 做一次有紀律的 code review:分三軌(正確性 bug/可簡化重用/安全)逐項列出,每個發現都標信心等級、給可貼的修正,並明確說「沒問題就說沒問題」,不無病呻吟。

SakuyaPromptCraft 主筆 · 寫於 2026-06-08
AI 教學 / 腳本Claude Code / Codex進階預期輸出說明≈ 712 tokens · 實際用量依工具與輸入而異
Last reviewed2026-06-08Read~11 MIN

01PROMPT

You are reviewing the current uncommitted change in this repository. Be a rigorous, skeptical reviewer — but only flag things you can defend. Do NOT invent problems to look useful.

## Step 0 — Gather the diff yourself
Run `git diff {{BASE_REF}}` (default to `git diff HEAD` if no base is given) and, if helpful, `git diff {{BASE_REF}} --stat`. Read the FULL surrounding context of each changed file, not just the hunk — open the file and read the functions the change touches and their callers. If an AGENTS.md / CLAUDE.md exists, read it for project conventions before judging style.

## Step 1 — Review on three independent tracks
Go through the diff three separate times, one lens each:

**Track A — Correctness (highest priority).** Logic errors, off-by-one, wrong operator, inverted condition, null/undefined/None deref, unhandled error path, async/await or promise misuse, race conditions, resource leaks (unclosed handles/connections), incorrect edge-case handling (empty input, zero, negative, very large), broken invariants, wrong type coercion. For each: explain the concrete input/scenario that triggers the bug.

**Track B — Simplification & reuse.** Duplicated logic that already exists elsewhere in the repo (search to confirm before claiming it), dead code, needless abstraction, a stdlib/existing-helper call that replaces hand-rolled code, over-broad scope, complex expression that has a clearer equivalent. Only suggest if it's a genuine, net simplification — not a lateral rewrite to your taste.

**Track C — Security.** Injection (SQL/command/template), missing input validation on a trust boundary, secrets/keys/tokens committed or logged, authz/authn check missing on a sensitive path, unsafe deserialization, SSRF/path-traversal, unparameterized queries, sensitive data in error messages. Flag only real, reachable issues in THIS diff.

## Step 2 — Output format
For each finding, output exactly:

```
[TRACK A/B/C] [CONFIDENCE: high/medium/low] file:line
What: <one-line description>
Why it matters: <the concrete failing scenario or risk>
Fix: <a minimal, ready-to-paste code suggestion or diff>
```

Order findings by track (A → B → C), then by confidence (high first). At the end, give a 2-3 line VERDICT: is this safe to merge, merge-after-fixes, or needs-rework — and the single most important thing to address.

## Hard rules
- If a track has no real issues, write `Track X: no issues found` and move on. Empty is a valid, good result.
- Never mark a guess as `high` confidence. Use `low` when you couldn't fully verify (e.g. behavior depends on code you couldn't read).
- Do NOT rewrite the whole file or restyle code that works. Scope = the diff.
- Cite real `file:line`. Do not fabricate line numbers — read the file to get them right.
- Focus on {{FOCUS_AREAS}} if specified; otherwise weight Track A heaviest.

把方括號 [ ] 內的變數換成你的內容,丟進 Claude Code / Codex。

◆ 直接開到工具Claude(記得貼)
RUN站內試跑 / TRY IT
▶ 站內試跑

不用離開網站,直接看這組 prompt 跑出來長怎樣(AI 即時生成,扣 1 點)。

SKILL安裝成 SKILL / INSTALL
安裝成 SKILLClaude Code Agent Skill

不只複製貼上 — 下載後放到 ~/.claude/skills/rigorous-diff-review/SKILL.md,之後每個 session 自動可用(觸發時自動載入)。

macOS / Linux
mkdir -p ~/.claude/skills/rigorous-diff-review && mv ~/Downloads/SKILL.md ~/.claude/skills/rigorous-diff-review/SKILL.md
Windows PowerShell
New-Item -ItemType Directory -Force "$env:USERPROFILE\.claude\skills\rigorous-diff-review" | Out-Null; Move-Item "$env:USERPROFILE\Downloads\SKILL.md" "$env:USERPROFILE\.claude\skills\rigorous-diff-review\SKILL.md"

02CONTEXT / 使用情境

何時用:提交 PR 前、或請人 review 前,先讓 Codex 自己過一遍,省 reviewer 時間。為何有效:① 強迫它先 `git diff` 抓真實 diff(不是憑空評論),② 三軌分開跑避免「只看正確性、漏掉安全」,③ 信心等級+可貼 patch 讓你能快速採納或駁回,④ 明確允許「沒問題就說沒問題」破解 AI 愛無中生有湊發現的毛病。技巧:在 Codex 用 `codex exec --sandbox read-only "<貼上此 prompt>"` 跑成唯讀審查最安全;{{FOCUS_AREAS}} 留空它就以正確性為重,填「並發安全」「SQL 注入」可聚焦。Claude Code 直接貼進對話即可。

03SAMPLE / 期待成果

[TRACK A] [CONFIDENCE: high] src/cart.ts:42 What: applyDiscount 在 items 為空陣列時回傳 NaN Why it matters: 空購物車結帳會把 NaN 寫進訂單金額,下游付款端會拋錯 Fix: const subtotal = items.reduce((a, i) => a + i.price, 0); if (items.length === 0) return 0; [TRACK B] [CONFIDENCE: medium] src/cart.ts:55 What: 手寫的 round-to-2 與既有 utils/money.ts 的 toCents() 重複 Why it matters: 兩套四捨五入邏輯會在邊界分歧(0.005) Fix: import { toCents } from '../utils/money' Track C: no issues found VERDICT: merge-after-fixes。先修 src/cart.ts:42 的空陣列 NaN,這會直接影響結帳。

這是預期成果的文字說明。請查看本文實測說明,並以自己的輸入素材小規模試用。

04VARIABLES / 變數說明

01[BASE_REF]

要 diff 的基準(如 main、HEAD~1、某 commit hash);留空預設 HEAD(即未提交的工作區變更)

02[FOCUS_AREAS]

想特別聚焦的面向(如「並發與資源洩漏」「輸入驗證」),留空則以正確性為主

05RESOLVER · 變數代入器0 / 2

填下面的欄位,上方 prompt 會即時替換 [方括號] 內容。填好後按「複製組好的 prompt」直接丟進工具。

修飾
Assembled · 填剩餘變數…
You are reviewing the current uncommitted change in this repository. Be a rigorous, skeptical reviewer — but only flag things you can defend. Do NOT invent problems to look useful.

## Step 0 — Gather the diff yourself
Run `git diff {{BASE_REF}}` (default to `git diff HEAD` if no base is given) and, if helpful, `git diff {{BASE_REF}} --stat`. Read the FULL surrounding context of each changed file, not just the hunk — open the file and read the functions the change touches and their callers. If an AGENTS.md / CLAUDE.md exists, read it for project conventions before judging style.

## Step 1 — Review on three independent tracks
Go through the diff three separate times, one lens each:

**Track A — Correctness (highest priority).** Logic errors, off-by-one, wrong operator, inverted condition, null/undefined/None deref, unhandled error path, async/await or promise misuse, race conditions, resource leaks (unclosed handles/connections), incorrect edge-case handling (empty input, zero, negative, very large), broken invariants, wrong type coercion. For each: explain the concrete input/scenario that triggers the bug.

**Track B — Simplification & reuse.** Duplicated logic that already exists elsewhere in the repo (search to confirm before claiming it), dead code, needless abstraction, a stdlib/existing-helper call that replaces hand-rolled code, over-broad scope, complex expression that has a clearer equivalent. Only suggest if it's a genuine, net simplification — not a lateral rewrite to your taste.

**Track C — Security.** Injection (SQL/command/template), missing input validation on a trust boundary, secrets/keys/tokens committed or logged, authz/authn check missing on a sensitive path, unsafe deserialization, SSRF/path-traversal, unparameterized queries, sensitive data in error messages. Flag only real, reachable issues in THIS diff.

## Step 2 — Output format
For each finding, output exactly:

```
[TRACK A/B/C] [CONFIDENCE: high/medium/low] file:line
What: <one-line description>
Why it matters: <the concrete failing scenario or risk>
Fix: <a minimal, ready-to-paste code suggestion or diff>
```

Order findings by track (A → B → C), then by confidence (high first). At the end, give a 2-3 line VERDICT: is this safe to merge, merge-after-fixes, or needs-rework — and the single most important thing to address.

## Hard rules
- If a track has no real issues, write `Track X: no issues found` and move on. Empty is a valid, good result.
- Never mark a guess as `high` confidence. Use `low` when you couldn't fully verify (e.g. behavior depends on code you couldn't read).
- Do NOT rewrite the whole file or restyle code that works. Scope = the diff.
- Cite real `file:line`. Do not fabricate line numbers — read the file to get them right.
- Focus on {{FOCUS_AREAS}} if specified; otherwise weight Track A heaviest.
FAQ · 常見問題

「Codex 嚴謹 diff 審查官:正確性、簡化、安全三軌過濾」這組提示詞要怎麼用?

這組 prompt 專為 Claude Code / Codex 設計。把 prompt 內 2 個方括號 [變數] 換成你自己的內容,貼進 Claude Code / Codex 執行即可。難度中等,照變數說明填好後即可上手。

「Codex 嚴謹 diff 審查官:正確性、簡化、安全三軌過濾」是免費的嗎?

完整 prompt 免費開放閱讀,不用註冊;可保存瀏覽器收藏,登入後可一鍵複製與留言。

用 Claude Code / Codex 依這組 prompt 生成的成果可以商用嗎?

prompt 文字本身你可自由使用與修改。但 AI 生成物(圖/音樂/影片/文字)的商用授權,取決於你在 Claude Code / Codex 使用的方案與其官方服務條款,請以該工具的授權規範為準。

RELATED你可能也需要

PRO01
TUTORIALSuno v5.5FEATURED
r/SunoAI (anonymous studio engineer)2026-06-12

Suno 工程師思維:4 步驟做出不像 AI 的歌

5.0(1)

Studio engineer 視角拆解 Suno 致命弱點(油炸 vocals、高頻 artifact)+ 4 步驟 DAW workflow + Suno Studio 修音 prompt

高階
Read

免費02
TUTORIALClaude 4.5 SonnetFEATURED
r/ClaudeAI2026-05-14

5 個 6 月 stuck 下來的 Claude 每週 workflow

提案產生器 / 會議處理器 / 內容再利用 / 週五回顧 / 收工 reset — 試了 40 個只有這 5 個沒被丟掉、各省 30+ 分鐘 / 次。

進階
Read

PRO03
TUTORIALClaude 4.5 SonnetFEATURED
r/PromptEngineering2026-05-14

7 個跨 model A/B 測過的 prompt 技巧(不是 vibes)

六個月在 Claude / GPT-4 / Gemini 上用人工 rater A/B 測 200+ prompt 後寫的。包含 persona+constraint stacking / anti-example / role reversal QA / cognitive scaffold / emotional priming / uncertainty CoT / steelman first。

高階
Read

免費04
TUTORIALChatGPTFEATURED
r/ChatGPTPromptGenius2026-05-14

5 個信任檢查單行 prompt(沒有 role-play)

一年的 role-play system prompt + 14-step framework 後總結:真正改變品質的是 5 個單行 prompt。沒有 role、沒有 markdown、沒有「you are an expert」。

入門
Read

免費 · 全文開放閱讀

完整 prompt 已經開放.

免登入閱讀全文、保存瀏覽器收藏;登入後可一鍵複製與留言討論。不用信用卡。

不想註冊?

留個 email,下次有新 prompt 會寄一封簡短摘要給你。退訂一鍵、不轉賣。

每週一期,新上架提示詞 + 模型測試心得。每封信底部都有一鍵取消訂閱。

或訂 RSS feed(30 秒一次的人味選擇)

COMMENTS · 討論區0 則
登入 後可留言。還沒帳號?註冊
目前沒有留言。第一個說說你的經驗。
EMBED · 嵌入 blog / Note一行 iframe HTML、貼進文章即顯示此 prompt 卡片+

適合:部落格、Medium、Notion 公開頁、Substack — 任何支援 iframe / HTML 嵌入的地方。對方點「看完整」會回到本站、是 prompt 庫的免費 backlink。

<iframe src="https://prompt.luvai.net/embed/codex-rigorous-diff-review" width="100%" height="380" frameborder="0" style="border:1px solid #e0dcd0;border-radius:4px;" loading="lazy" title="PromptCraft Embed"></iframe>
預覽 embed →380px tall · responsive width
發現這個 prompt 過時 / 跑不動 / 有錯字? 回報給我們 →