從寫程式碼,到創作下一幕

探索 字節跳動 - 火山方舟 的 AI 程式設計與影片創作活動。

Agent Plan & Coding Plan

一站體驗多款熱門模型,為 AI 程式設計與智能體開發提供更多選擇。新使用者可聯絡(微信: goo_lvyouyou)免費體驗 9.9 agent plan。

Seedance 2.5

讓創意,躍然成片。探索 30 秒影片、多模態參考與局部編輯,把腦海中的畫面變成下一支作品。

繁體中文

提示詞

提示詞

為 Chat、ChatGPT Work 和 Codex 編寫實用的提示詞。

提示詞概述

提示詞用於告訴 ChatGPT 你想了解、製作或更改什麼。提示詞 可以是問題、指令或目標。你不需要技術性語法或 固定公式。先用自己的語言表達,查看回復,再通過後續 訊息調整結果。

簡短的提示詞通常就已足夠。對於較大或更重要的任務,請加入 相關要素:

  • 目標: ChatGPT 應該做什麼?
  • 上下文: 哪些資訊或來源會有幫助?
  • 輸出: 你需要什麼格式、長度或詳細程度?
  • 邊界: 哪些內容必須保持不變?ChatGPT 應避免什麼,或在執行什麼操作前應先向你 確認?

只使用有幫助的部分。你不需要填寫每一項,也不必遵循 規定格式。

描述你需要的結果

從結果入手,而不是先列出詳細步驟。當受眾或 格式會影響 ChatGPT 應生成的內容時,請提供這些資訊。

Turn these meeting notes into a short update for the project team.
Put the decisions and next steps first.

這條提示詞說明了要建立什麼以及誰會閱讀。僅當流程 本身很重要時才描述流程。否則,請給 ChatGPT 留出搜尋、比較 資訊和調整方法的空間。

新增有用的上下文

分享可能改變結果的資訊。只新增重要的來源, 並說明 ChatGPT 應從每個來源中取得什麼。

  • 當你希望 ChatGPT 總結、比較、轉換內容或建立檔案供你審閱時, 請附加文件、電子表格、簡報或 PDF 檔案。
  • 當任務依賴視覺上下文時,請新增螢幕截圖、圖表或其他影像輸入。請指出 重要區域,不要只依賴影像本身。
  • 當答案依賴最新資訊時,讓 ChatGPT 使用網頁搜尋; 如果你需要核查結果,請要求提供來源。
  • 當相關聊天需要共享檔案、 來源或本機資料夾時,請使用專案

使用已連線的來源

當 ChatGPT 可以存取已連線的來源時,請指出它應在哪裡查詢以及要 查詢什麼。你不需要描述它應執行的每一次搜尋。

Use the latest project plan in Drive and relevant decisions and updates from
the project's Slack channel to prepare a status update.

已連線的來源需要相應外掛,是否可用可能取決於 你的方案和工作區設定。

使用外掛

外掛為 ChatGPT 和 Codex 提供可複用的指令,以及與 Google Drive、Gmail、Slack 和 GitHub 等工具的 連線。兩款產品從同一個通用目錄中取得公開 外掛。只需提出你需要的結果,讓當前介面從可用工具中 進行選擇。在 ChatGPT 中,在編輯器中輸入 @ 以選擇特定外掛。

瞭解外掛在 ChatGPT 和 Codex 中查詢、安裝和使用外掛。

個人化 ChatGPT

對於應應用於所有聊天的偏好,請在 Settings > Personalization 中將其設為 自定義指令。只與當前聊天有關的細節應放在 提示詞中。

檢視個人化設定設定默認個性、自定義指令和其他應用偏好。

設定邊界,避免實際問題

邊界是 ChatGPT 為避免產生額外工作或執行你無意授權的操作而需要遵循的 少數指令。如果改錯某個細節會導致 結果無法使用,或者你希望某項內容在影響他人之前先由你審閱, 請新增一條邊界。

  • 保持已核准的日期和預算數字不變。
  • 僅使用提供的來源。標記缺失資訊,不要猜測。
  • 建議不得超出規定預算。
  • 將訊息準備成草稿。不要傳送。

重點關注最重要的一兩項邊界。你不需要控制 ChatGPT 執行的每一步。

讓結果可以直接使用

告訴 ChatGPT 你計劃如何使用結果。這有助於它選擇合適的 長度、詳細程度和組織方式。

  • 將其整理成一頁摘要,供主管在會前快速瀏覽。將 決策和後續步驟放在最前面。
  • 將這些筆記整理成跟進郵件,其中包含決策、負責人和截止 日期。
  • 建立清晰的表格,對比計劃支出與實際支出,並突出顯示 超過 10% 的差異。

