把一句模糊的需求,套成 Codex 的完整工作流:先逼它釐清『完成定義』、用 plan mode 給出計畫讓你核可,再小步實作、自己跑測試、最後產出可審查的 diff 與驗證證據。
Act as a disciplined pair-programmer working in this repo. We are going to run a single task through four explicit gates. Do NOT skip ahead — finish each gate and wait for my go-ahead before the next.
TASK (raw, possibly fuzzy): {{TASK}}
RELEVANT FILES / AREAS (optional, @-mention or paths): {{CONTEXT_FILES}}
HARD CONSTRAINTS (must respect): {{CONSTRAINTS}}
--- GATE 1: FRAME THE TASK ---
Before touching code, restate the task in your own words and produce:
- **Goal** — what changes and why, in 1-2 sentences.
- **Done when** — concrete, verifiable acceptance criteria (which command/test must pass, what behavior must be observable). If I gave none, propose them.
- **Open questions** — anything ambiguous that would change your approach. Ask me only the questions that actually block you. If there are none, say "no blockers".
Then STOP and let me confirm or correct.
--- GATE 2: PLAN (use plan mode) ---
Enter plan mode. Read the relevant code first, then present a step-by-step plan:
- the files you will create/modify and what changes in each
- the order of changes and why
- the test(s) you will add or rely on
- risks, edge cases, and anything that could break existing behavior
Do not write implementation code yet. Present the plan, then STOP for my approval. If I push back, revise the plan — don't start coding until I say go.
--- GATE 3: IMPLEMENT IN SMALL STEPS ---
Once I approve the plan, implement it. Rules:
- Work in coherent small steps; keep changes scoped to the plan. If you discover the plan was wrong, pause and tell me before diverging.
- Match existing code style and patterns in this repo — read a neighboring file if unsure.
- Respect all HARD CONSTRAINTS above and anything in AGENTS.md.
- Do not introduce TODOs, placeholder functions, or stubbed logic. Either implement it or explain why it's out of scope.
--- GATE 4: VERIFY & REPORT ---
Before you claim it's done, actually verify:
1. Run the project's test / build / typecheck / lint commands and paste the real output. Do not say "should pass" — run it.
2. Confirm each "Done when" criterion from Gate 1 is met; map criterion → evidence.
3. Show me the final diff summary (files touched + a one-line reason each).
4. List anything you did NOT do, known limitations, or follow-ups.
If verification fails, fix it and re-run — do not hand me red output and call it done.
Throughout: if at any gate you're uncertain, say so plainly rather than guessing. A flagged unknown beats a confident wrong answer.不用離開網站,直接看這組 prompt 跑出來長怎樣(AI 即時生成,扣 1 點)。
不只複製貼上 — 下載後放到 ~/.codex/prompts/task-intake-plan-diff-verify.md,之後輸入 /task-intake-plan-diff-verify 一鍵呼叫。
mkdir -p ~/.codex/prompts && mv ~/Downloads/task-intake-plan-diff-verify.md ~/.codex/prompts/task-intake-plan-diff-verify.mdNew-Item -ItemType Directory -Force "$env:USERPROFILE\.codex\prompts" | Out-Null; Move-Item "$env:USERPROFILE\Downloads\task-intake-plan-diff-verify.md" "$env:USERPROFILE\.codex\prompts\task-intake-plan-diff-verify.md"何時用:任何非 trivial 的 Codex 任務(加功能、修 bug、改架構),尤其是你不想盯著它每一步、又怕它亂改的時候。為何有效:Codex 官方 best practice 就是把任務當『有明確 context 和完成定義的隊友』來帶——這支把它落成四道強制關卡。Gate 1 逼出可驗收的『Done when』,Gate 2 用真實存在的 plan mode(/plan 或 Shift+Tab)讓它先讀碼再給計畫等你核可,避免一頭栽進去改錯方向;Gate 3 要求小步、禁 placeholder;Gate 4 要求『真的跑測試貼 output』而非『應該會過』。技巧:把卡關設計成需要你點頭才前進,等於用 approval 機制換取掌控感;CONTEXT_FILES 用 @ 提及具體檔案能大幅提升計畫品質。
GATE 1 — FRAME Goal: After login, redirect the user back to the page they came from instead of always /dashboard. Done when: visiting /watchlist while logged out, logging in, lands back on /watchlist; existing /dashboard default still works when there's no return path; `npx tsc --noEmit` passes. Open questions: Should the return_to be validated against an allowlist to avoid open-redirect? (recommend yes) — no other blockers. [STOP — awaiting your confirmation] GATE 2 — PLAN 1. middleware.ts: capture original path into a signed `return_to` cookie on the redirect-to-login. 2. app/login/route.ts: after successful auth, read return_to, validate it's a same-origin relative path, else fall back to /dashboard. 3. Add test in __tests__/login-redirect.test.ts covering: valid return, missing return, open-redirect attempt. Risks: open-redirect if return_to isn't validated; cookie must be httpOnly + same-site. [STOP — awaiting plan approval]
以上為此 Prompt 丟進 OpenAI Codex 後可得到的描述性成果,實際畫面會因填入的變數而有差異。
[TASK]你要 Codex 做的事,可以是很口語的一句話,例如『把登入後的轉址改成回到原本頁面』
[CONTEXT_FILES]相關檔案或目錄(可選),用 @ 提及或貼路徑,例如 @app/login/route.ts、middleware.ts;不確定就留空讓它自己找
[CONSTRAINTS]硬限制,例如『不准動 D1 migration』『不可改動點數扣款邏輯』『維持現有 API 介面』;沒有就寫 none
填下面的欄位,上方 prompt 會即時替換 [方括號] 內容。填好後按「複製組好的 prompt」直接丟進工具。
Act as a disciplined pair-programmer working in this repo. We are going to run a single task through four explicit gates. Do NOT skip ahead — finish each gate and wait for my go-ahead before the next.
TASK (raw, possibly fuzzy): {{TASK}}
RELEVANT FILES / AREAS (optional, @-mention or paths): {{CONTEXT_FILES}}
HARD CONSTRAINTS (must respect): {{CONSTRAINTS}}
--- GATE 1: FRAME THE TASK ---
Before touching code, restate the task in your own words and produce:
- **Goal** — what changes and why, in 1-2 sentences.
- **Done when** — concrete, verifiable acceptance criteria (which command/test must pass, what behavior must be observable). If I gave none, propose them.
- **Open questions** — anything ambiguous that would change your approach. Ask me only the questions that actually block you. If there are none, say "no blockers".
Then STOP and let me confirm or correct.
--- GATE 2: PLAN (use plan mode) ---
Enter plan mode. Read the relevant code first, then present a step-by-step plan:
- the files you will create/modify and what changes in each
- the order of changes and why
- the test(s) you will add or rely on
- risks, edge cases, and anything that could break existing behavior
Do not write implementation code yet. Present the plan, then STOP for my approval. If I push back, revise the plan — don't start coding until I say go.
--- GATE 3: IMPLEMENT IN SMALL STEPS ---
Once I approve the plan, implement it. Rules:
- Work in coherent small steps; keep changes scoped to the plan. If you discover the plan was wrong, pause and tell me before diverging.
- Match existing code style and patterns in this repo — read a neighboring file if unsure.
- Respect all HARD CONSTRAINTS above and anything in AGENTS.md.
- Do not introduce TODOs, placeholder functions, or stubbed logic. Either implement it or explain why it's out of scope.
--- GATE 4: VERIFY & REPORT ---
Before you claim it's done, actually verify:
1. Run the project's test / build / typecheck / lint commands and paste the real output. Do not say "should pass" — run it.
2. Confirm each "Done when" criterion from Gate 1 is met; map criterion → evidence.
3. Show me the final diff summary (files touched + a one-line reason each).
4. List anything you did NOT do, known limitations, or follow-ups.
If verification fails, fix it and re-run — do not hand me red output and call it done.
Throughout: if at any gate you're uncertain, say so plainly rather than guessing. A flagged unknown beats a confident wrong answer.這組 prompt 專為 OpenAI Codex 設計。把 prompt 內 3 個方括號 [變數] 換成你自己的內容,貼進 OpenAI Codex 執行即可。難度中等,照變數說明填好後即可上手。
完整 prompt 免費開放閱讀,不用註冊;登入後可一鍵複製、收藏與留言。
prompt 文字本身你可自由使用與修改。但 AI 生成物(圖/音樂/影片/文字)的商用授權,取決於你在 OpenAI Codex 使用的方案與其官方服務條款,請以該工具的授權規範為準。
Studio engineer 視角拆解 Suno 致命弱點(油炸 vocals、高頻 artifact)+ 4 步驟 DAW workflow + Suno Studio 修音 prompt
提案產生器 / 會議處理器 / 內容再利用 / 週五回顧 / 收工 reset — 試了 40 個只有這 5 個沒被丟掉、各省 30+ 分鐘 / 次。
適合:部落格、Medium、Notion 公開頁、Substack — 任何支援 iframe / HTML 嵌入的地方。對方點「看完整」會回到本站、是 prompt 庫的免費 backlink。
<iframe src="https://prompt.luvai.net/embed/codex-task-intake-plan-diff-verify" width="100%" height="380" frameborder="0" style="border:1px solid #e0dcd0;border-radius:4px;" loading="lazy" title="PromptCraft Embed"></iframe>
把方括號 [ ] 內的變數換成你的內容,丟進 OpenAI Codex。
六個月在 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。
一年的 role-play system prompt + 14-step framework 後總結:真正改變品質的是 5 個單行 prompt。沒有 role、沒有 markdown、沒有「you are an expert」。