提示詞
為 Chat、ChatGPT Work 與 Codex 編寫有效提示詞。
提示詞概覽
提示詞是你告訴 ChatGPT 想知道、建立或修改什麼的方式。它可以是問題、指令或目標,不需要技術語法或僵硬公式。先用自己的話描述需求,檢查回復,再用後續訊息逐步完善結果。
簡短提示詞通常已經足夠。對於更大或更重要的任務,可以加入真正影響結果的部分:
- 目標: ChatGPT 應完成什麼?
- 上下文: 哪些資訊或來源會有幫助?
- 輸出: 需要什麼格式、長度或細節層次?
- 邊界: 哪些內容必須保持不變?ChatGPT 應避免什麼,或執行前先向你確認什麼?
只使用有幫助的部分即可,不需要機械填滿每一項,也沒有強制格式。
描述所需結果
先描述結果,而不是一開始就列出詳細步驟。當受眾或格式會改變輸出方式時,把它們一併寫清楚。
Turn these meeting notes into a short update for the project team.
Put the decisions and next steps first.這條提示詞說明了要建立什麼,以及誰會閱讀。只有當過程本身很重要時才明確規定過程;否則,可以讓 ChatGPT 自行搜尋、比較資訊並調整做法。
新增有用上下文
提供可能改變結果的資訊。只加入重要來源,並說明 ChatGPT 應從每個來源中提取什麼。
- 當需要總結、比較、轉換內容或建立可審查檔案時,附加文件、電子表格、簡報或 PDF。
- 任務依賴視覺上下文時,新增截圖、流程圖或其他圖片輸入,並指出關鍵區域,不要只依賴圖片本身。
- 答案依賴最新資訊時,讓 ChatGPT 使用 Web 搜尋;需要核對結果時,要求提供來源。
- 當相關聊天需要共享檔案、來源或本機資料夾時,使用專案。
使用連線來源
如果 ChatGPT 可以存取連線來源,請說明應去哪裡查詢,以及要找什麼,不需要逐條規定每一次搜尋。
Use the latest project plan in Drive and relevant decisions and updates from
the project's Slack channel to prepare a status update.連線來源需要匹配的 plugin;是否可用可能取決於套餐和工作區設定。
使用 plugins
plugins 為 ChatGPT 提供可複用指令,並連線 Google Drive、Gmail、Slack、GitHub 等工具。描述所需結果,讓 ChatGPT 從可用工具中選擇;如果要指定 plugin,請在輸入框中輸入 @。
個人化 ChatGPT
希望在所有聊天中生效的偏好,可以作為自定義指令放到 Settings > Personalization(設定 > 個人化)。只與當前聊天有關的細節應保留在提示詞中。
檢視個人化設定設定預設性格、自定義指令和其他偏好。對話執行緒與持續上下文
一條對話執行緒包含你的提示詞、模型回覆和工具呼叫。後續訊息會繼續使用同一執行緒的上下文,因此適合在同一結果上補充來源、糾正方向、新增測試或要求修改。
你可以並行執行多條執行緒,但不要讓兩條執行緒同時修改同一批檔案。編碼任務需要並行時,優先使用獨立工作樹。
所有上下文都必須放入模型的上下文視窗。長任務中,ChatGPT 或 Codex 可能通過總結相關資訊、捨棄次要細節的方式壓縮上下文。即使系統會自動壓縮,也應主動減少無關檔案、重複日誌和已經失效的要求。
設定能夠避免實際問題的邊界
邊界是少量但關鍵的指令,用來避免產生額外工作,或執行你沒有打算核准的動作。當改錯一個細節會讓結果無法使用,或者操作影響他人前需要審查時,就應加入邊界。
- 保持已核准的日期和預算數字不變。
- 只使用提供的來源;缺少資訊時明確標記,不要猜測。
- 建議不得超出預算範圍。
- 只把訊息準備成草稿,不要傳送。
聚焦最重要的一兩個邊界,不需要控制 ChatGPT 的每一個步驟。
讓結果可以直接使用
告訴 ChatGPT 結果將如何使用,這會幫助它選擇合適的長度、細節和組織方式。
- 建立一頁式摘要,讓負責人可以在會前快速瀏覽,並把決策和下一步放在前面。
- 把筆記整理成跟進郵件,包含決策、負責人和截止日期。
- 建立計劃支出與實際支出的清晰表格,並突出超過 10% 的差異。
對於重要工作,應要求最終檢查,例如確認每個行動項都有負責人和截止日期,或標明無法核實的資訊。使用或分享前仍需由你親自審查。
通過後續訊息改善結果
第一條提示詞不必完美。檢查結果後,直接描述希望改變的部分。
Make the opening more direct, keep the evidence, and move the recommendation
above the background section.無需從頭開始,就可以補充來源、糾正方向、要求另一種方案或改變細節層次。
Steering 與 queuing
Codex 工作時,不必等待當前執行結束也可以傳送訊息:
- Steer(引導) 把訊息加入當前執行,用於改變方向、補充遺漏細節或提供新資訊。
- Queue(排隊) 把訊息留給下一次執行,適合需要等當前工作結束後再處理的後續事項。
在 ChatGPT 桌面 App 中,可以通過 Settings > General > Follow-up behavior選擇預設行為。排隊訊息會顯示在輸入框上方,可以編輯、排序、傳送或刪除。
在 Codex CLI 中,Codex 工作時按 Enter 引導當前會話輪次,按 Tab 將訊息排到下一輪。詳情見互動快捷鍵。
把各部分組合起來
下面是一條使用連線來源準備專案更新的完整提示詞:
Prepare a one-page project status update for Monday's leadership meeting. Use
the latest project plan in Drive and relevant decisions and updates from the
project's Slack channel.
Lead with the decisions leadership needs to make and the next steps. Summarize
progress, risks, owners, and due dates. Keep approved dates and budget figures
unchanged. Flag any conflicting or missing information, and don't send or
publish anything.
Before you finish, check that every next step has an owner and due date.這條提示詞包含目標、上下文、輸出和邊界,並要求最終檢查,但沒有規定每個執行步驟。
使用語音聽寫
在 ChatGPT 桌面 App 的輸入框可見時,按住 Ctrl+M 並開始說話。ChatGPT 會把語音轉寫到輸入框中,你可以先檢查和編輯,再傳送提示詞。
Chat 提示詞範例
Chat 適合提問、發展想法、起草內容和處理日常決策。先說明結果,再加入真正會改變答案的細節。
理解一個主題
Explain how compound interest works for someone who has never invested.
Use one concrete example and define any financial terms you introduce.起草並修改文字
Draft a friendly email declining this invitation because I will be traveling.
Keep it under 120 words and leave the door open for a future event.比較選項
Compare these two phone plans for one person who travels internationally twice
a year. Show the important differences in a table, then recommend one and explain
the tradeoff.制定實用計劃
Plan five weekday dinners that take less than 30 minutes. Avoid peanuts, reuse
ingredients across meals, and finish with one consolidated shopping list.ChatGPT Work 提示詞
Chat 適合快速提問、簡短改寫、頭腦風暴和輕量草稿。任務需要多個來源或工具、包含一系列步驟、會執行修改,或要產出更大的交付物時,使用 ChatGPT Work。
在 ChatGPT Work 中描述所需結果,提供來源材料,說明受眾和審查方式,並要求 ChatGPT 規劃、收集資訊、建立檔案和完成檢查。
高效使用 ChatGPT Work
ChatGPT Work 適合耗時或重複任務,以及可複用的完整檔案。即使任務消耗更多 credits,只要節省時間、提高質量或支援重要決策,也可能值得。
先從一個可以審查的結果開始:
- 只加入相關來源,並在適用時限制日期範圍。
- 定義受眾、輸出格式和期望長度。
- 區分必需工作與可選改進或潤色。
- 當實現方式很重要時要求先給計劃;ChatGPT 傳送、釋出或修改他人依賴的資訊前,必須獲得你的核准。
- 如果任務開始執行不再需要的工作,及時收窄範圍或停止。
審查第一版結果,改進指令,並在工作流程穩定後複用。
把來源材料轉換成完整檔案
Use the attached quarterly reports to create a leadership brief and a six-slide
presentation.
The audience is the executive team. Lead with the three decisions they need to
make, distinguish reported facts from your analysis, cite each number to its
source file, and check that the brief and slides agree before you finish.研究一項決策
Research three customer-support platforms for a 50-person company. Compare
pricing, security, integrations, and migration effort using current sources.
Deliver a recommendation memo with links, assumptions, and the questions we
should answer before signing a contract.協調一次釋出
Create a launch plan for the attached product brief. Include the timeline,
owners, dependencies, risks, announcement draft, customer FAQ, and a checklist
for launch day. Flag any missing decisions before producing the final files.對於重複工作,先在普通聊天中把提示詞調整穩定,再在該聊天中安排任務。如果每次計劃執行都應開始一個新聊天,則建立獨立定時任務。
Codex 提示詞
需要 ChatGPT 處理程式碼、程式碼庫或開發者工具時,使用 Codex。有效的 Codex 提示詞應說明需要的行為,指向相關程式碼或復現步驟,保留重要約束,並明確如何驗證改動。
計劃模式與 Goal mode
對於多步驟任務,希望 Codex 在改動前調查並提出方案時,在 App 輸入框中使用 /plan。當 Goal mode 可用時,可以在計劃明確後使用 /goal 設定持續目標。當前命令列表見 App 斜槓命令。
目標文本會同時作為起始提示詞和完成標準。一個好目標通常包含具體產出、必要約束,以及可衡量的測試或審查標準。
Migrate this codebase from JavaScript to TypeScript. Preserve existing behavior,
compile in strict mode without explicit `any` types, and make the full test suite pass.目標啟動後仍可繼續引導 Codex,補充庫、相容性或禁止方案等約束。需要狀態回顧但不想幹擾主任務時,可以使用 Side conversation(側邊會話)。
如何閱讀下面的範例
每個工作流程包含:
- 適用場景以及更適合的 Codex 入口(IDE、CLI 或雲端)。
- 帶有使用者提示詞範例的步驟。
- 上下文說明:Codex 會自動看到什麼,哪些內容需要主動附加。
- 驗證方式:如何檢查輸出。
Codex 會在沙箱中執行本機命令,限制檔案和網路存取。任務需要越過邊界時,Codex 會按審批策略處理。
解釋程式碼庫
適合剛開始瞭解專案、接手服務,或需要理解協議、資料模型和請求流時使用。
IDE 擴充套件工作流程
開啟最相關的檔案。
選中關心的程式碼(可選,但建議這樣做)。
向 Codex 傳送:
Explain how the request flows through the selected code. Include: - a short summary of the responsibilities of each module involved - what data is validated and where - one or two "gotchas" to watch for when changing this
驗證時,讓 Codex 生成可以逐項核對的步驟和檔案列表:
Summarize the request flow as a numbered list of steps. Then list the files involved.CLI 工作流程
啟動互動式會話:
codex附加檔案並傳送:
I need to understand the protocol used by this service. Read @foo.ts @schema.ts and explain the schema and request/response flow. Focus on required vs optional fields and backward compatibility rules.
在輸入框中使用 @ 插入工作區路徑,或用 /mention 附加特定檔案。
修復 bug
當錯誤可以在本機復現時,向 Codex 提供復現步驟、相關檔案、約束和驗證方法。
CLI 工作流程
在儲存庫根目錄啟動 Codex:
codex提供復現步驟:
Bug: Clicking "Save" on the settings screen sometimes shows "Saved" but doesn't persist the change. Repro: 1) Start the app: npm run dev 2) Go to /settings 3) Toggle "Enable alerts" 4) Click Save 5) Refresh the page: the toggle resets Constraints: - Do not change the API shape. - Keep the fix minimal and add a regression test if feasible. Start by reproducing the bug locally, then propose a patch and run checks.
你提供的復現步驟和約束通常比高層問題描述更重要;Codex 則會補充命令輸出、呼叫點和它觸發的堆疊資訊。
修復後要求重新執行復現步驟,並執行最小相關檢查:
After the fix, run lint + the smallest relevant test suite. Report the commands and results.IDE 擴充套件工作流程
開啟可能包含 bug 的檔案及其最近呼叫方。
向 Codex 傳送:
Find the bug causing "Saved" to show without persisting changes. After proposing the fix, tell me how to verify it in the UI.
編寫測試
需要明確限定測試範圍時,可以基於 IDE 選區或 CLI 中的函式名和路徑提出請求。
IDE 擴充套件工作流程
開啟包含目標函式的檔案。
選中函式定義,並從命令面板選擇 Add to Codex Thread。
傳送:
Write a unit test for this function. Follow conventions used in other tests.
CLI 工作流程
啟動 Codex:
codex按函式名給出提示詞:
Add a test for the invert_list function in @transform.ts. Cover the happy path plus edge cases.
根據截圖製作原型
當你有設計稿、截圖或 UI 參考,需要轉換成可執行原型時使用。
CLI 工作流程
把截圖儲存到本機,例如
./specs/ui.png。執行 Codex:
codex把圖片拖入終端附加到提示詞。
補充實現約束和交付物:
Create a new dashboard based on this image. Constraints: - Use react, vite, and tailwind. Write the code in typescript. - Match spacing, typography, and layout as closely as possible. Outputs: - A new route/page that renders the UI - Any small components needed - README.md with instructions to run it locally
截圖提供視覺要求,但框架、路由、元件方式,以及 hover、校驗和鍵盤互動等不可見行為仍應通過文字說明。
驗證時,讓 Codex 啟動開發伺服器並給出準確地址:
Start the dev server and tell me the local URL/route to view the prototype.IDE 擴充套件工作流程
在 Codex 聊天中附加圖片(拖放或貼上)。
向 Codex 傳送:
Create a new settings page. Use the attached screenshot as the target UI. Follow design and visual patterns from other files in this project.
通過即時更新迭代 UI
需要保持“設計、微調、重新整理、繼續微調”的迴圈時,可以在另一個終端中執行開發伺服器,再讓 Codex 進行小而聚焦的改動。
CLI 工作流程(執行 Vite,並用小提示詞迭代)
啟動 Codex:
codex在另一個終端視窗中啟動開發伺服器:
npm run dev讓 Codex 提出改動方向:
Propose 2-3 styling improvements for the landing page.選定一個方向後,用小而具體的提示詞迭代:
Go with option 2. Change only the header: - make the typography more editorial - increase whitespace - ensure it still looks good on mobile繼續提出聚焦請求:
Next iteration: reduce visual noise. Keep the layout, but simplify colors and remove any redundant borders.
每輪都在瀏覽器中檢查結果。保留喜歡的改動,撤銷不需要的改動;手動撤銷或修改後應告訴 Codex,避免後續覆蓋。
把重構委派到雲端
當你希望先結合本機上下文設計方案,再把長時間實現委派給並行雲端聊天時使用。
本機規劃(IDE)
提交或暫存當前工作,保證後續可以清晰比較。
讓 Codex 先制定重構計劃:
$plan We need to refactor the auth subsystem to: - split responsibilities (token parsing vs session loading vs permissions) - reduce circular imports - improve testability Constraints: - No user-visible behavior changes - Keep public APIs stable - Include a step-by-step migration plan審查並修改計劃:
Revise the plan to: - specify exactly which files move in each milestone - include a rollback strategy
雲端委派(IDE → Cloud)
設定 Codex 雲端環境,在 IDE 中選擇雲端環境,然後傳送:
Implement Milestone 1 from the plan.審查雲端 diff,在本機執行測試,再建立 PR 或繼續下一里程碑。
雲端任務執行在隔離環境中;除非為環境啟用,否則智能體階段沒有網際網路存取。詳情見雲端網路存取。
執行本機程式碼審查
CLI 工作流程(審查當前工作樹)
啟動 Codex:
codex執行審查命令:
/review(可選)提供自定義關注點:
/review Focus on edge cases and security issues
根據回饋修復後,再次執行 /review 驗證問題是否已經解決。
審查 GitHub PR
GitHub 工作流程(評論驅動)
如果希望在不把分支拉到本機的情況下獲得回饋,先為儲存庫啟用 Codex Code review(程式碼審查),詳情見程式碼審查。
在 GitHub 中開啟 PR。
留言並明確標記 Codex 與關注範圍:
@codex review(可選)補充更明確的指令:
@codex review for security vulnerabilities and security concerns
更新文件
IDE 或 CLI 工作流程(本機編輯與驗證)
明確要修改的文件檔案,並在 IDE 中開啟或通過
@提及(IDE 或 CLI)。向 Codex 說明範圍和驗證要求:
Update the "advanced features" documentation to provide authentication troubleshooting guidance. Verify that all links are valid.Codex 起草後,審查文件並按需要繼續迭代。
驗證時,應閱讀渲染頁面,檢查標題結構、程式碼塊、連結和範例,而不只是檢視原始 Markdown diff。