對於重要工作,請讓 ChatGPT 進行最終檢查,例如確認每個 行動項都有負責人和截止日期,或標記它無法 核實的資訊。然後在使用或分享結果前親自審閱。

通過後續訊息改善結果

第一條提示詞不需要完美。檢視結果,然後提出 你想要的具體修改。

Make the opening more direct, keep the evidence, and move the recommendation
above the background section.

你可以新增遺漏的來源、糾正方向、要求提供另一個選項,或 更改詳細程度,而無需從頭開始。

引導與排隊

當 Codex 正在工作時,你無需等待當前執行結束即可傳送另一條訊息:

  • Steer 將訊息新增到當前執行。可用它來改變方向、補充 遺漏的細節或分享新資訊。
  • Queue 儲存訊息,供下一次執行處理。適用於應等待 當前工作完成後再處理的後續事項。

在 ChatGPT 桌面應用中,可通過 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 桌面應用中,當編輯器可見時按 Ctrl+Shift+D, 然後開始說話。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 適合耗時或週期性任務,也適合建立可供你 複用的完整檔案。如果一項任務能夠節省時間、提高質量或幫助你作出重要決策, 即使它使用較多額度也可能值得。

先從一份可供審閱的結果開始:

  • 只包含相關來源,並在適當時限制日期範圍。
  • 明確受眾、輸出格式和所需長度。
  • 將必要工作與可選的改進或潤色分開。
  • 當方法很重要時,要求先制定計劃。要求 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 提示詞應說明所需行為、指出相關程式碼或 復現步驟、保留重要限制條件,並說明如何驗證 更改。

對於多步驟任務,如果你希望 Codex 在編輯前先調查並提出方案,請在應用編輯器中輸入 /plan。 當 Goal mode 可用時,在計劃之後使用 /goal 設定持久目標。有關當前命令列表,請參閱應用斜槓 命令

如何閱讀這些範例

每個工作流程都包括:

  • 適用場景以及最合適的 Codex 介面(IDE、CLI 或雲端)。
  • 包含使用者提示詞範例的步驟
  • 上下文說明:Codex 會自動看到什麼,以及你應該附加什麼。
  • 驗證:如何檢查輸出。

注意: IDE 擴充套件會自動將開啟的檔案加入上下文。在 CLI 中,請明確提及路徑,或使用 /mention@ 路徑自動補全來附加檔案。

Codex 在限制檔案和網路存取的沙箱中 執行本機命令。如果任務需要跨越該邊界, Codex 會按照你的核准策略繼續操作。

解釋程式碼庫

適用於入職、接手服務,或嘗試理解協議、資料模型或請求流程的場景。

IDE 擴充套件工作流程(最快的本機探索方式)

  1. 開啟最相關的檔案。
  2. 選擇你關注的程式碼(可選,但建議這樣做)。
  3. 向 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

驗證:

  • 要求提供可供你核實的圖表或檢查清單:
Summarize the request flow as a numbered list of steps. Then list the files involved.

CLI 工作流程(適合需要記錄和 shell 命令的場景)

  1. 啟動互動式會話:
   codex
  1. 附加檔案(可選)並輸入提示詞:
   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 附加特定檔案。

修復錯誤

適用於存在可在本機復現的異常行為時。

CLI 工作流程(緊密迴圈復現和驗證)

  1. 在程式碼儲存庫根目錄啟動 Codex:
   codex
  1. 向 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 提供:命令輸出、發現的呼叫位置,以及它觸發的所有堆疊跟蹤。

驗證:

  • 修復後,Codex 應重新運行復現步驟。
  • 如果你有標準檢查流水線,請讓它執行:
After the fix, run lint + the smallest relevant test suite. Report the commands and results.

IDE 擴充套件工作流程

  1. 開啟你認為存在錯誤的檔案,以及離它最近的呼叫方。
  2. 向 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 擴充套件工作流程(基於選擇內容)

  1. 開啟包含該函式的檔案。
  2. 選擇定義該函式的程式碼行。在命令面板中選擇 "Add to Codex Thread",將這些程式碼行新增到上下文。
  3. 向 Codex 輸入提示詞:
   Write a unit test for this function. Follow conventions used in other tests.

上下文說明:

  • 由 "Add to Codex Thread" 命令提供:選中的程式碼行(即“行號”範圍),以及開啟的檔案。

CLI 工作流程(在提示詞中描述路徑和行範圍)

  1. 啟動 Codex:
   codex
  1. 在提示詞中提供函式名稱:
   Add a test for the invert_list function in @transform.ts. Cover the happy path plus edge cases.

根據螢幕截圖製作原型

適用於需要將設計稿、螢幕截圖或 UI 參考轉換為可執行原型時。

