開始使用 Loops episode artwork

EPISODE · Jul 6, 2026 · 7 MIN

開始使用 Loops

from EasyVibeCoding Podcast · host ClaudeDevs

開始使用 Loops 現在關於「設計 Loops」(迴圈)而非僅僅是向你的程式開發 Agent 下達 Prompt 的討論非常熱烈。如果你花點時間在 X 上試圖釐清「Loop」到底是什麼,你會發現各種不同的答案。 在 Claude Code 團隊中,我們將 Loop 定義為:Agent 重複執行工作週期,直到滿足停止條件為止。我們根據以下幾個維度將 Loop 分為幾種類型: 它們是如何被觸發的 它們是如何停止的 使用了哪些 Claude Code 的基礎功能(primitive) 每一種 Loop 最適合處理什麼類型的任務。 我們將介紹主要的 Loop 類型、何時使用它們,以及如何在管理 token 用量時維持程式碼品質。並非所有任務都需要複雜的 Loop;請從最簡單的解決方案開始,並有選擇性地使用這些模式。 --- 基於回合的 Loop (Turn-based loops) 展開畫面重點圖片呈現了一個流程循環圖,說明 Claude 處理任務的機制: 起始點:Your prompt(您的提示詞)。 循環流程: - Gather context(收集背景資訊) - Take action(採取行動) - Verify the work(驗證工作成果) 終點:Response(回應)。 底部說明文字:Exits when Claude judges the task complete — or the effort budget runs out.(當 Claude 判斷任務完成,或努力預算耗盡時退出循環。) 觸發方式:使用者的 Prompt。 停止標準:Claude 判定任務已完成,或需要額外的上下文(context)。 最適合:不屬於常規流程或排程的較短任務。 管理用量方式:撰寫具體的 Prompt,並透過使用 skill 來改進驗證流程,以減少回合數。 你發送的每一個 Prompt 都會開啟一個手動 Loop,由你來引導每一個回合。Claude 會收集上下文、採取行動、檢查工作成果、在必要時重複執行,並做出回應。我們稱之為 Agentic Loop。 例如,要求 Claude 建立一個「讚」按鈕。它會讀取你的程式碼、進行編輯、執行測試,並交回它認為可行的成果。接著你手動檢查工作成果,並撰寫下一個 Prompt。 你可以透過將手動步驟編碼為 SKILL.md 來改進驗證步驟,讓 Claude 能夠端到端地檢查更多自己的工作。這應該包含工具或連接器,讓 Claude 能夠查看、測量或與結果進行互動。檢查越具量化指標,Claude 就越容易進行自我驗證。 例如,你可以在 SKILL.md 檔案中指定: `markdown --- name: verify-frontend-change description: Verify any UI change end-to-end before declaring it done. --- Verifying frontend changes Never report a UI change as complete based on a successful edit alone. Verify it the way a human reviewer would: Start the dev server and open the edited page in the browser. Interact with the change directly. For a new control (button, input, toggle): click it, confirm the expected state change, and screenshot before/after. Check the browser console: zero new errors or warnings. Use the Chrome Devtools MCP, run a performance trace and audit Core Web Vitals. If any step fails, fix the issue and rerun from step 1 — do not hand back partially verified work. ` --- 基於目標的 Loop (/goal) 展開畫面重點該圖表描述了一個自動化工作流程,包含以下文字內容: 頂部指令:/goal get the homepage Lighthouse score to 90 or above, stop after 5 tries 循環左側:Claude works on the task 循環路徑(順時針):tries to stop 循環中心:Evaluator model 下方標註 checks your condition 循環路徑(逆時針):condition not met — sent back to work 循環右側(結束點):Loop ends 下方標註 goal met, or the turn limit is reached 圖表重點在於展示一個「工作—評估—循環」的機制:Claude 執行任務後,由評估模型(Evaluator model)檢查是否達成設定條件。若未達成,則將任務送回 Claude 繼續執行;若達成條件或達到嘗試次數上限(turn limit),則結束循環。 觸發方式:即時的手動 Prompt。 停止標準:達成目標 或 達到最大回合數。 最適合:具有可驗證退出標準的任務。 管理用量方式:設定明確的完成標準與回合上限,例如「嘗試 5 次後停止」。 有時候,單一回合是不夠的,特別是對於較複雜的任務。當 Agent 可以進行迭代時,表現會更好。你可以透過使用 /goal 定義「完成」的樣貌,來延長 Claude 持續迭代的時間。 當你定義了成功標準,Claude 就不必自行判斷什麼是「足夠好」並提早結束 Loop。每當 Claude 嘗試停止時,評估模型會檢查你的條件,並將其送回工作狀態,直到達成目標或達到你定義的回合數為止。 這就是為什麼確定性的標準(例如通過的測試數量,或達到特定的分數門檻)如此有效的原因。 例如: `bash /goal get the homepage Lighthouse score to 90 or above, stop after 5 tries. ` --- 基於時間的 Loop (/loop 與 /schedule) 觸發方式:指定的時間間隔。 停止標準:你取消它,或者工作完成(例如 PR 已合併、佇列已清空)。 最適合:重複性的工作,或與外部環境/系統進行介接。 管理用量方式:設定更長的間隔,或根據事件而非時間來進行反應。 有些 Agentic 工作是重複性的:任務保持不變,只有輸入內容會改變。例如,每天早上總結 Slack 訊息。其他工作則依賴外部系統,與其介接的一個簡單方法是定期檢查它,並對變更做出反應。例如,一個可能會收到程式碼審查或 CI 失敗的 PR。 對於這些情況,你可以使用 /loop 來觸發 Claude 的執行,它會以固定的時間間隔重新執行 Prompt。例如: `bash /loop 5m check my PR, address review comments, and fix failing CI ` /loop 是在你的電腦上執行的,所以如果你關閉它,它就會停止。你可以透過使用 /schedule 建立常規排程,將 Loop 移至雲端執行。 --- 主動式 Loop (Proactive loops) 展開畫面重點該圖表描述了一個在雲端運行的自動化工作流程(RUNS IN THE CLOUD — LAPTOP OPEN OR NOT),包含以下步驟: TRIGGER: 使用 /schedule 指令,監控 Slack 或 GitHub 上的錯誤報告。 GOAL + CHECK: 由「Main agent」執行,透過循環運作直到驗證技能通過。 Opens a PR: 系統自動開啟一個 Pull Request。 REVIEW: 由「Second agent」進行審核並通知使用者。 流程中央標註「runs until you turn it off」(持續運行直到你將其關閉),左側則顯示使用者(You)負責決定「what to merge」(合併什麼內容)。 觸發方式:事件或排程,無需人類即時參與。 停止標準:…

Episode metadata supplied by the publisher feed · Published Jul 6, 2026

Embed this episode

Ready to play

開始使用 Loops

0:00 7:12

No transcript for this episode yet

We transcribe on demand. Request one and we'll notify you when it's ready — usually under 10 minutes.

No similar episodes found.

No similar podcasts found.

Frequently Asked Questions

How long is this episode of EasyVibeCoding Podcast?

This episode is 7 minutes long.

When was this EasyVibeCoding Podcast episode published?

This episode was published on July 6, 2026.

Can I download this EasyVibeCoding Podcast episode?

Yes. Use the download control on the episode player to save the publisher-provided media file.
URL copied to clipboard!