選項
首頁首頁 Skill 生產力和工作流程 doubt-driven-development

doubt-driven-development

addyosmani/agent-skills addyosmani/agent-skills

在每個非平凡的決策生效前,都會針對其進行一次基於新上下文的對抗性審查,並針對高風險或不熟悉的程式碼,優先考量正確性而非速度。

...展開全部
9
更新時間 2026-09-03

即將在不確定性下做出架構決策
  • 即將提交非平凡的程式碼
  • 即將斷言一個非顯而易見的事實(「這很安全」、「這能擴展」、「這符合規格」)
  • 正在處理自己尚未完全理解的程式碼
  • 何時不應使用:

    • 機械性操作(重新命名、格式化、檔案移動)
    • 遵循清晰且無歧義的使用者指示
    • 閱讀或摘要現有程式碼
    • 顯然正確的一行修改
    • 純粹的工具操作(執行測試、列出檔案)
    • 使用者已明確要求優先速度而非驗證

    若對每個按鍵操作都心存疑慮,便無法交付任何成果。此技巧僅適用於上述定義中的非瑣碎決策。

    載入限制

    這項技能是為主要會話協調者所設計,其中步驟 3(質疑,詳見下文)可能會啟動一位新情境審閱者。

    • 請勿將此技能新增至角色(persona)的技能清單:frontmatter。若某個角色遵循步驟 3,將會產生另一個角色——這正是references/orchestration-patterns.md明確禁止的協調反模式(「角色不得呼叫其他角色」)。
    • 若您發現自己在子代理情境中應用此技能(而 Claude Code 會阻止嵌套式子代理的產生):首選方案是向使用者說明「基於疑慮的模式」無法在嵌套環境中運行,並讓主會話來處理。 僅在萬不得已時,才可採用降級的自我質疑備用方案——將 ARTIFACT + CONTRACT 重寫為全新的自我提示,並與先前的推理建立明確的心理分隔,然後依序執行步驟 1 至 5。 這並非新情境審查」(您會攜帶自身原有情境),因此請將結果標記為「降級」,並在用戶可聯繫時優先進行升級處理。

    流程

    應用此技能時,請複製此檢查清單:

    質疑循環:
    - [ ] 步驟 1:主張 — 撰寫主張內容及其重要性
    - [ ] 步驟 2:萃取 — 隔離相關文件與契約,剔除推論部分
    - [ ] 步驟 3:質疑 — 透過對抗性提示呼叫「全新語境」審查者
    - [ ] 第 4 步:調和 — 根據實體文本對每項發現進行分類
    - [ ] 第 5 步:停止 — 滿足停止條件(微不足道的發現、完成 3 個循環,或使用者覆寫)
    
    

    步驟 1:主張 — 闡明現有論點

    用兩到三行文字說明該決策:

    主張:「在規格書所述的
            讀取密集型工作負載下,新的快取層是執行緒安全的。」
    為何這很重要:此處若發生競態條件將損毀使用者資料,且
                      在品質保證階段難以偵測。
    
    

    若無法如此簡潔地寫出此論點,那只是種直覺,而非明確的結論。在深入檢視之前,先將其明確闡述出來。

    步驟 2:萃取 — 最小的可審查單位

    一位處於全新背景的審查者需要的是產出物合約,而非開發歷程。

    • 程式碼:差異處或函式 — 而非整個檔案
    • 決策:以 3 至 5 句陳述的提案,加上其必須滿足的限制條件
    • 斷言:主張及其據稱支持該主張的證據(需與步驟 1 的「CLAIM」區塊區分開來,該區塊所載的是正在接受檢視的協調者假設)

    精簡你的推理過程。若你直接提交結論,你得到的將只是對這些結論的驗證。單元必須足夠小,讓審閱者能在一次閱讀中將其納入考量——若是 500 行的 PR,請先進行分解。

    步驟 3:質疑 — 引入處於全新脈絡的審閱者

    審查者的提示必須具有對抗性。問題的框架決定了答案。

    對立式審查。找出這個產出物有何問題。
    假設作者過於自信。請尋找:
    - 未明言的假設
    - 未處理的邊界案例
    - 隱藏的耦合或共享狀態
    - 可能違反合約的方式
    - 此處可能違反的既有規範
    - 面對意外輸入時的故障模式
    
    切勿進行驗證。切勿進行總結。找出問題,或明確聲明
    經過徹底檢視後,您未能發現任何問題。
    
    成果:
    合約:
    
    

    僅提交「實體」與「合約」。切勿提交「主張」。若將結論直接提供給審查者,將使其傾向於同意。審查者必須獨立判斷該實體是否符合合約。

    在 Claude Code 中,agents/目錄下的基於角色的審查員,其設計初衷即是從隔離的上下文開始,因此可在此處使用——請參閱agents/以查看名單及各領域的對應關係。

    上述對抗性提示詞的優先級高於角色預設的回應模式。code-reviewer這樣的角色,其設計初衷是產生兼具優點與缺點的平衡評斷;而以「懷疑」為驅動的角色則需僅輸出問題點。 請將對抗性提示語逐字貼入呼叫指令中,使其覆寫角色的預設設定。若某角色的回應模式無法乾淨俐落地被覆寫,則應回退至使用對抗性提示語的通用子代理。

    跨模型升級處理

    單一模型的審查員與原始作者存在相同的盲點——而架構不同、更「冷靜」的模型則能察覺這些盲點。「基於懷疑」模式對於非微不足道的決策本就已設為預設選項,因此在此範圍內提供跨模型功能,是該技能價值的一部分,而非可選的阻礙。

    互動式會議:務必提供。切勿默默跳過。

    步驟 1:詢問使用者

    在完成上述第 3 步驟的單一模型審查後,但在執行「RECONCILE」之前,請暫停並詢問:

    「單一模型審查已完成。是否需要跨模型的第二意見?選項:Gemini CLI、Codex CLI、手動外部審查(您需將內容貼至其他地方),或跳過。」

    在每個互動式疑點處理循環中,此問題皆為必問項目——即使是看似風險較低的成果亦然。由使用者(而非代理程式)決定是否值得付出這份成本。代理程式的職責則是將這個選擇呈現出來。

    步驟 2:若使用者選擇 CLI — 驗證後,再執行

    1. 檢查工具是否已在 PATH 環境變數中(例如 geminicodex)。
    2. 在傳遞完整的提示字元之前,先測試其是否正常運作(例如gemini --version或等效指令)——過期或損壞的二進位檔可能通過測試,但在處理實際輸入時卻會失敗。
    3. 與使用者確認確切的呼叫方式,包括必要的參數、認證及環境變數(例如 API 金鑰)。實作方式各異;切勿擅自假設。
    4. 傳遞 ARTIFACT + CONTRACT + 對抗性提示字元。不包含會話上下文,也不包含 CLAIM。
    5. 注意 shell 轉義。若 artifact 包含引號、$(...) 或反引號,請優先使用標準輸入 (echo … | gemini) 或 heredoc,而非內嵌的-p "…" 格式。如有疑慮,請在執行前請使用者確認呼叫方式。
    6. 將輸出結果帶入第 4 步(RECONCILE)。

    切勿將 Artifact 插值到以 shell 引號包圍的參數中。程式碼、Markdown 及審查提示中常包含反引號、$(...) 及引號字元,這些會導致提示被截斷或執行嵌入的 shell 指令。請將完整提示寫入檔案,並透過標準輸入(stdin)傳入。

    範例格式(請根據您安裝的工具驗證旗標 — 不同實作與版本的語法可能有所差異):

    # 首先將對抗性提示字串 + 人工產物 + 合約寫入臨時檔案。
    # 接著透過標準輸入傳送,以確保人工產物中的 shell 特殊字元保持無效。
    
    # Codex(唯讀沙箱可防止命令列介面寫入您的工作區):
    codex exec --sandbox read-only -C - < /tmp/doubt-prompt.md
    
    # Gemini('--approval-mode plan' 為唯讀模式;'-p ""' 觸發非互動
    # 模式,且提示語從標準輸入讀取):
    gemini --approval-mode plan -p "" < /tmp/doubt-prompt.md
    
    

    唯讀沙盒是關鍵所在:一個「doubt」 artefact 本身可能包含某些指令(無論是刻意或意外的提示注入),否則跨模型 CLI 將會將這些指令套用至您的工作區中。

    步驟 3:若 CLI 無法使用或執行失敗

    應明確顯示失敗狀況。提供以下選項:手動執行、嘗試其他工具,或跳過。切勿默默回退至單一模型模式——使用者應知悉跨模型操作未能執行。

    步驟 4:若使用者選擇跳過

    在輸出結果中明確標示已跳過(「僅繼續處理單一模型的分析結果」),並繼續進行「RECONCILE」步驟。跳過操作是可以接受的;但無提示地跳過則不可行。

    非互動式情境(CI、/loop、autonomous-loop、排程執行):

    • 跨模型分析將被跳過,且必須在輸出中明確標示此跳過:「跨模型分析已跳過:非互動式情境。」
    • 切勿在未經使用者明確授權的情況下呼叫外部 CLI—— 這是承載型安全屬性。

    跨模型會增加成本、延遲及工具的脆弱性。代理程式會在每個週期中呈現此選項;由使用者決定此產出物是否值得如此代價。

    步驟 4:整合 — 將發現結果整合回系統

    審查者的輸出是數據,而非定論。您仍是主導者。在進行分類之前,請針對每項發現重新閱讀該成果的文本——對審查者的結論照單全收,與直接忽略審查結果同樣屬於失敗模式。

    針對每個發現項,請依照以下優先順序進行分類(最先符合的類別優先):

    1. 合約解讀錯誤— 審查員之所以特別標記某項內容,是因為您提供的合約不明確或不完整。請先修正合約,並於下個週期重新分類。
    2. 有效且可處理— 真實問題,需要對產出物進行變更。進行變更後,重新進入循環。
    3. 有效的權衡— 問題確實存在,但修正成本高於接受該問題的成本。請明確記錄此權衡,以便使用者了解。
    4. 誤報— 審查者標記的內容,在審查者未掌握的上下文中其實是正確的。請記錄此情況,繼續進行,並自問:若在合約中加入該上下文,是否能避免此誤報?

    一位新審查員可能會因缺乏背景資訊而判斷錯誤。不要僅僅因為對方是「新審查員」就延後處理。

    步驟 5:STOP —— 有界迴圈,而非遞迴

    何時停止:

    • 下一次迭代僅返回微不足道或已考慮過的結果,或
    • 已完成 3 個循環(向上回報給使用者,不要獨自進行第四個循環),
    • 使用者明確表示「發布吧」

    若經過 3 個循環後,審查者仍提出實質性問題,則該成果可能尚未準備就緒。請將此情況告知使用者——三個未解決的循環是關於該成果的資訊,而非持續循環的理由。

    若因產出物規模龐大而使 3 個循環「顯然不足」:表示該產出物過於龐大——請返回第 2 步並進行分解。切勿放寬限制。

    常見的合理化辯解

    辯解理由 現實
    「我有信心,跳過懷疑這一步」 面對新穎問題時,自信與正確性的關聯性很低。越是確信的時刻,往往正是盲點隱藏之處。
    「指派審查者成本很高」 在生產環境中除錯一個錯誤的提交所耗費的成本更高。檢查的範圍是有限的;但錯誤卻是無止盡的。
    「審查者只會吹毛求疵」 除非沒有明確範圍。將提示限制在「會導致此程式碼在合約下失敗的問題」。
    「我會在最後透過/review 來進行質疑」 /review只是最後一道關卡。以質疑為導向的審查能及早發現錯誤方向,此時修正成本尚低。等到提交拉取請求(PR)時,就已經太遲了。
    「如果我對每一步都心存疑慮,我永遠無法發布」 這項技巧適用於非瑣碎的決策,而非每一個鍵盤敲擊。請重新閱讀「何時不該使用」。
    「兩條意見總比一條好」 若第二種意見缺乏背景脈絡且只會製造雜訊,則並非如此。應尋求折衷,而非一味推諉。
    「審閱者不同意,所以我是錯的」 審查者缺乏你的背景脈絡——意見相左是資訊,而非定論。請重新閱讀相關文件,進行分類,然後再做決定。
    「跨模型總是更好」 跨模型能發現單一模型自身存在的盲點,但會增加成本並導致工具不穩定。在每個互動式疑慮循環中都提供此選項——由使用者決定該成果是否值得採用。代理的任務是呈現選擇,而非加以限制。
    「使用者曾說過一次『是』,所以我可以持續調用 CLI」 每次呼叫都需獨立授權。輸出結果、提示語和參數在每次呼叫間都會變化——在每次執行前,務必與使用者重新確認確切的指令。

    紅旗警示

    • 僅為一行名稱變更或格式調整而啟動全新上下文的審閱者
    • 未重新閱讀工件內容,便將審閱者的輸出視為權威性結果
    • 反覆審查超過 3 輪卻未將問題上報給使用者
    • 向審查者提示「這樣可以嗎?」而非「找出問題」
    • 在時間壓力下,對高風險決策存有疑慮卻選擇跳過
    • 針對未變更的產出物重新建立「全新上下文」審查(結果將與前次相同;此舉實屬拖延)
    • 「懷疑戲碼」(可驗證訊號):在 2 個或更多循環中,審查員雖提出實質發現,但無任何發現被歸類為需採取行動。你正在進行驗證,而非質疑。請停止並向上級報告。
    • 僅在提交後才提出質疑——那是/review,而非「質疑驅動開發」
    • 在未向使用者確認該工具是否存在、是否已配置,以及是否接受該精確語法的情況下,硬編碼外部 CLI 調用
    • 在互動式質疑循環中靜默跳過跨模型檢查。即使不建議執行,選項也必須可見。跳過無妨;靜默跳過則不可行。
    • 當外部 CLI 發生錯誤或缺失時,若靜默回退——應顯式顯示失敗訊息,並讓使用者重新導向
    • 從審查者的輸入中移除合約
    • 將「主張」(CLAIM)直接傳遞給審查者(會產生傾向同意的偏見)

    與其他技能的互動

    • code-review-and-quality//review:互補關係。/review屬於事後對 PR 的裁決;而「疑點驅動」則是進行中的逐項決策。兩者皆應併用。
    • 源碼驅動開發 (SDD):SDD 會根據官方文件驗證框架相關的事實;而「懷疑驅動」則驗證您對該產物的推理。SDD 檢查 API 是否存在;「懷疑驅動」則檢查您是否在合約規範下正確使用了它。
    • 測試驅動開發(TDD):TDD 的 RED 步驟正是將「懷疑」具體化——測試失敗即是對論點的反證嘗試。當 TDD 適用時,該次測試失敗即為行為主張的「懷疑」步驟。
    • 除錯與錯誤復原:當審查者揭露真實的失敗模式時,切換至除錯技能以定位並修正問題。
    • 儲存庫協調規則(參見references/orchestration-patterns.md):此技能由主會話進行協調。一個角色呼叫另一個角色屬於反模式 B —— 請參閱上文的「載入限制」。

    驗證

    在應用「懷疑驅動開發」之後:

    • 每個非平凡的決策(依據上述定義)在定案前,皆已明確命名為一項「主張」
    • 每個非平凡的產出物至少進行一次新情境審查(根據《與其他技能的互動》所述,TDD「RED」步驟所產生的失敗測試,對於行為性主張已滿足此要求)
    • 審查者收到的是「產出物」+「合約」——而非「主張」,也非您的推理過程
    • 審查者的提示採對立式(「找出問題」),而非驗證式(「這是否良好」)
    • 審查結果是根據以下優先順序,針對工件文本進行分類(而非橡皮圖章式核可):合約誤解/可處理事項/權衡/雜訊
    • 已滿足終止條件(瑣碎發現、3 個循環,或使用者覆寫)
    • 在互動模式下,系統會明確向使用者提供跨模型分析(無論成果的重要性如何),並在輸出結果中確認使用者的回應
    • 在非互動模式下,會跳過跨模型檢查,並會明確告知此跳過操作
    • 任何外部 CLI 呼叫之前,均會先進行 PATH 檢查、可執行二進位檔測試、與使用者確認語法,並取得明確的執行授權
    在 GitHub 上查看
    ---
    name: doubt-driven-development
    description: Subjects every non-trivial decision to a fresh-context adversarial review before it stands, prioritizing correctness over speed for high-stakes or unfamiliar code.
    ---
    
    # Doubt-Driven Development
    
    ## Overview
    
    A confident answer is not a correct one. Long sessions accumulate context that quietly turns assumptions into "facts" without anyone noticing. Doubt-driven development is the discipline of materializing a fresh-context reviewer — biased to **disprove**, not approve — before any non-trivial output stands.
    
    This is not `/review`. `/review` is a verdict on a finished artifact. This is an in-flight posture: non-trivial decisions get cross-examined while course-correction is still cheap.
    
    ## When to Use
    
    A decision is **non-trivial** when at least one of these is true:
    
    - It introduces or modifies branching logic
    - It crosses a module or service boundary
    - It asserts a property the type system or compiler cannot verify (thread safety, idempotence, ordering, invariants)
    - Its correctness depends on context the future reader cannot see
    - Its blast radius is irreversible (production deploy, data migration, public API change)
    
    Apply the skill when:
    
    - About to make an architectural decision under uncertainty
    - About to commit non-trivial code
    - About to claim a non-obvious fact ("this is safe", "this scales", "this matches the spec")
    - Working in code you don't fully understand
    
    **When NOT to use:**
    
    - Mechanical operations (renaming, formatting, file moves)
    - Following a clear, unambiguous user instruction
    - Reading or summarizing existing code
    - One-line changes with obvious correctness
    - Pure tooling operations (running tests, listing files)
    - The user has explicitly asked for speed over verification
    
    If you doubt every keystroke, you ship nothing. The skill applies only to non-trivial decisions as defined above.
    
    ## Loading Constraints
    
    This skill is designed for the **main-session orchestrator**, where Step 3 (DOUBT, detailed below) can spawn a fresh-context reviewer.
    
    - **Do NOT add this skill to a persona's `skills:` frontmatter.** A persona that follows Step 3 would spawn another persona — the orchestration anti-pattern explicitly forbidden by `references/orchestration-patterns.md` ("personas do not invoke other personas").
    - **If you find yourself applying this skill from inside a subagent context** (where Claude Code prevents nested subagent spawn): the preferred path is to surface to the user that doubt-driven cannot run nested and let the main session handle it. As a last resort only, a degraded self-questioning fallback exists — rewrite ARTIFACT + CONTRACT as a fresh self-prompt with a hard mental separator from your prior reasoning, and walk Steps 1–5. This is **not fresh-context review** (you carry your own context with you), so flag the result as degraded and prefer escalation whenever the user is reachable.
    
    ## The Process
    
    Copy this checklist when applying the skill:
    
    ```
    Doubt cycle:
    - [ ] Step 1: CLAIM — wrote the claim + why-it-matters
    - [ ] Step 2: EXTRACT — isolated artifact + contract, stripped reasoning
    - [ ] Step 3: DOUBT — invoked fresh-context reviewer with adversarial prompt
    - [ ] Step 4: RECONCILE — classified every finding against the artifact text
    - [ ] Step 5: STOP — met stop condition (trivial findings, 3 cycles, or user override)
    ```
    
    ### Step 1: CLAIM — Surface what stands
    
    Name the decision in two or three lines:
    
    ```
    CLAIM: "The new caching layer is thread-safe under the
            read-heavy workload described in the spec."
    WHY THIS MATTERS: a race here corrupts user data and is
                      hard to detect in QA.
    ```
    
    If you can't write the claim that compactly, you have a vibe, not a decision. Surface it before scrutinizing it.
    
    ### Step 2: EXTRACT — Smallest reviewable unit
    
    A fresh-context reviewer needs the **artifact** and the **contract**, not the journey.
    
    - Code: the diff or the function — not the whole file
    - Decision: the proposal in 3–5 sentences plus the constraints it has to satisfy
    - Assertion: the claim plus the evidence that supposedly supports it (kept distinct from the Step 1 CLAIM block, which is the orchestrator's hypothesis under scrutiny)
    
    Strip your reasoning. If you hand over conclusions, you'll get back validation of your conclusions. The unit must be small enough that a reviewer can hold it in mind in one read — if it's a 500-line PR, decompose first.
    
    ### Step 3: DOUBT — Invoke the fresh-context reviewer
    
    The reviewer's prompt **must be adversarial**. Framing decides the answer.
    
    ```
    Adversarial review. Find what is wrong with this artifact.
    Assume the author is overconfident. Look for:
    - Unstated assumptions
    - Edge cases not handled
    - Hidden coupling or shared state
    - Ways the contract could be violated
    - Existing conventions this might break
    - Failure modes under unexpected input
    
    Do NOT validate. Do NOT summarize. Find issues, or state
    explicitly that you cannot find any after thorough examination.
    
    ARTIFACT: <paste artifact>
    CONTRACT: <paste contract>
    ```
    
    **Pass ARTIFACT + CONTRACT only. Do NOT pass the CLAIM.** Handing the reviewer your conclusion biases it toward agreement. The reviewer must independently determine whether the artifact satisfies the contract.
    
    In Claude Code, the role-based reviewers in `agents/` start with isolated context by design and are usable here — see `agents/` for the roster and per-domain match.
    
    **The adversarial prompt above takes precedence over the persona's default response shape.** Personas like `code-reviewer` are written to produce balanced verdicts with both strengths and weaknesses; doubt-driven needs issues-only output. Paste the adversarial prompt verbatim into the invocation so it overrides the persona's default. If a persona's response shape can't be overridden cleanly, fall back to a generic subagent with the adversarial prompt.
    
    #### Cross-model escalation
    
    A single-model reviewer shares blind spots with the original author — a colder, different-architecture model catches them. Doubt-driven is already opt-in for non-trivial decisions, so within that scope offering cross-model is part of the skill's value, not optional friction.
    
    **Interactive sessions: always offer. Never silently skip.**
    
    **Step 1: Ask the user**
    
    After the single-model review in Step 3 above, but before RECONCILE, pause and ask:
    
    > *"Single-model review complete. Want a cross-model second opinion? Options: Gemini CLI, Codex CLI, manual external review (you paste it elsewhere), or skip."*
    
    This question is mandatory in every interactive doubt cycle — even on artifacts that feel low-stakes. The user — not the agent — decides whether the cost is worth it. The agent's job is to surface the choice.
    
    **Step 2: If the user picks a CLI — verify, then invoke**
    
    1. Check the tool is in PATH (`which gemini`, `which codex`).
    2. Test it works (`gemini --version` or equivalent) before passing the full prompt — a stale or broken binary may pass `which` but fail on real input.
    3. Confirm the exact invocation with the user, including required flags, auth, and env vars (e.g., API keys). Implementations vary; never assume.
    4. Pass ARTIFACT + CONTRACT + the adversarial prompt **only**. No session context, no CLAIM.
    5. Mind shell escaping. If the artifact contains quotes, `$(...)`, or backticks, prefer stdin (`echo … | gemini`) or a heredoc over inline `-p "…"`. When in doubt, ask the user to confirm the invocation before running it.
    6. Take the output into Step 4 (RECONCILE).
    
    **Never interpolate the artifact into a shell-quoted argument.** Code, markdown, and review prompts routinely contain backticks, `$(...)`, and quote characters that will either truncate the prompt or execute embedded shell. Write the full prompt to a file and pipe it through stdin.
    
    Example shapes (verify flags against your installed tool — syntax differs across implementations and versions):
    
    ```bash
    # Write the adversarial prompt + ARTIFACT + CONTRACT to a temp file first.
    # Then pipe via stdin so shell metacharacters in the artifact stay inert.
    
    # Codex (read-only sandbox keeps the CLI from writing to your workspace):
    codex exec --sandbox read-only -C <repo-path> - < /tmp/doubt-prompt.md
    
    # Gemini ('--approval-mode plan' is read-only; '-p ""' triggers non-interactive
    # mode and the prompt is read from stdin):
    gemini --approval-mode plan -p "" < /tmp/doubt-prompt.md
    ```
    
    A read-only sandbox is the load-bearing detail: a doubt artifact may itself contain instructions (intentional or accidental prompt injection) that the cross-model CLI would otherwise execute against your workspace.
    
    **Step 3: If the CLI is unavailable or fails**
    
    Surface the failure explicitly. Offer: run it manually, try a different tool, or skip. Do not silently fall back to single-model — the user should know cross-model didn't happen.
    
    **Step 4: If the user skips**
    
    Acknowledge the skip in the output (*"Proceeding with single-model findings only"*) and continue to RECONCILE. Skipping is fine; silent skipping is not.
    
    **Non-interactive contexts** (CI, `/loop`, autonomous-loop, scheduled runs):
    
    - Cross-model is **skipped**, and the skip must be **announced** in the output: *"Cross-model skipped: non-interactive context."*
    - **Never invoke an external CLI without explicit user authorization** — this is a load-bearing safety property.
    
    Cross-model adds cost, latency, and tool fragility. The agent surfaces the choice every cycle; the user decides whether this artifact warrants it.
    
    ### Step 4: RECONCILE — Fold findings back
    
    The reviewer's output is data, not verdict. **You are still the orchestrator.** Re-read the artifact text against each finding before classifying — rubber-stamping the reviewer is the same failure mode as ignoring it.
    
    For each finding, classify in this **precedence order** (first matching class wins):
    
    1. **Contract misread** — reviewer flagged something specifically because the CONTRACT you provided was unclear or incomplete. Fix the contract first, re-classify on the next cycle.
    2. **Valid + actionable** — real issue requiring a change to the artifact. Change it, re-loop.
    3. **Valid trade-off** — issue is real but cost of fixing exceeds cost of accepting. Document the trade-off explicitly so the user sees it.
    4. **Noise** — reviewer flagged something that's actually correct under context the reviewer didn't have. Note it, move on, and ask: would adding that context to the contract have prevented the false flag?
    
    A fresh reviewer can be wrong because it lacks context. Don't defer just because it's "fresh."
    
    ### Step 5: STOP — Bounded loop, not recursion
    
    Stop when:
    
    - Next iteration returns only trivial or already-considered findings, **or**
    - 3 cycles completed (escalate to user, don't grind a fourth alone), **or**
    - User explicitly says "ship it"
    
    If after 3 cycles the reviewer still surfaces substantive issues, the artifact may not be ready. Surface this to the user — three unresolved cycles is information about the artifact, not a reason to keep looping.
    
    If 3 cycles is "obviously insufficient" because the artifact is large: the artifact is too big — return to Step 2 and decompose. Do not lift the bound.
    
    ## Common Rationalizations
    
    | Rationalization | Reality |
    |---|---|
    | "I'm confident, skip the doubt step" | Confidence correlates poorly with correctness on novel problems. Moments of certainty are exactly when blind spots hide. |
    | "Spawning a reviewer is expensive" | Debugging a wrong commit in production is more expensive. The check is bounded; the bug isn't. |
    | "The reviewer will just nitpick" | Only if unscoped. Constrain the prompt to "issues that would make this fail under the contract." |
    | "I'll do doubt at the end with `/review`" | `/review` is a final gate. Doubt-driven catches wrong directions early when course-correction is cheap. By PR time it's too late. |
    | "If I doubt every step I'll never ship" | The skill applies to non-trivial decisions, not every keystroke. Re-read "When NOT to Use." |
    | "Two opinions are always better than one" | Not when the second has less context and produces noise. Reconcile, don't defer. |
    | "The reviewer disagreed so I was wrong" | The reviewer lacks your context — disagreement is information, not verdict. Re-read the artifact, classify, then decide. |
    | "Cross-model is always better" | Cross-model catches blind spots a single model shares with itself, but it adds cost and tool fragility. Offer it every interactive doubt cycle — the user decides whether the artifact warrants it. The agent's job is to surface the choice, not to gate it. |
    | "User said yes once, so I can keep invoking the CLI" | Each invocation is its own authorization. The artifact, the prompt, and the flags change between calls — re-confirm the exact command with the user before every run. |
    
    ## Red Flags
    
    - Spawning a fresh-context reviewer for a one-line rename or formatting change
    - Treating reviewer output as authoritative without re-reading the artifact text
    - Looping >3 cycles without escalating to the user
    - Prompting the reviewer with "is this good?" instead of "find issues"
    - Skipping doubt under time pressure on a high-stakes decision
    - Re-spawning fresh-context on an unchanged artifact (you'll get the same findings; you're stalling)
    - **Doubt theater (checkable signal)**: across 2 or more cycles where the reviewer surfaced substantive findings, zero findings were classified as actionable. You are validating, not doubting. Stop and escalate.
    - Doubting only after committing — that's `/review`, not doubt-driven development
    - Hardcoding an external CLI invocation without confirming with the user that the tool exists, is configured, and accepts that exact syntax
    - **Silently skipping cross-model in an interactive doubt cycle.** Even when not recommending it, the offer must be visible. Skipping is fine; silent skipping is not.
    - Falling back silently when an external CLI errors or is missing — surface the failure and let the user redirect
    - Stripping the contract from the reviewer's input
    - Passing the CLAIM to the reviewer (biases toward agreement)
    
    ## Interaction with Other Skills
    
    - **`code-review-and-quality` / `/review`**: complementary. `/review` is post-hoc PR verdict; doubt-driven is in-flight per-decision. Use both.
    - **`source-driven-development`**: SDD verifies *facts about frameworks* against official docs. Doubt-driven verifies *your reasoning about the artifact*. SDD checks the API exists; doubt-driven checks you used it correctly under the contract.
    - **`test-driven-development`**: TDD's RED step is doubt made concrete — a failing test is a disproof attempt. When TDD applies, that failing test *is* the doubt step for behavioral claims.
    - **`debugging-and-error-recovery`**: when the reviewer surfaces a real failure mode, drop into the debugging skill to localize and fix.
    - **Repo orchestration rules** (`references/orchestration-patterns.md`): this skill orchestrates from the main session. A persona calling another persona is anti-pattern B — see Loading Constraints above.
    
    ## Verification
    
    After applying doubt-driven development:
    
    - [ ] Every non-trivial decision (per the definition above) was named explicitly as a CLAIM before standing
    - [ ] At least one fresh-context review per non-trivial artifact (a failing test produced by TDD's RED step satisfies this for behavioral claims, per Interaction with Other Skills)
    - [ ] The reviewer received ARTIFACT + CONTRACT — NOT the CLAIM, NOT your reasoning
    - [ ] The reviewer's prompt was adversarial ("find issues"), not validating ("is it good")
    - [ ] Findings were classified against the artifact text (not rubber-stamped) using the precedence: contract misread / actionable / trade-off / noise
    - [ ] A stop condition was met (trivial findings, 3 cycles, or user override)
    - [ ] In interactive mode, cross-model was **explicitly offered** to the user (regardless of artifact stakes) and the response was acknowledged in the output
    - [ ] In non-interactive mode, cross-model was skipped and the skip was announced
    - [ ] Any external CLI invocation was preceded by a PATH check, a working-binary test, syntax confirmation with the user, and explicit authorization to run
    

    所有檔案

    0 個檔案

    安裝 doubt-driven-development

    請下載並將技能檔案解壓縮至您的 .claude/skills/ 目錄中。

    下載 ZIP

    複製儲存庫並將技能檔案複製到您的專案中。

    git clone https://github.com/addyosmani/agent-skills/tree/main/skills/doubt-driven-development # Copy SKILL.md to your .claude/skills/ directory

    複製 複製
    快速設定: 將技能資料夾複製到 .claude/skills/ Claude 會自動偵測並使用該技能

    相關技能

    notion-automation
    更新時間 2026-06-29
    airtable-automation
    更新時間 2026-06-29
    seo-programmatic
    更新時間 2026-06-29
    revops
    更新時間 2026-06-29
    OR