doubt-driven-development
addyosmani/agent-skills
在每个非平凡的决策生效之前,对其进行基于新上下文的对抗性审查,对于高风险或不熟悉的代码,优先考虑正确性而非速度。
...展开全部即将做出存在不确定性的架构决策
不应使用的情况:
- 机械性操作(重命名、格式化、文件移动)
- 遵循清晰、明确的用户指令
- 阅读或总结现有代码
- 正确性显而易见的一行代码修改
- 纯粹的工具操作(运行测试、列出文件)
- 用户已明确要求优先考虑速度而非验证
如果你对每个按键都心存疑虑,那就什么也发布不了。这项技能仅适用于上述定义的非琐碎决策。
加载约束
该技能专为主会话协调员设计,在该场景中,步骤3(“质疑”,详见下文)可启动一个新上下文审查者。
- 请勿将此技能添加到角色的
技能列表(frontmatter)中。遵循步骤 3 的角色会创建另一个角色——这属于参考文档 references/orchestration-patterns.md中明确禁止的编排反模式(“角色不得调用其他角色”)。 - 若您发现自己在子代理上下文中应用此技能(而 Claude Code 禁止嵌套生成子代理):首选方案是向用户提示“基于怀疑的流程”无法嵌套运行,并让主会话来处理。 仅作为最后手段,存在一种降级版的自我质询备选方案——将 ARTIFACT + CONTRACT 重写为一个全新的自我提示,并通过强烈的心理分隔与之前的推理彻底区分开来,然后执行步骤 1–5。 这并非新上下文审查(你仍携带原有上下文),因此应将结果标记为“降级”,并在用户可联系时优先进行升级处理。
流程
应用该技能时,请复制此检查清单:
质疑循环:
- [ ] 步骤 1:主张 — 撰写主张 + 说明其重要性
- [ ] 步骤 2:提取 — 隔离相关证据 + 契约,剔除推理过程
- [ ] 步骤 3:质疑 — 通过对抗性提示调用“新鲜上下文”评审者
- [ ] 第4步:调和 — 根据实物文本对每项发现进行分类
- [ ] 第5步:停止 — 满足停止条件(发现结果微不足道、已完成3个循环或用户干预)
步骤 1:主张 — 提炼核心观点
用两到三行文字说明该决策:
主张:“在规格说明中描述的
读取密集型工作负载下,新的缓存层是线程安全的。”
为何重要:此处的竞争条件会破坏用户数据,且
在质量保证(QA)阶段难以检测。
如果你无法如此简洁地表述这一结论,那你拥有的只是直觉,而非明确的结论。在深入剖析之前,先将其明确提出来。
步骤 2:提取 — 最小的可审查单元
对项目背景不熟悉的评审者需要的是交付物和契约,而不是开发历程。
- 代码:差异部分或函数——而非整个文件
- 决策:3–5 句的提案,外加其必须满足的约束条件
- 断言:主张及其据称支持该主张的证据(需与步骤1中的“主张”块区分开来,后者是协调员正在接受审查的假设)
精简你的推理过程。如果你直接提交结论,得到的将是对你结论的验证。该单元必须足够小,以便审阅者能够在一遍阅读中将其掌握在脑海中——如果是一个500行的PR,请先进行分解。
步骤 3:质疑 — 引入具有全新视角的审阅者
评审者的提示必须具有对抗性。提问方式决定了答案。
对抗性评审。找出这个代码产出中存在的问题。
假设作者过于自信。重点检查:
- 未明说的假设
- 未处理的边界情况
- 隐藏的耦合或共享状态
- 可能违反契约的情况
- 可能违反的现有约定
- 意外输入下的故障模式
切勿进行验证。切勿进行总结。找出问题,或者在彻底审查后
明确声明无法发现任何问题。
代码片段:
契约:
仅提交“ARTIFACT”和“CONTRACT”。切勿提交“CLAIM”。将结论直接提供给评审员会使其倾向于认同该结论。评审员必须独立判断该工件是否满足契约要求。
在 Claude Code 中,agents/目录下的基于角色的评审员按设计从隔离上下文开始,可在此处使用——请参阅agents/目录查看评审员名单及各领域的匹配情况。
上述对抗性提示词优先于角色的默认响应模式。诸如code-reviewer之类的角色设计初衷是生成兼具优缺点、平衡的裁决;而以怀疑为驱动的角色则需要仅输出问题。 将对抗性提示词原样粘贴到调用中,以便覆盖角色的默认响应模式。如果无法干净地覆盖角色的响应模式,则回退到使用对抗性提示词的通用子代理。
跨模型升级
单一模型的审阅者与原始作者存在相同的盲点——而架构不同、更“冷静”的模型则能发现这些盲点。“疑点驱动”模式在处理非琐碎决策时已是默认启用状态,因此在此范围内提供跨模型功能是该技能价值的一部分,而非可选的阻力。
交互式会话:务必提供。切勿悄无声息地跳过。
步骤 1:询问用户
在完成上述第3步的单一模型审查后,但在执行RECONCILE之前,请暂停并询问:
“单模型审核已完成。是否需要跨模型的第二意见?选项:Gemini CLI、Codex CLI、手动外部审核(您将其粘贴到其他地方),或跳过。”
在每个交互式疑难处理循环中,此问题均为必选项——即使对于看似风险较低的成果也是如此。由用户(而非代理)决定是否值得付出相应成本。代理的职责是呈现这一选择。
步骤 2:如果用户选择了 CLI——先验证,然后调用
- 检查工具是否在 PATH 环境变量中(
即 gemini、codex)。 - 在传递完整提示前测试其是否正常工作(例如
gemini --version或等效操作)——过期或损坏的二进制文件可能通过测试,但在处理实际输入时会失败。 - 与用户确认确切的调用方式,包括必需的参数、身份验证和环境变量(例如 API 密钥)。具体实现各不相同;切勿擅自假设。
- 仅传递 ARTIFACT + CONTRACT + 对抗性提示。不包含会话上下文,不包含 CLAIM。
- 注意 shell 转义。如果 artifact 包含引号、
$(...)或反引号,请优先使用标准输入(echo … | gemini)或 heredoc,而非内联的-p "…"形式。如有疑问,请在运行前要求用户确认调用方式。 - 将输出结果带入第 4 步(RECONCILE)。
切勿将 ARTIFACT 插值到带 shell 引号的参数中。代码、Markdown 和评审提示中常包含反引号、$(...) 及引号字符,这些会截断提示或执行嵌入的 shell 命令。请将完整提示写入文件,并通过 stdin 进行管道传输。
示例格式(请根据您安装的工具验证参数——不同实现和版本的语法可能有所差异):
# 首先将对抗性提示符 + 人工制品 + 契约写入临时文件。
# 然后通过标准输入(stdin)进行管道传输,以确保人工制品中的 shell 元字符保持无效。
# 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
只读沙箱是关键所在:一个疑点工件本身可能包含指令(无论是故意还是意外的提示注入),否则跨模型 CLI 会将其应用到您的工作区中。
步骤 3:如果 CLI 不可用或执行失败
应明确提示失败。提供以下建议:手动运行、尝试其他工具或跳过。切勿默认回退到单模型模式——用户应知晓跨模型操作未成功。
步骤 4:如果用户跳过
在输出中确认跳过操作(“仅继续处理单模型分析结果”),并继续执行“协调”步骤。允许跳过操作,但不应在用户不知情的情况下默认跳过。
非交互式场景(CI、/loop、autonomous-loop、定时运行):
- 跨模型分析将被跳过,且必须在输出中明确标注该跳过操作:“跨模型分析已跳过:非交互式环境。”
- 未经用户明确授权,切勿调用外部CLI——这是一项承重级安全属性。
跨模型操作会增加成本、延迟并导致工具不稳定。代理会在每个周期中提示该选项;由用户决定该构建产物是否值得进行跨模型操作。
步骤 4:整合 — 将发现的结果整合回系统
评审员的输出是数据,而非最终裁决。你仍然是协调者。在进行分类之前,请对照每个发现结果重新阅读该成果的文本——对评审员的意见照单全收,与完全忽视评审结果一样,都是失败的模式。
对于每个发现项,请按以下优先级顺序进行分类(最先匹配的类别优先):
- 合同解读错误——评审员之所以标记某项问题,正是因为您提供的合同不明确或不完整。请先修正合同,并在下一个周期重新分类。
- 有效且可处理——真实问题,需要对交付物进行修改。进行修改后,重新进入循环。
- 合理的权衡— 问题确实存在,但修复成本高于接受该问题的成本。请明确记录该权衡,以便用户知晓。
- 误报——评审员标记的内容在评审员未掌握的上下文中实际上是正确的。记录该情况,继续推进,并自问:如果在合同中添加该上下文,是否能避免此次误报?
一位新评审员可能会因缺乏上下文而出现错误。不要仅仅因为对方是“新来的”就推迟处理。
步骤 5:STOP —— 有界循环,而非递归
在以下情况下停止:
- 下一次迭代仅返回微不足道或已考虑过的结果,或者
- 已完成 3 个循环(上报给用户,不要独自进行第 4 个循环),或者
- 用户明确表示“发布”
如果经过3个循环后,评审者仍然指出实质性问题,则该成果可能尚未准备就绪。应将此情况反馈给用户——三个未解决的循环反映了该成果的现状,而非继续循环的理由。
如果因交付物规模庞大而导致 3 个迭代周期“显然不够”:说明该交付物过于庞大——请返回第 2 步并进行分解。切勿放宽限制。
常见的合理化借口
| 借口 | 现实 |
|---|---|
| “我很有信心,跳过怀疑这一步吧” | 面对新问题时,自信与正确答案之间关联性很弱。越是确信无疑的时刻,往往越是盲点隐藏之处。 |
| “安排一位审阅者成本很高” | 在生产环境中调试一个错误的提交成本更高。检查的成本是有限的,而 bug 的影响却是无穷的。 |
| “审阅者只会吹毛求疵” | 只有在没有明确范围时才会如此。将提示语限定为“会导致此代码在合约下失败的问题”。 |
“我会在最后通过/review 进行复核” |
/review是最终把关环节。基于怀疑的审查能及早发现错误方向,此时调整方向的成本较低。等到PR提交时,往往为时已晚。 |
| “如果每一步都心存疑虑,我永远都发布不了” | 这项技巧适用于非琐碎的决策,而非每个键盘敲击。请重读“何时不应使用”部分。 |
| “两个意见总比一个好” | 当第二种意见缺乏背景信息且只会制造噪音时则不然。应寻求调和,而非推诿。 |
| “评审者不同意,所以我是错的” | 审阅者缺乏你的背景信息——意见分歧是信息,而非定论。请重新审阅成果,进行分类,然后做出决定。 |
| “跨模型总是更好的” | 跨模型能发现单一模型自身存在的盲点,但会增加成本并导致工具不稳定。在每个交互式疑虑循环中都提供该选项——由用户决定该成果是否值得采用。智能代理的职责是呈现选择,而非限制选择。 |
| “用户曾同意过一次,所以我可以继续调用 CLI” | 每次调用都需单独授权。输出结果、提示词和参数在每次调用间都会发生变化——每次运行前,务必与用户重新确认确切的命令。 |
红旗警示
- 仅因一行重命名或格式调整就启动一个全新上下文的审阅者
- 未重新阅读工件文本,便将审阅者输出的内容视为权威结果
- 循环超过3轮却未将问题上报给用户
- 向审阅者提示“这样好吗?”而非“找出问题”
- 在时间紧迫且决策风险极高的情况下,忽视疑虑
- 对未更改的工件重新创建“全新上下文”审核(结果将与之前相同;这只是拖延)
- “怀疑秀”(可验证信号):在审阅者提出实质性发现的两个或更多轮次中,没有任何发现被归类为可采取行动的。你是在确认,而非质疑。请停止并上报。
- 仅在提交后才提出质疑——那是
/review,而非“基于质疑的开发” - 在未向用户确认工具是否存在、是否已配置以及是否接受该精确语法的情况下,硬编码外部 CLI 调用
- 在交互式质疑循环中无提示地跳过跨模型检查。即使不建议执行,该选项也必须可见。跳过可以,但无提示跳过不行。
- 当外部命令行工具出错或缺失时,若默认静默回退——应显式提示失败,并允许用户重定向
- 从审阅者的输入中移除契约
- 将“主张”(CLAIM)直接传递给审阅者(会导致倾向于同意)
与其他技能的交互
代码审查与质量//review:互补关系。/review是针对拉取请求的事后裁决;而“基于疑点的”审查则是在开发过程中针对每项决策进行的。建议两者结合使用。源代码驱动开发(SDD):SDD 通过官方文档验证框架相关事实;“基于疑点”则验证你对该构建成果的推理。SDD 检查 API 是否存在;“基于疑点”则检查你是否在契约范围内正确使用了它。测试驱动开发(TDD):TDD 的 RED 步骤就是将“怀疑”具体化——失败的测试就是一种反证尝试。当 TDD 适用时,该失败的测试就是针对行为断言的“怀疑”步骤。调试与错误恢复:当审阅者发现真实的故障模式时,应启用调试技能来定位并修复问题。- 仓库协调规则(
references/orchestration-patterns.md):此技能从主会话进行协调。一个角色调用另一个角色属于反模式 B——参见上文的“加载约束”。
验证
应用“怀疑驱动开发”后:
- 每个非平凡的决策(按上述定义)在落地前均被明确命名为“主张”
- 每个非平凡的工件至少进行一次新上下文审查(根据《与其他技能的交互》所述,TDD中RED步骤生成的失败测试可满足行为类主张的审查要求)
- 评审者收到的是“工件 + 契约”——而不是“主张”,也不是你的推理
- 评审者的提示采用对抗性(“找出问题”),而非验证性(“是否良好”)
- 发现的问题是根据以下优先级依据该工件文本进行分类(而非走过场):合同误读 / 可行动项 / 权衡 / 噪音
- 满足了终止条件(琐碎发现、3个迭代周期或用户覆盖)
- 在交互模式下,系统会明确向用户提供跨模型分析选项(无论交付物的重要性如何),并在输出中确认用户的响应
- 在非交互模式下,跳过了跨模型检查,并明确告知了跳过操作
- 任何外部 CLI 调用之前,均需先进行 PATH 检查、二进制文件有效性测试、与用户确认语法,并获得明确的运行授权
---
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





首页