CLI 工作流程(影像和提示詞)

  1. 將螢幕截圖儲存到本機(例如 ./specs/ui.png)。
  2. 執行 Codex:
   codex
  1. 將影像檔案拖入終端,以附加到提示詞中。

  2. 繼續補充限制條件和結構:

   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

上下文說明:

  • 影像提供視覺要求,但你仍需指定實現限制條件(框架、路由、元件樣式)。
  • 用文字說明影像未展示的行為,例如懸停狀態、驗證規則或鍵盤互動。

驗證:

  • 讓 Codex 執行開發伺服器(如果允許),並明確告訴你應在哪裡檢視:
Start the dev server and tell me the local URL/route to view the prototype.

IDE 擴充套件工作流程(影像和現有檔案)

  1. 在 Codex 聊天中附加影像(拖放或貼上)。
  2. 向 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,然後使用簡短提示詞迭代)

  1. 啟動 Codex:
   codex
  1. 在單獨的終端視窗中啟動開發伺服器:
   npm run dev
  1. 向 Codex 輸入提示詞以進行更改:
   Propose 2-3 styling improvements for the landing page.
  1. 選擇一個方向,並通過簡短、具體的提示詞進行迭代:
   Go with option 2.

   Change only the header:
   - make the typography more editorial
   - increase whitespace
   - ensure it still looks good on mobile
  1. 繼續提出有針對性的請求:
   Next iteration: reduce visual noise.
   Keep the layout, but simplify colors and remove any redundant borders.

驗證:

  • 在 Codex 更新程式碼時,在瀏覽器中檢查更改。
  • 提交你滿意的更改,還原你不滿意的更改。
  • 如果你還原或修改了某項編輯,請告知 Codex,以免它在處理下一條提示詞時覆蓋你的編輯。

將重構工作委派到雲端

適用於希望利用本機上下文設計方案,然後將耗時較長的實現委派給可並行執行的雲端聊天時。

本機規劃(IDE)

  1. 確保當前工作已提交或至少已暫存,以便清晰地比較更改。
  2. 讓 Codex 制定重構計劃。如果 $plan 技能可用,請明確呼叫它:
   $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
  1. 審閱計劃並協商修改:
   Revise the plan to:
   - specify exactly which files move in each milestone
   - include a rollback strategy

上下文說明:

  • 當 Codex 可以在本機掃描當前程式碼(入口點、模組邊界、依賴圖線索)時,規劃效果最佳。

雲端委派(IDE → Cloud)

  1. 如果尚未設定,請先設定 Codex 雲端環境
  2. 單擊提示詞編輯器下方的雲圖標,然後選擇你的雲端環境。
  3. 輸入下一條提示詞時,Codex 會在雲端建立一個新聊天,並帶上現有聊天上下文(包括計劃和所有本機源程式碼更改)。
   Implement Milestone 1 from the plan.
  1. 審閱雲端 diff,並按需迭代。

  2. 直接從雲端建立 PR,或將更改拉取到本機進行測試並完成收尾工作。

  3. 繼續迭代計劃中的其他里程碑。

委派到雲端的任務在隔離環境中執行。除非你為該環境啟用網際網路存取, 否則智能體階段的網際網路存取處於關閉狀態。進一步瞭解 雲端網際網路存取

執行本機程式碼審查

適用於希望在提交或建立 PR 前獲得另一方審查意見時。

CLI 工作流程(審查工作樹)

  1. 啟動 Codex:
   codex
  1. 執行審查命令:
   /review
  1. 可選:提供自定義審查重點:
   /review Focus on edge cases and security issues

驗證:

  • 根據審查回饋應用修復,然後重新執行 /review,確認問題已解決。

審查 GitHub 拉取請求

適用於希望在不將分支拉取到本機的情況下獲得審查回饋時。

使用此功能前,請在程式碼儲存庫中啟用 Codex Code review。請參閱程式碼審查

GitHub 工作流程(由評論驅動)

  1. 在 GitHub 上開啟拉取請求。
  2. 留下評論,標記 Codex 並明確說明審查重點:
   @codex review
  1. 可選:提供更明確的指令。
   @codex review for security vulnerabilities and security concerns

更新文件

適用於需要準確、清晰地更改文件時。

IDE 或 CLI 工作流程(本機編輯和本機驗證)

  1. 找到要更改的文件檔案並將其開啟(IDE),或使用 @ 提及它們(IDE 或 CLI)。
  2. 向 Codex 提供包含範圍和驗證要求的提示詞:
   Update the "advanced features" documentation to provide authentication troubleshooting guidance. Verify that all links are valid.
  1. Codex 起草更改後,審閱文件並按需迭代。

驗證:

  • 閱讀渲染後的頁面。