オプション
家 Skill 生産性とワークフロー doubt-driven-development

doubt-driven-development

addyosmani/agent-skills addyosmani/agent-skills

些細でない決定についてはすべて、それが確定する前に新たなコンテキストでの敵対的レビューを行い、リスクの高いコードや不慣れなコードについては、速度よりも正確性を優先する。

...すべて拡張します
9
更新された時間 2026年9月3日

不確実性のある状況下でアーキテクチャ上の決定を下そうとしているとき
  • 重要なコードをコミットしようとしているとき
  • 自明ではない事実(「これは安全だ」、「これはスケーラブルだ」、「これは仕様に合致している」)を主張しようとしているとき
  • 完全に理解していないコードを扱っているとき
  • 使用すべきでない場合:

    • 機械的な操作(名前変更、フォーマット、ファイルの移動)
    • 明確で曖昧さのないユーザーの指示に従う場合
    • 既存のコードの読み込みや要約
    • 正しさが明らかな1行の変更
    • 純粋なツール操作(テストの実行、ファイルの一覧表示)
    • ユーザーが検証よりもスピードを明示的に求めている場合

    キー入力のたびに迷っているようでは、何もリリースできない。このスキルは、上述のように定義された「些細ではない判断」にのみ適用される。

    読み込みの制約

    このスキルはメインセッションのオーケストレーター向けに設計されており、ステップ3(DOUBT、詳細は後述)において、新しいコンテキストのレビュー担当者を生成することが可能です。

    • このスキルをペルソナのスキル(frontmatterに追加しないでください。ステップ3に従うペルソナが別のペルソナを生成してしまうことになり、これはreferences/orchestration-patterns.mdで明示的に禁止されているオーケストレーションのアンチパターン(「ペルソナは他のペルソナを呼び出してはならない」)に該当します。
    • サブエージェントのコンテキスト内(Claude Codeによりサブエージェントのネストした生成が禁止されている場合)でこのスキルを適用しようとした場合:推奨される対処法は、doubt-drivenがネストして実行できないことをユーザーに明示し、メインセッションに処理を委ねることです。 あくまで最後の手段として、機能低下した自己質問によるフォールバックが存在します。ARTIFACT + CONTRACTを、以前の推論から明確に分離した新たな自己プロンプトとして書き直し、ステップ1~5を実行してください。 これは新しいコンテキストでの再検討ではありません(自身のコンテキストを持ち越しています)。そのため、結果は「機能低下」としてマークし、ユーザーと連絡が取れる場合は常にエスカレーションを優先してください。

    プロセス

    このスキルを適用する際は、以下のチェックリストを参照してください:

    疑念サイクル:
    - [ ] ステップ1:主張 — 主張内容と「なぜ重要か」を記述
    - [ ] ステップ2:抽出 — アーティファクトと契約を抽出し、推論を排除
    - [ ] ステップ3:疑念 — 対立的なプロンプトを用いて「フレッシュコンテキスト」レビューアを呼び出す
    - [ ] ステップ4:調整 — すべての発見事項をアーティファクトのテキストに対して分類
    - [ ] ステップ5:停止 — 停止条件を満たした(些細な発見、3サイクル、またはユーザーによる上書き)
    
    

    ステップ1:CLAIM — 現状を明らかにする

    2~3行で決定事項を記述する:

    主張:「新しいキャッシュ層は、
            仕様書に記載された読み取り中心のワークロード下においてスレッドセーフである。」
    これが重要な理由:ここでレース条件が発生するとユーザーデータが破損し、
                      QAでは検出が困難である。
    
    

    もしこれほど簡潔に主張を記述できないなら、それは「直感」であって「決定」ではありません。精査する前に、その直感を明確に表現してください。

    ステップ2:抽出 — レビュー可能な最小単位

    文脈に不慣れなレビュー担当者は、経緯ではなく、成果物契約内容のみを必要としています。

    • コード:差分または関数 — ファイル全体ではない
    • 決定事項:3~5文でまとめた提案と、それが満たすべき制約
    • 主張:主張そのものと、それを裏付けるとされる証拠(ステップ1の「CLAIM」ブロックとは区別される。同ブロックは、検証対象となるオーケストレーターの仮説である)

    推論を削ぎ落とせ。結論だけを提示すれば、その結論の妥当性を確認されるだけだ。単位は、レビューアが一回の読みで頭の中に収められるほど小さくしなければならない――500行のプルリクエストであれば、まず分解すること。

    ステップ3:DOUBT — 新たな視点を持つレビューアを巻き込む

    レビューアへの指示は、敵対的なものでなければなりません。枠組みの定め方が答えを決定づけます。

    対立的なレビュー。この成果物に何の問題があるかを見つけ出してください。
    著者が過信していると仮定してください。以下の点を探してください:
    - 明示されていない前提
    - 処理されていないエッジケース
    - 隠れた結合や共有状態
    - 契約が破られる可能性
    - これが破る可能性のある既存の規約
    - 予期しない入力に対する故障モード
    
    検証してはならない。要約してはならない。問題点を見つけるか、あるいは
    徹底的な調査の末、問題が見つからないことを明示的に述べる。
    
    成果物:
    契約:
    
    

    ARTIFACT と CONTRACT のみを合格としてください。CLAIM を合格にしてはいけません。結論をレビュー担当者に提示すると、同意へと誘導してしまう恐れがありますアーティファクトが契約を満たしているかどうかは、レビュー担当者が独自に判断しなければなりません。

    Claude Code では、agents/にあるロールベースのレビューアは、設計上、隔離されたコンテキストから開始されるため、ここで使用可能です。レビューアの一覧およびドメインごとの対応については、agents/ を参照してください。

    上記の敵対的プロンプトは、ペルソナのデフォルトの応答形式よりも優先されます。 「code-reviewer」のようなペルソナは、長所と短所の両方を備えたバランスの取れた判定を生成するように記述されています疑念に基づく場合、問題点のみを出力する必要があります。 対立的なプロンプトをそのまま呼び出しに貼り付け、ペルソナのデフォルト設定を上書きするようにします。ペルソナの応答形式をきれいに上書きできない場合は、対立的なプロンプトを設定した汎用サブエージェントにフォールバックします。

    モデル間のエスカレーション

    単一モデルのレビューアは、元の作成者と同じ盲点を抱えています。より客観的で、異なるアーキテクチャを持つモデルであれば、そうした盲点を捕捉できます。「Doubt-driven」は、重要度の高い決定についてはすでにオプトイン方式を採用しているため、その範囲内においてクロスモデル機能を提供することは、スキルの価値の一部であり、単なるオプションによる摩擦ではありません。

    対話型セッション:常に提供すること。決して黙ってスキップしてはならない。

    ステップ1:ユーザーに尋ねる

    上記の手順3における単一モデルのレビュー終了後、RECONCILEを実行する前に、一旦停止して次のように尋ねてください:

    「単一モデルのレビューが完了しました。モデルを跨いだセカンドオピニオンが必要ですか? 選択肢:Gemini CLI、Codex CLI、手動による外部レビュー(別の場所に貼り付けて実行)、またはスキップ。」

    この質問は、すべての対話型検証サイクルにおいて必須です。重要度が低いと思われる成果物であっても同様です。そのコストに見合うかどうかは、エージェントではなくユーザーが判断します。エージェントの役割は、その選択肢を提示することにあります。

    ステップ2:ユーザーがCLIを選択した場合――検証を行い、その後実行する

    1. ツールがPATHに設定されているか確認する(geminicodexなど)。
    2. 完全なプロンプトを渡す前に、動作確認を行います(gemini --versionまたは同等のコマンド)。古くなったバイナリや破損したバイナリは、この確認では通過するものの、実際の入力では失敗する可能性があるためです。
    3. 必要なフラグ、認証情報、環境変数(例:APIキー)を含め、正確な実行方法をユーザーと確認する。実装は様々であるため、決して推測してはならない。
    4. ARTIFACT + CONTRACT + 攻撃的なプロンプトのみを渡す。セッションコンテキストやCLAIMは含めない。
    5. シェルのエスケープに注意してください。アーティファクトに引用符、$(...)、またはバッククォートが含まれている場合は、インラインの-p "…" よりも、stdin(echo … | gemini)またはヘレドックを使用することを推奨します。不明な点がある場合は、実行する前にユーザーに呼び出し方法を確認させてください。
    6. 出力をステップ4(RECONCILE)に引き継いでください。

    アーティファクトをシェル引用符で囲まれた引数に挿入してはなりません。コード、マークダウン、レビューのプロンプトには、プロンプトを切り詰めたり、埋め込まれたシェルを実行したりするバッククォート、$(...)、引用符が頻繁に含まれていますプロンプト全体をファイルに書き出し、stdin 経由でパイプしてください。

    シェイプの例(インストール済みのツールに合わせてフラグを確認してください。構文は実装やバージョンによって異なります):

    # まず、敵対的プロンプト + アーティファクト + CONTRACT を一時ファイルに書き出します。
    # その後、stdin 経由でパイプ処理を行い、アーティファクト内のシェルメタ文字が無効化されるようにします。
    
    # Codex(読み取り専用のサンドボックスにより、CLI がワークスペースに書き込みを行うのを防ぎます):
    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アーティファクト自体に(意図的または偶発的なプロンプトの挿入として)指示が含まれている場合、クロスモデルCLIは本来であればその指示をワークスペースに対して実行してしまう可能性があります。

    ステップ 3: CLI が利用できない場合や失敗した場合

    失敗を明示的に通知する。提案:手動で実行する、別のツールを試す、またはスキップする。黙ってシングルモデルにフォールバックしてはならない。ユーザーには、クロスモデル処理が行われなかったことを知らせる必要がある。

    ステップ4:ユーザーがスキップした場合

    出力でスキップしたことを明示し(「単一モデルの分析結果のみを使用して続行します」など)、RECONCILE へ進みます。スキップ自体は問題ありませんが、何も通知せずにスキップすることは許されません。

    非対話型コンテキスト(CI、/loop、autonomous-loop、スケジュールされた実行):

    • クロスモデルはスキップされ、そのスキップは出力で次のように通知されなければなりません:「クロスモデルをスキップしました:非対話型コンテキスト。」
    • ユーザーの明示的な許可がない限り外部CLIを絶対に呼び出してはなりません。これはシステムの安全性を支える重要な特性です。

    Cross-modelはコスト、レイテンシ、およびツールの脆弱性を増加させます。エージェントは毎サイクルこの選択肢を提示し、ユーザーはこのアーティファクトがそれに見合う価値があるかどうかを判断します。

    ステップ4: 調整 — 調査結果を統合する

    レビューアの出力は「データ」であり、「結論」ではありません。主導権を握っているのは依然としてあなたです。分類を行う前に、各所見と成果物のテキストを照らし合わせて再確認してくださいレビューアの見解を無批判に受け入れることは、それを無視することと同じ失敗パターンです。

    各指摘事項について、以下の優先順位に従って分類してください(最初に一致するクラスが優先されます):

    1. 契約内容の誤解— あなたが提示した「契約」が不明確または不完全であったために、レビュー担当者が具体的に指摘したものです。まず契約内容を修正し、次のサイクルで再分類を行ってください。
    2. 有効かつ対応可能— 成果物の変更を必要とする実際の問題。変更を行い、ループを再開してください。
    3. 妥当なトレードオフ— 問題は実在するが、修正にかかるコストが容認するコストを上回る。ユーザーが確認できるよう、トレードオフを明示的に文書化する。
    4. ノイズ— レビュー担当者が、自身が把握していなかった文脈の下では実際には正しいものを指摘しました。その旨を注記し、次に進み、次の点を自問してください:その文脈を契約に追加していれば、誤った指摘を防ぐことができたでしょうか?

    新しいレビューアは、文脈を把握していないため、誤った指摘をする可能性があります。「新しい」という理由だけで判断を先送りにしてはいけません。

    ステップ5:STOP — 再帰ではなく、境界のあるループ

    次の場合に停止する:

    • 次の反復で、些細な結果やすでに検討済みの結果しか得られない場合、または
    • 3サイクルが完了した場合(ユーザーにエスカレーションし、4サイクル目を単独で処理しない)、または
    • ユーザーが明示的に「リリースして」と指示した場合

    3サイクルを経てもレビュー担当者が依然として実質的な問題を指摘する場合は、その成果物はまだ完成していない可能性があります。これをユーザーに報告してください。3サイクルにわたって未解決の問題が残っていることは、成果物に関する情報であり、ループを続ける理由にはなりません。

    成果物が大規模であるために3サイクルが「明らかに不十分」である場合:成果物が大きすぎるため、ステップ2に戻り、分解してください。制限を解除しないでください。

    よくある言い訳

    言い訳 現実
    「自信があるから、疑う段階は飛ばそう」 新しい問題において、自信と正答率の間にはほとんど相関関係がない。確信に満ちた瞬間こそ、まさに盲点が潜んでいる時なのだ。
    「レビュー担当者を確保するのはコストがかかる」 本番環境での誤ったコミットのデバッグの方がコストが高い。チェックには限界があるが、バグには限界がない。
    「レビュアーは些細なことを指摘するだけだ」 範囲が定まっていない場合に限る。プロンプトを「契約の下でこれが失敗する原因となる問題」に限定する。
    /reviewで最後に検証すればいい」 /reviewは最終ゲートだ。疑念に基づいた検証なら、方向性が間違っていることを、軌道修正のコストが低い段階で早期に発見できる。プルリクエストの段階まで来ると、手遅れだ。
    「すべてのステップに疑問を抱いていたら、リリースなんてできない」 この手法は、些細なキー入力ではなく、重要な意思決定に適用されるものです。「使用すべきでない場合」を再読してください。
    「意見は2つある方が常に1つより良い」 2つ目の意見が文脈を把握しておらず、ノイズを生む場合は別です。意見の調整を行い、判断を先送りにしてはいけません。
    「レビュー担当者が反対したから、私は間違っていた」 レビュー担当者はあなたの背景情報を把握していない――意見の相違は情報であり、結論ではない。成果物を再読し、分類してから判断を下せ。
    「モデル間比較は常に優れている」 クロスモデルは、単一のモデルがそれ自体で抱える盲点を捉えるが、コストとツールの脆弱性を増大させる。対話的な検討サイクルごとにそれを提案せよ――アーティファクトがそれを正当化するかどうかはユーザーが判断する。エージェントの役割は選択肢を提示することであり、それを制限することではない。
    「ユーザーが一度『はい』と言ったから、CLIを繰り返し呼び出してもいい」 各呼び出しは、それ自体が個別の認証を必要とします。アーティファクト、プロンプト、フラグは呼び出しごとに変化します。実行のたびに、ユーザーに正確なコマンドを再確認してください。

    注意すべき点

    • 1行の名称変更や書式変更のために、新しいコンテキストのレビュアーを起動する
    • アーティファクトのテキストを再確認せずに、レビュアーの出力を決定的なものとみなすこと
    • ユーザーにエスカレーションせずに3サイクル以上ループさせる
    • レビュー担当者に「これで大丈夫ですか?」と尋ねるのではなく、「問題点を見つけてください」と指示する
    • 重要な決定において、時間的プレッシャーの下で疑念を無視してしまう
    • 変更のないアーティファクトに対して、コンテキストをリセットして再生成すること(同じ指摘結果しか得られず、単に時間を稼いでいるだけである)
    • 「疑念の茶番」(検証可能なシグナル):2サイクル以上にわたり、レビュアーが実質的な指摘を提示したにもかかわらず、実行すべき指摘が1件も分類されなかった場合。これは「検証」であり、「疑念」ではない。一旦停止し、エスカレーションを行う。
    • コミット後にのみ疑念を抱くこと――それは「/review」であり、疑念駆動型開発ではない
    • ツールの存在、設定状況、およびその正確な構文が受け入れられることをユーザーに確認せずに、外部CLI呼び出しをハードコーディングすること
    • 対話型の疑義サイクルにおいて、モデル間検証を黙ってスキップすること。推奨しない場合でも、その選択肢は表示されなければならない。スキップ自体は構わないが、黙ってスキップするのは許されない。
    • 外部CLIでエラーが発生した場合や存在しない場合に、黙ってフォールバックすること――失敗を明示し、ユーザーにリダイレクトさせること
    • レビューアからの入力から契約条件を削除すること
    • CLAIMをレビュー担当者に渡すこと(同意へのバイアス)

    他のスキルとの連携

    • code-review-and-quality//review: 補完的。/reviewは事後のPR判定であるのに対し、doubt-drivenは進行中の各決定ごとに実施される。両方を活用する。
    • source-driven-development: SDDは公式ドキュメントに基づいてフレームワークに関する事実を検証する。「doubt-driven」は、その成果物に関するあなたの推論を検証する。SDDはAPIが存在するかどうかを確認し、「doubt-driven」は契約の範囲内でそれを正しく使用したかどうかを確認する。
    • test-driven-development: TDDのREDステップは、具体化された「疑い」そのものです。つまり、テストの失敗は反証の試みです。TDDが適用される場合、その失敗したテストこそが、動作に関する主張に対する「疑い」のステップとなります
    • デバッグとエラー回復: レビュー担当者が実際の失敗モードを指摘した場合は、デバッグスキルに切り替えて、問題箇所を特定し修正します。
    • リポジトリオーケストレーションのルールreferences/orchestration-patterns.md):このスキルはメインセッションからオーケストレーションを行います。あるペルソナが別のペルソナを呼び出すことはアンチパターンBです。上記の「読み込みの制約」を参照してください。

    検証

    「疑念主導型開発」を適用した後:

    • (上記の定義に基づく)すべての非自明な決定は、スタンドアップの前に「主張(CLAIM)」として明示的に名付けられた
    • 非自明なアーティファクトごとに、少なくとも1回の「新しいコンテキスト」でのレビューが行われた(「他のスキルとの連携」に従い、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 が自動的にそのスキルを検出して使用します。
    リポジトリ addyosmani/agent-skills

    関連スキル

    notion-automation
    更新された時間 2026年6月29日
    airtable-automation
    更新された時間 2026年6月29日
    seo-programmatic
    更新された時間 2026年6月29日
    revops
    更新された時間 2026年6月29日
    OR