Doubt-Driven Development

Doubt-Driven Development

Has a coding agent cross-examine each non-trivial decision with a fresh-context adversarial reviewer before it stands, to catch hidden assumptions and failure modes.

Skill files2 files

references/shared/

SKILL.md246 lines
1
---
2
name: doubt-driven-development
3
description: Subjects every non-trivial decision to a fresh-context adversarial review before it stands. Use when you want every assumption cross-examined before proceeding, when stress-testing a plan for hidden failure modes, when correctness matters more than speed, when working in unfamiliar code, when stakes are high (production auth, security-sensitive logic, a high-stakes migration, irreversible operations), or any time a confident output would be cheaper to verify now than to debug later.
4
---
5
6
# Doubt-Driven Development
7
8
## Overview
9
10
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.
11
12
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.
13
14
## When to Use
15
16
A decision is **non-trivial** when at least one of these is true:
17
18
- It introduces or modifies branching logic
19
- It crosses a module or service boundary
20
- It asserts a property the type system or compiler cannot verify (thread safety, idempotence, ordering, invariants)
21
- Its correctness depends on context the future reader cannot see
22
- Its blast radius is irreversible (production deploy, data migration, public API change)
23
24
Apply the skill when:
25
26
- About to make an architectural decision under uncertainty
27
- About to commit non-trivial code
28
- About to claim a non-obvious fact ("this is safe", "this scales", "this matches the spec")
29
- Working in code you don't fully understand
30
31
**When NOT to use:**
32
33
- Mechanical operations (renaming, formatting, file moves)
34
- Following a clear, unambiguous user instruction
35
- Reading or summarizing existing code
36
- One-line changes with obvious correctness
37
- Pure tooling operations (running tests, listing files)
38
- The user has explicitly asked for speed over verification
39
40
If you doubt every keystroke, you ship nothing. The skill applies only to non-trivial decisions as defined above.
41
42
## Loading Constraints
43
44
This skill is designed for the **main-session orchestrator**, where Step 3 (DOUBT, detailed below) can spawn a fresh-context reviewer.
45
46
- **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/shared/orchestration-patterns.md` ("personas do not invoke other personas").
47
- **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.
48
49
## The Process
50
51
Copy this checklist when applying the skill:
52
53
```
54
Doubt cycle:
55
- [ ] Step 1: CLAIM — wrote the claim + why-it-matters
56
- [ ] Step 2: EXTRACT — isolated artifact + contract, stripped reasoning
57
- [ ] Step 3: DOUBT — invoked fresh-context reviewer with adversarial prompt
58
- [ ] Step 4: RECONCILE — classified every finding against the artifact text
59
- [ ] Step 5: STOP — met stop condition (trivial findings, 3 cycles, or user override)
60
```
61
62
### Step 1: CLAIM — Surface what stands
63
64
Name the decision in two or three lines:
65
66
```
67
CLAIM: "The new caching layer is thread-safe under the
68
read-heavy workload described in the spec."
69
WHY THIS MATTERS: a race here corrupts user data and is
70
hard to detect in QA.
71
```
72
73
If you can't write the claim that compactly, you have a vibe, not a decision. Surface it before scrutinizing it.
74
75
### Step 2: EXTRACT — Smallest reviewable unit
76
77
A fresh-context reviewer needs the **artifact** and the **contract**, not the journey.
78
79
- Code: the diff or the function — not the whole file
80
- Decision: the proposal in 3–5 sentences plus the constraints it has to satisfy
81
- 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)
82
83
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.
84
85
Strip reasoning, not evidence: if a caller, guard or test contradicts the claim, include it in the unit.
86
87
### Step 3: DOUBT — Invoke the fresh-context reviewer
88
89
The reviewer's prompt **must be adversarial**. Framing decides the answer.
90
91
```
92
Adversarial review. Find what is wrong with this artifact.
93
Assume the author is overconfident. Look for:
94
- Unstated assumptions
95
- Edge cases not handled
96
- Hidden coupling or shared state
97
- Ways the contract could be violated
98
- Existing conventions this might break
99
- Failure modes under unexpected input
100
101
Do NOT validate. Do NOT summarize. Find issues, or state
102
explicitly that you cannot find any after thorough examination.
103
104
ARTIFACT: <paste artifact>
105
CONTRACT: <paste contract>
106
```
107
108
**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.
109
110
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.
111
112
**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.
113
114
#### Cross-model escalation
115
116
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.
117
118
**Interactive sessions: always offer. Never silently skip.**
119
120
**Step 1: Ask the user**
121
122
After the single-model review in Step 3 above, but before RECONCILE, pause and ask:
123
124
> *"Single-model review complete. Want a cross-model second opinion? Options: Gemini CLI, Codex CLI, manual external review (you paste it elsewhere), or skip."*
125
126
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.
127
128
**Step 2: If the user picks a CLI — verify, then invoke**
129
130
1. Check the tool is in PATH (`which gemini`, `which codex`).
131
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.
132
3. Confirm the exact invocation with the user, including required flags, auth, and env vars (e.g., API keys). Implementations vary; never assume.
133
4. Pass ARTIFACT + CONTRACT + the adversarial prompt **only**. No session context, no CLAIM.
134
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.
135
6. Take the output into Step 4 (RECONCILE).
136
137
**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.
138
139
Example shapes (verify flags against your installed tool — syntax differs across implementations and versions):
140
141
```bash
142
# Write the adversarial prompt + ARTIFACT + CONTRACT to a temp file first.
143
# Then pipe via stdin so shell metacharacters in the artifact stay inert.
144
145
# Codex (read-only sandbox keeps the CLI from writing to your workspace):
146
codex exec --sandbox read-only -C <repo-path> - < /tmp/doubt-prompt.md
147
148
# Gemini ('--approval-mode plan' is read-only; '-p ""' triggers non-interactive
149
# mode and the prompt is read from stdin):
150
gemini --approval-mode plan -p "" < /tmp/doubt-prompt.md
151
```
152
153
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.
154
155
**Step 3: If the CLI is unavailable or fails**
156
157
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.
158
159
**Step 4: If the user skips**
160
161
Acknowledge the skip in the output (*"Proceeding with single-model findings only"*) and continue to RECONCILE. Skipping is fine; silent skipping is not.
162
163
**Non-interactive contexts** (CI, `/loop`, autonomous-loop, scheduled runs):
164
165
- Cross-model is **skipped**, and the skip must be **announced** in the output: *"Cross-model skipped: non-interactive context."*
166
- **Never invoke an external CLI without explicit user authorization** — this is a load-bearing safety property.
167
168
Cross-model adds cost, latency, and tool fragility. The agent surfaces the choice every cycle; the user decides whether this artifact warrants it.
169
170
### Step 4: RECONCILE — Fold findings back
171
172
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.
173
174
For each finding, classify in this **precedence order** (first matching class wins):
175
176
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.
177
2. **Valid + actionable** — real issue requiring a change to the artifact. Change it, re-loop.
178
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.
179
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?
180
181
A fresh reviewer can be wrong because it lacks context. Don't defer just because it's "fresh."
182
183
### Step 5: STOP — Bounded loop, not recursion
184
185
Stop when:
186
187
- Next iteration returns only trivial or already-considered findings, **or**
188
- 3 cycles completed (escalate to user, don't grind a fourth alone), **or**
189
- User explicitly says "ship it"
190
191
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.
192
193
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.
194
195
## Common Rationalizations
196
197
| Rationalization | Reality |
198
|---|---|
199
| "I'm confident, skip the doubt step" | Confidence correlates poorly with correctness on novel problems. Moments of certainty are exactly when blind spots hide. |
200
| "Spawning a reviewer is expensive" | Debugging a wrong commit in production is more expensive. The check is bounded; the bug isn't. |
201
| "The reviewer will just nitpick" | Only if unscoped. Constrain the prompt to "issues that would make this fail under the contract." |
202
| "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. |
203
| "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." |
204
| "Two opinions are always better than one" | Not when the second has less context and produces noise. Reconcile, don't defer. |
205
| "The reviewer disagreed so I was wrong" | The reviewer lacks your context — disagreement is information, not verdict. Re-read the artifact, classify, then decide. |
206
| "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. |
207
| "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. |
208
209
## Red Flags
210
211
- Spawning a fresh-context reviewer for a one-line rename or formatting change
212
- Treating reviewer output as authoritative without re-reading the artifact text
213
- Looping >3 cycles without escalating to the user
214
- Prompting the reviewer with "is this good?" instead of "find issues"
215
- Skipping doubt under time pressure on a high-stakes decision
216
- Re-spawning fresh-context on an unchanged artifact (you'll get the same findings; you're stalling)
217
- **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.
218
- Doubting only after committing — that's `/review`, not doubt-driven development
219
- Hardcoding an external CLI invocation without confirming with the user that the tool exists, is configured, and accepts that exact syntax
220
- **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.
221
- Falling back silently when an external CLI errors or is missing — surface the failure and let the user redirect
222
- Stripping the contract from the reviewer's input
223
- Passing the CLAIM to the reviewer (biases toward agreement)
224
225
## Interaction with Other Skills
226
227
- **`code-review-and-quality` / `/review`**: complementary. `/review` is post-hoc PR verdict; doubt-driven is in-flight per-decision. Use both.
228
- **`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.
229
- **`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.
230
- **`debugging-and-error-recovery`**: when the reviewer surfaces a real failure mode, drop into the debugging skill to localize and fix.
231
- **Repo orchestration rules** (`references/shared/orchestration-patterns.md`): this skill orchestrates from the main session. A persona calling another persona is anti-pattern B — see Loading Constraints above.
232
233
## Verification
234
235
After applying doubt-driven development:
236
237
- [ ] Every non-trivial decision (per the definition above) was named explicitly as a CLAIM before standing
238
- [ ] 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)
239
- [ ] The reviewer received ARTIFACT + CONTRACT — NOT the CLAIM, NOT your reasoning
240
- [ ] The reviewer's prompt was adversarial ("find issues"), not validating ("is it good")
241
- [ ] Findings were classified against the artifact text (not rubber-stamped) using the precedence: contract misread / actionable / trade-off / noise
242
- [ ] A stop condition was met (trivial findings, 3 cycles, or user override)
243
- [ ] In interactive mode, cross-model was **explicitly offered** to the user (regardless of artifact stakes) and the response was acknowledged in the output
244
- [ ] In non-interactive mode, cross-model was skipped and the skip was announced
245
- [ ] Any external CLI invocation was preceded by a PATH check, a working-binary test, syntax confirmation with the user, and explicit authorization to run
246

© Addy Osmani · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 6,373 prompts

More by @OpenSourceBuffGuy

See all
Website Clone Architect prompt image

Website Clone Architect

Reverse-engineers a website section by section, writes component specs, and hands them to parallel builder agents in git worktrees to rebuild it.

agent-skill, orchestrator, parallel-agents, multi-agent, plan-then-execute, web-development, frontend, codebase-analysis, scaffolding, css, html, nextjs, typescript, git, mcp, claude-code, for-developers, for-designers, long-form, advanced, technical-spec, task-decomposition, structured-output, design-systems, ui-ux, tool-use, checklist, report, vibe-coding

Italian Terrace Cafe Candid Portrait prompt image

Italian Terrace Cafe Candid Portrait

Generates a photorealistic candid shot of a woman in a white corset dress laughing at a sunny hotel terrace cafe, written as detailed JSON.

image-prompt, json-prompt, structured-output, photorealistic, portrait, woman, candid, fashion, cottagecore, natural-light, golden-hour, bokeh, summer, travel, cityscape, mountains, medium-shot, vibrant-colors, for-photographers, nano-banana, fashion-shoot, luxury

Night Street Photo With Leashed Cat prompt image

Night Street Photo With Leashed Cat

Generates a flash-lit night street photo of a blonde woman in a retro track jacket walking a hissing tabby cat on a leash.

image-prompt, json-prompt, nano-banana, structured-output, portrait, woman, animals, pet-portrait, night-scene, street-photography, candid, editorial, fashion, dramatic-lighting, photorealistic, vertical-format, medium-shot, graffiti, for-photographers, for-content-creators

1 view

Reviews

Loading reviews…

Discussion

Loading comments…