你在 Claude Code 裡輸入什麼,決定了 AI 能幫你做多少事。
Anthropic 在 Claude Code 官方文件中提供了一個 Prompt Library(提示詞庫),收錄 52 組可直接複製貼上的提示詞,來源包括 Common workflows、Best practices、How Anthropic teams use Claude Code、Scaling agentic coding guide,以及法務、行銷、資安團隊的深度報告,並標記哪些角色最適合使用,並附上「為什麼這樣寫有效」的說明,讓你不只知道怎麼用,還能舉一反三。
這篇文章直接幫你整理成可查表的格式,不論是工程師、PM 還是設計師,找到對應場景、複製貼上即可使用。
5 大階段、52 組提示詞一次整理
官方將所有提示詞按軟體開發生命週期排列,涵蓋探索代碼庫、設計規劃、實作測試,一路到上線後的監控維運。以下按五大階段整理,依序為:Discover(探索)、Design(設計)、Build(實作)、Ship(版本發佈)、Operate(維運),點擊即可前往指定段落閱讀。
{大括號}內為可替換的欄位。
階段一、Discover:探索代碼庫
剛接手一個不熟悉的專案?這個階段的提示詞幫你快速建立對代碼庫的掌握。設計邏輯為:描述你想知道什麼,而不是指定要讀哪些檔案。Claude 會自己探索專案結構並回傳摘要,搜尋時也用「行為」而非「檔名」當關鍵字,即使你不知道功能在哪個目錄也能找到。
最後兩組提示詞特別適合 PM 和設計師用來評估改動範圍,不需要具備工程背景也能直接使用。
| 用途 | 提示詞 |
|---|---|
| 快速了解整體架構 | give me an overview of this codebase: architecture, key directories, and how the pieces connect |
| 解釋特定檔案 | explain what {src/scheduler/queue.ts} does and how data flows through it. write it up as {an HTML page with a diagram, then open it in my browser} |
| 找特定功能在哪 | where do we {validate uploaded file types}? |
| 刪東西前先確認影響範圍 | what would break if I deleted {the retryWithBackoff helper}? |
| 追蹤代碼演變歷史 | look through the commit history of {internal/auth/session.go} and summarize how it evolved and why |
| 估算異動範圍(PM、設計適用) | which files would I need to touch to {add a dark mode toggle to settings}? |
| 向代碼庫問產品問題(PM 適用) | I am a {PM}. walk me through what happens when a user {clicks Export to PDF}, from the UI down to the result |
階段二、Design:設計與原型
從開會記錄到產品規格書,這個階段適合 PM、設計師和行銷介入。
此階段的提示詞刻意把「探索」和「動手」分開,如「先列出要改的檔案,但先不要動」,你就能在任何程式碼移動之前確認方向。訪談式寫規格書的設計邏輯是:讓 Claude 問你問題,而不是你描述需求。結構化提問往往能逼出你自己沒想到的邊界條件。
| 用途 | 提示詞 |
|---|---|
| 規劃多檔案改動(先看再動) | plan how to refactor the {payment module} to {support multiple currencies}. list the files you would change, but don't edit anything yet |
| 用訪談方式寫規格書 | I want to build {per-workspace rate limits}. interview me about implementation, UX, edge cases, and tradeoffs until we have covered everything, then write the spec to SPEC.md |
| 把會議記錄變成工作項目 | read {@meeting-notes.md} and write up the action items, then create a {Linear} ticket for each with acceptance criteria |
| 列出設計需要處理的邊界狀態 | list the error states, empty states, and edge cases for {the file upload flow} that the design needs to cover |
| 把設計稿變成可點擊原型 | here is a mockup. build a working prototype I can click through, matching the layout and states shown |
| 截圖實作並自動比對差異 | implement this design, then take a screenshot of the result, compare it to the original, and fix any differences |
階段三、Build:實作、測試、重構、審查、修正
實作類
指定一個現有檔案或模式當參考,Claude 就會按照你的代碼庫習慣來寫,而不是套用一般最佳實踐。沒有參照物時,Claude 會自行判斷風格,結果可能與現有代碼不一致。部分提示詞適合非工程師使用,包括 PM、設計師、行銷與文件撰寫人員。
| 用途 | 提示詞 |
|---|---|
| 參考現有模式寫新功能 | look at how {the GitHub webhook handler} is implemented to understand the pattern, then build {a Stripe webhook handler} the same way |
| 幫沒有文件的函式補 JSDoc | find {the public functions in src/auth/} without {JSDoc} comments and add them, matching the style already used in the file |
| 加一個小型 endpoint | add a {/health} endpoint that returns {the app version and uptime} |
| 做一個小型內部工具(非工程師適用) | create a {drag-and-drop Kanban board with three columns} using HTML, CSS, and vanilla JavaScript, then open it in my browser |
| 直接從 issue 編號工作 | read issue #{312}, implement the fix, and run the tests |
| 找出所有相同文案並統一修改 | find every place we say "{Sign up free}" or a close variant, show me each one in context, then update them all to "{Start free trial}". leave tests and the changelog alone |
| 參考既有範本寫新文件 | read the {privacy impact assessments} in {legal/pia/} to learn the structure and voice, then draft a new one for {the new analytics integration} |
測試類
「寫、跑、修」放在同一個提示詞裡,Claude 才會自己迭代到通過為止,而不是寫完測試就停下來等你指令。測試先行的邏輯是讓測試定義「完成」的標準,實作過程中 Claude 會持續對照測試結果調整。
| 用途 | 提示詞 |
|---|---|
| 寫測試、跑測試、修失敗 | write tests for {app/parsers/feed.py}, run them, and fix any failures |
| 測試先行開發 | write tests for {the password reset flow} first, then implement it until they pass |
| 從覆蓋率報告補缺口 | read {coverage/coverage-summary.json} and add tests for the lowest-covered files until each is above {80}% |
重構類
重構提示詞的關鍵是給出可量測的完成標準,例如效能指標的具體數字,或要保留的 API 行為。沒有明確標準時,Claude 難以判斷何時該停止迭代。
| 用途 | 提示詞 |
|---|---|
| 全代碼庫遷移某個模式 | migrate everything from {the old logging API} to {the structured logger}: identify every place that needs to change, then make the changes |
| 跨語言移植 | port {this Python module} to {Rust}, keeping the same {public API and test behavior} |
| 針對可量測指標優化 | optimize {the search query} to bring {p95 latency} from {2s} down to under {500ms} |
| 修正精確的視覺 bug | the {login button} extends {20px} beyond the {card border} on {mobile}. fix it. |
審查類
審查類提示詞讓 Claude 讀完整代碼庫的上下文,而不只是 diff,因此能抓到單看差異看不出來的問題,例如跨檔案的邏輯矛盾或潛在的安全漏洞。此為資安與維運人員的專屬提示詞。
| 用途 | 提示詞 |
|---|---|
| 提交前自我審查 | review my uncommitted changes and flag anything that looks risky before I commit |
| 審查 PR | review PR #{247} and summarize what changed, then list any concerns |
| 審查 Terraform 計畫輸出 | here is my Terraform plan output. what is this going to do, and is anything here going to cause problems? |
| 安全性審查(交給子代理) | use a subagent to review {src/api/} for security issues and report what it finds |
| 上線前內容審查 | review {launch-post.md} for {unsupported claims, missing attributions, and brand-guideline issues} and list anything I should fix before it goes to {legal} |
修正類
糾正方向時,給出 Claude 遺漏的具體限制條件,而不只是說「不對」。有了明確原因,Claude 才能在重試時滿足這個條件,而不是再猜一次。把糾正行為寫進 CLAUDE.md 的意義是:一次修正可以讓整個團隊受益,而不只停留在當次對話。
| 用途 | 提示詞 |
|---|---|
| 糾正方向錯誤 | that is not right: {the function signature needs to stay backward-compatible}. try a different approach |
| 縮減過大的改動範圍 | that is too much. keep only the changes to {the validation logic in src/forms/} and undo your other edits |
| 把糾正行為寫進 CLAUDE.md | you keep {using default exports when this project uses named exports}. add a rule to CLAUDE.md so this stops happening |
階段四、Ship:Git 與版本發佈
這個階段的提示詞讓 Claude 從 diff 或 commit 歷史推導說明,而不是靠你描述做了什麼。生成的提交說明(commit message)和更新日誌(release notes)會自動對齊你的代碼庫既有風格,不需要額外指定格式。其中「從版本歷史生成更新日誌」同樣適合 PM、行銷與文件撰寫人員用來整理版本說明。
| 用途 | 提示詞 |
|---|---|
| 解決合併衝突 | resolve the merge conflicts in this branch and explain what you kept from each side |
| 自動生成提交說明 | commit these changes with a message that summarizes what I did |
| 從 issue 開 PR | find the {Linear} ticket about {the login timeout} and open a PR that implements it |
| 從版本歷史生成更新日誌 | compare {v2.3.0} to {v2.4.0} and draft release notes grouped by feature, fix, and breaking change |
| 寫 CI 工作流 | write a GitHub Actions workflow that {runs the tests and deploys to staging} on every push to {main} |
階段五、Operate:除錯、事件處理、資料分析、自動化
除錯
除錯時描述症狀就夠了,不需要知道是哪個檔案出問題。Claude 會執行測試、追蹤至原始碼層級,找到根本原因後修正,而不是只處理表面錯誤訊息。
| 用途 | 提示詞 |
|---|---|
| 找失敗測試的原因 | the {UserAuth} test is failing, find out why and fix it |
| 調查回報的錯誤 | users are seeing {500 errors} on {/api/settings}. investigate and tell me what is going on |
| 修 build 錯誤到根因 | here is a build error. fix the root cause and verify the build succeeds |
事件處理
事件調查列出要關聯的證據來源(log、近期部署、設定變更),而不是指定排查步驟。Claude 同時讀取多個來源交叉比對,比逐一查看更快鎖定原因。主控台截圖可以直接貼入,Claude 會把儀表板上的狀態轉換成可執行的指令。
| 用途 | 提示詞 |
|---|---|
| 生產事件調查 | {the checkout endpoint started returning 500s an hour ago}. check the logs, recent deploys, and config changes, then tell me the most likely cause |
| 從主控台截圖診斷 | here is a screenshot of {the GCP Kubernetes dashboard}. walk me through why {this pod} is failing and give me the exact commands to fix it |
| 用自然語言查詢 log | show me all {failed logins} for {the auth service} over {the past 24 hours}. write the query, run it, and tell me what stands out |
資料分析
直接用 @ 引用檔案路徑,Claude 讀取原始資料而不是你的描述,結果更準確。在提示詞開頭說明格式限制(例如字數上限),生成的內容才會從一開始就符合規格。
| 用途 | 提示詞 |
|---|---|
| 分析資料檔案 | read {@reports/q1-signups.csv}, summarize the key patterns, and write the results to {an HTML page with charts, then open it in my browser} |
| 從廣告成效資料生成新版本 | read {@ads-performance.csv}, find the underperforming {headlines}, and generate {20} new variations that stay under {90} characters |
自動化
把重複動作存成 skill,整個團隊都能用一個指令觸發,不需要每次重新下提示詞。hook 把「每次都要記得問」的行為變成自動觸發,設定一次就不用再想。
| 用途 | 提示詞 |
|---|---|
| 把重複任務變成 skill | create a {/ship} skill for this project that {runs the linter and tests, then drafts a commit message} |
| 設定自動觸發的 hook | write a hook that {runs prettier} after every {edit to a .ts or .tsx file} |
| 接上 MCP 工具 | set up the {Sentry} MCP server so you can read my {error reports} directly |
| 把這次工作階段學到的記下來 | summarize what we did this session and suggest what to add to CLAUDE.md |
哪些職能角色特別適合?
52組提示詞中,部分標記了適用角色,包括 PM、設計師、行銷、文件撰寫、資安、維運。以下整理非工程師職能最直接可用的提示詞:
PM(產品經理)
問代碼庫產品問題、訪談式寫規格書、把會議記錄轉工作項目、列出邊界狀態、從資料檔產出分析報告、記下本次工作階段的決策。設計師
估算 UI 改動的影響範圍、把設計稿變成可點擊原型、截圖實作並自動比對差異、修精確視覺 bug。行銷、文件撰寫
找出所有文案並批次更新、參考既有範本起草新文件、從廣告資料生成新文案、上線前內容審查。資安
用子代理跑安全性審查、查詢 log 中的異常登入事件。維運
生產事件調查、從主控台截圖診斷、查詢 log 並找出異常。
這些提示詞背後的 6 個共同規律
看完 52 組提示詞,Anthropic 官方點出它們共享的寫法模式。理解這些模式,你就能把任何一組改成自己的版本:
一、描述結果,不描述步驟。
說你要什麼,讓 Claude 自己找相關檔案。不需要指定任何檔案路徑。
add rate limiting to the public API and make sure existing tests still pass
二、給它自我驗證的方式。
在同一個提示詞裡要求執行並驗證,Claude 就會自己迭代,而不是做完一步就停。
write the migration, run it against the dev database, and confirm the schema matches
三、給一個參照物。
指定一個現有檔案或模式當參考,Claude 就會按照你的代碼庫習慣來寫,而不是按一般最佳實踐。
add a settings page that follows the same layout as the profile page
四、給可量測的目標。
當目標是效能或測試覆蓋率,給出具體數字讓完成標準清楚。
get the bundle size under 200KB and show me what you removed
五、直接給它原始素材。
錯誤訊息、log、截圖、plan output 直接貼進提示詞,或用 @ 引用檔案。Claude 讀原始資料的效果遠優於你的描述。
why is the build failing? @build.log
六、指定你要的回答格式。
說明格式、長度或對象,讓回答符合你的使用情境。
explain how the payment retry logic works as an HTML page with a diagram, then open it in my browser
Prompt Library 這樣用效果有限
使用上仍須留意,這 52 組提示詞需要配合你的實際環境調整,在以下情況下效果會打折:
1. 跨工作階段用同一個提示詞,但沒有持久化背景。
每次工作階段會從新的上下文視窗開始;若要保留背景,需要寫入 CLAUDE.md,或使用 Claude Code 的自動記憶功能。官方建議在工作階段結束前讓 Claude 整理當次學到的內容並寫入 CLAUDE.md,下次才能銜接。
2. 需要外部工具但沒有連接。
部分提示詞標注了「Needs」前置條件:查詢 log 的提示詞需要先接好 MCP server,從 issue 直接開 PR 需要 gh CLI 或 GitHub connector,從資料庫查詢需要資料倉儲已連接。沒有接好工具,提示詞只能跑一半。
3. 對 vibe coding 有期待,但代碼庫缺乏約束。
沒有測試、沒有 CLAUDE.md、沒有明確的代碼規範,Claude 仍然可以執行,但輸出品質與一致性會不穩定。Prompt Library 的最大值,是在有良好工程環境的代碼庫上才能完全發揮。
延伸閱讀:
- Claude Code 快捷鍵+指令大全!13 大類速查不用背,從 Ctrl+C 到多 Agent 協作一次整理
- Claude Code 只發揮 1 成實力?7 個設定目錄完整教學,讓 AI 每次都按你的規則工作
- Claude Code 教學|十個實作專案:自動整理檔案、分析帳單⋯內附完整提示詞!
資料來源:Claude Code Prompt Library
(本文初稿為 AI 編撰)
