doubt-driven-development
addyosmani/agent-skills
모든 비사소한 결정에 대해, 해당 결정이 확정되기 전에 새로운 맥락에서 적대적 검토를 실시하며, 위험이 크거나 익숙하지 않은 코드의 경우 속도보다 정확성을 우선시합니다.
...모든 것을 확장하십시오불확실한 상황에서 아키텍처 결정을 내리려
사용하지 말아야 할 경우:
- 기계적인 작업(이름 변경, 서식 조정, 파일 이동)
- 명확하고 모호함 없는 사용자의 지시를 따를 때
- 기존 코드 읽기 또는 요약하기
- 정확성이 명백한 한 줄짜리 변경
- 순수한 도구 사용 작업 (테스트 실행, 파일 목록 표시)
- 사용자가 검증보다 속도를 명시적으로 요청한 경우
키를 누를 때마다 의구심을 품는다면, 아무것도 출시할 수 없습니다. 이 기술은 위에서 정의한 대로 사소한 결정이 아닌 경우에만 적용됩니다.
로딩 제약 조건
이 기술은 메인 세션 오케스트레이터를 위해 고안되었으며, 여기서 3단계(DOUBT, 아래에서 자세히 설명)에서 새로운 컨텍스트의 검토자를 생성할 수 있습니다.
- 이 스킬을 페르소나의
스킬(frontmatter)에 추가해서는 안 됩니다. 3단계를 따르는 페르소나는 또 다른 페르소나를 생성하게 되는데, 이는references/orchestration-patterns.md에서명시적으로 금지된 오케스트레이션 안티패턴입니다("페르소나는 다른 페르소나를 호출해서는 안 됨"). - 만약 서브에이전트 컨텍스트 내부에서 (Claude Code가 중첩된 서브에이전트 생성을 방지하는 경우)이 스킬을 적용해야 하는 상황이라면, 가장 바람직한 방법은 ‘doubt-driven’이 중첩되어 실행될 수 없음을 사용자에게 알리고 메인 세션에서 처리하도록 하는 것입니다. 최후의 수단으로만, 성능이 저하된 자기 질문 대체 방법이 존재합니다. ARTIFACT + CONTRACT를 이전 추론과 명확히 구분되는 새로운 자기 프롬프트로 재작성하고, 1~5단계를 수행하십시오. 이는 새로운 컨텍스트에서의 검토가 아니므로 (사용자는 자신의 컨텍스트를 그대로 유지함), 결과를 성능 저하된 것으로 표시하고 사용자와 연락이 닿을 때마다 에스컬레이션을 우선적으로 선택해야 합니다.
프로세스
스킬을 적용할 때 이 체크리스트를 참고하십시오:
의심 주기:
- [ ] 1단계: CLAIM — 주장 내용 및 그 중요성 기술
- [ ] 2단계: EXTRACT — 아티팩트 및 계약서 분리, 추론 과정 제거
- [ ] 3단계: DOUBT — 대립적 프롬프트를 사용하여 새로운 맥락의 검토자 호출
- [ ] 4단계: 조정 — 모든 발견 사항을 아티팩트 텍스트와 대조하여 분류
- [ ] 5단계: 중지 — 중지 조건 충족 (사소한 발견 사항, 3회 사이클 완료, 또는 사용자 수동 중지)
1단계: CLAIM — 현존하는 내용을 도출
두세 줄로 결정을 명명하세요:
주장: "새로운 캐싱 계층은 사양에 기술된
읽기 중심 워크로드 하에서 스레드 안전하다."
이것이 중요한 이유: 여기서 경합이 발생하면 사용자 데이터가 손상되며
QA 단계에서 이를 탐지하기 어렵다.
주장을 그렇게 간결하게 작성할 수 없다면, 그것은 ‘결론’이 아니라 ‘추측’일 뿐입니다. 면밀히 검토하기 전에 이를 명확히 드러내십시오.
2단계: 추출 — 검토 가능한 최소 단위
새로운 맥락에서 검토를 시작하는 사람은 개발 과정 전체가 아니라, 결과물 과 계약서만 필요합니다.
- 코드: 전체 파일이 아닌, 변경 내역(diff)이나 함수
- 결정: 3~5문장으로 요약된 제안과, 이를 충족해야 할 제약 조건
- 주장: 주장 내용과 이를 뒷받침한다고 여겨지는 증거 (검토 대상인 오케스트레이터의 가설인 1단계 ‘주장(CLAIM)’ 블록과는 별개로 처리)
추론 과정을 간결하게 정리하세요. 결론을 그대로 제시하면, 그 결론에 대한 타당성 검증만 되돌아올 것입니다. 단위는 검토자가 한 번 읽는 동안 머릿속에 담아둘 수 있을 만큼 작아야 합니다. 500줄짜리 PR이라면, 먼저 분해하세요.
3단계: 의심 — 새로운 맥락에서 접근하는 검토자를 활용하라
검토자에게 제시하는 질문은 대립적인 형태여야 합니다. 질문의 틀이 답변을 결정합니다.
대립적인 검토. 이 아티팩트에 무엇이 문제인지 찾아내세요.
작성자가 지나치게 자신만만하다고 가정하세요. 다음을 찾아보세요:
- 명시되지 않은 가정
- 처리되지 않은 경계 사례
- 숨겨진 결합 또는 공유된 상태
- 계약이 위반될 수 있는 방법
- 이로 인해 위반될 수 있는 기존 관례
- 예상치 못한 입력에 따른 오류 모드
검증하지 마십시오. 요약하지 마십시오. 문제점을 찾거나,
철저한 검토 끝에 아무런 문제점을 찾을 수 없음을 명시적으로 밝히십시오.
아티팩트:
계약:
아티팩트와 계약서만 제출하십시오. 주장은 제출하지 마십시오. 검토자에게 결론을 제시하면 검토자가 동의하는 쪽으로 편향될 수 있습니다. 검토자는 아티팩트가 계약을 충족하는지 여부를 독립적으로 판단해야 합니다.
Claude Code에서 agents/ 디렉토리의 역할 기반 검토자들은 설계상 격리된 컨텍스트로 시작하며, 여기에서 사용할 수 있습니다. 검토자 목록 및 도메인별 매칭에 대해서는 agents/ 디렉토리를 참조하십시오.
위의 적대적 프롬프트는 페르소나의 기본 응답 형식에 우선합니다. code-reviewer와 같은 페르소나는 장단점을 모두 갖춘 균형 잡힌 판정을 내리도록 작성되었으며, 의구심에 기반한 경우 문제점만 출력해야 합니다. 페르소나의 기본 설정을 재정의할 수 있도록 적대적 프롬프트를 그대로 호출문에 붙여넣으십시오. 페르소나의 응답 형식을 깔끔하게 재정의할 수 없는 경우, 적대적 프롬프트를 적용한 일반 하위 에이전트로 대체하십시오.
모델 간 에스컬레이션
단일 모델 리뷰어는 원작자와 사각지대를 공유하지만, 더 냉철하고 다른 아키텍처를 가진 모델은 이러한 사각지대를 포착합니다. ‘의심 기반’은 이미 사소한 결정이 아닌 경우 선택적으로 활성화되므로, 해당 범위 내에서 모델 간 확장을 제공하는 것은 스킬의 가치의 일부이지 선택적 마찰이 아닙니다.
대화형 세션: 항상 제공해야 합니다. 절대 조용히 건너뛰어서는 안 됩니다.
1단계: 사용자에게 질문하기
위의 3단계에서 단일 모델 검토를 마친 후, RECONCILE 단계에 들어가기 전에 잠시 멈추고 다음과 같이 물어보세요:
"단일 모델 검토가 완료되었습니다. 모델 간 제2의 의견을 원하십니까? 선택 사항: Gemini CLI, Codex CLI, 수동 외부 검토(다른 곳에 내용을 붙여넣기), 또는 건너뛰기."
이 질문은 모든 대화형 의문 처리 주기에서 필수적으로 이루어져야 합니다. 중요도가 낮아 보이는 아티팩트의 경우에도 마찬가지입니다. 비용이 그만한 가치가 있는지 여부는 에이전트가 아닌 사용자가 결정합니다. 에이전트의 역할은 선택지를 제시하는 것입니다.
2단계: 사용자가 CLI를 선택한 경우 — 검증한 후 실행
- 도구가 PATH에 포함되어 있는지 확인합니다(
gemini,codex 등). - 전체 프롬프트를 전달하기 전에 정상 작동하는지 테스트합니다(
gemini --version또는 이에 상응하는 명령). 오래되었거나 손상된 바이너리는테스트에서는통과할 수 있지만 실제 입력에서는 실패할 수 있습니다. - 필수 플래그, 인증 정보, 환경 변수(예: API 키)를 포함하여 정확한 호출 방식을 사용자와 확인하십시오. 구현 방식은 다양하므로 절대 가정하지 마십시오.
- ARTIFACT + CONTRACT + 공격용 프롬프트만 전달하십시오. 세션 컨텍스트나 CLAIM은 포함하지 마십시오.
- 셸 이스케이핑에 유의하십시오. 아티팩트에 따옴표,
$(...), 또는 백틱이 포함된 경우, 인라인-p "…"대신 stdin(echo … | gemini) 또는 헤레독을 사용하는 것이 좋습니다. 확실하지 않은 경우, 실행하기 전에 사용자에게 호출 방식을 확인하도록 요청하십시오. - 출력 결과를 4단계(RECONCILE)로 넘기십시오.
아티팩트를 쉘 따옴표로 묶인 인자에 절대 삽입하지 마십시오. 코드, 마크다운 및 리뷰 프롬프트에는 프롬프트를 잘라내거나 내장된 쉘을 실행하게 만드는 백틱, $(...), 따옴표 문자가 흔히 포함되어 있습니다. 전체 프롬프트를 파일에 작성한 후 stdin을 통해 파이프 처리하십시오.
예시 형식 (설치된 도구에 따라 플래그를 확인하십시오 — 구현 및 버전에 따라 구문이 다릅니다):
# 먼저 적대적 프롬프트 + 아티팩트 + CONTRACT를 임시 파일에 기록합니다.
# 그런 다음 표준 입력(stdin)을 통해 파이프하여 아티팩트 내의 쉘 메타문자가 비활성화된 상태로 유지되도록 합니다.
# Codex (읽기 전용 샌드박스는 CLI가 작업 공간에 쓰기를 방지합니다):
codex exec --sandbox read-only -C - < /tmp/doubt-prompt.md
# Gemini('--approval-mode plan'은 읽기 전용이며, '-p ""'는 비대화형
# 모드를 활성화하고 프롬프트는 표준 입력(stdin)에서 읽습니다):
gemini --approval-mode plan -p "" < /tmp/doubt-prompt.md
읽기 전용 샌드박스가 핵심 요소입니다. ‘doubt’ 아티팩트 자체에 (의도적이든 우발적이든 프롬프트 삽입 형태로) 크로스 모델 CLI가 사용자의 작업 공간에서 실행했을 지 모를 명령어가 포함될 수 있기 때문입니다.
3단계: CLI를 사용할 수 없거나 오류가 발생하는 경우
오류를 명시적으로 표시하십시오. 수동으로 실행하거나, 다른 도구를 사용해 보거나, 건너뛰도록 제안하십시오. 아무런 알림 없이 단일 모델로 자동 전환해서는 안 됩니다. 사용자는 크로스 모델 처리가 이루어지지 않았음을 알아야 합니다.
4단계: 사용자가 건너뛸 경우
출력 화면에 건너뜀 사실을 명시적으로 표시하고("단일 모델 분석 결과만 진행 중") RECONCILE 단계로 진행하십시오. 건너뛰는 것은 괜찮지만, 아무런 알림 없이 자동으로 건너뛰어서는 안 됩니다.
비상호작용적 컨텍스트 (CI, /loop, autonomous-loop, 예약 실행):
- 크로스-모델 단계는 건너뛰며, 이를 출력에 반드시 명시해야 합니다: "크로스-모델 건너뛰기: 비상호작용 컨텍스트."
- 사용자의 명시적인 승인 없이는 절대로 외부 CLI를 호출해서는 안 됩니다. 이는 시스템의 안정성을 지탱하는 핵심 안전 속성입니다.
크로스 모델은 비용, 지연 시간 및 도구 취약성을 증가시킵니다. 에이전트는 매 사이클마다 선택지를 제시하며, 사용자는 이 아티팩트가 이를 감수할 만한 가치가 있는지 결정합니다.
4단계: 조정 — 결과를 다시 통합
검토자의 산출물은 데이터이지, 최종 판결이 아닙니다. 여전히 주도권은 여러분에게 있습니다. 분류하기 전에 각 조사 결과를 바탕으로 아티팩트 텍스트를 다시 읽어보세요. 검토자의 의견을 무비판적으로 수용하는 것은 이를 무시하는 것과 마찬가지로 실패로 이어집니다.
각 발견 사항에 대해 다음 우선순위 순서대로 분류하십시오(가장 먼저 일치하는 분류가 우선합니다):
- 계약서 오독 — 검토자가 귀하가 제공한 계약서가 불명확하거나 불완전하다는 이유로 특정 사항을 지적한 경우입니다. 먼저 계약서를 수정하고, 다음 주기에서 재분류하십시오.
- 유효 + 조치 필요 — 아티팩트 변경이 필요한 실제 문제입니다. 수정하고, 다시 루프를 돌리십시오.
- 타당한 절충안 — 문제는 실제로 존재하지만, 수정 비용이 수용 비용을 초과합니다. 사용자가 이를 확인할 수 있도록 절충안을 명확히 문서화하십시오.
- 노이즈 — 검토자가 가지고 있지 않은 맥락에서 볼 때 실제로는 올바른 사항에 대해 검토자가 문제를 제기한 경우입니다. 이를 기록하고 다음 단계로 넘어가며, 계약서에 해당 맥락을 추가했다면 잘못된 지적을 방지할 수 있었을지 자문해 보십시오.
새로운 검토자는 맥락을 충분히 파악하지 못해 오류를 범할 수 있습니다. 단순히 “새로운” 검토자라는 이유만으로 검토를 미루지 마십시오.
5단계: 중지 — 재귀가 아닌 유한 루프
다음과 같은 경우 중지하세요:
- 다음 반복에서 사소한 결과나 이미 검토된 결과만 반환 되거나,
- 3회 반복이 완료되었을 때(사용자에게 에스컬레이션하고, 혼자서 네 번째 반복까지 계속하지 마십시오), 또는
- 사용자가 명시적으로 “출시하라”고 말할 때
3회 사이클이 끝난 후에도 검토자가 여전히 실질적인 문제를 제기한다면, 해당 산출물은 준비가 되지 않은 것일 수 있습니다. 이를 사용자에게 알리십시오. 해결되지 않은 3회의 사이클은 산출물에 대한 정보일 뿐, 계속 반복해야 할 이유는 아닙니다.
아티팩트의 규모가 커서 3사이클이 “명백히 불충분”한 경우: 아티팩트가 너무 큽니다 — 2단계로 돌아가 분해하십시오. 제한을 해제하지 마십시오.
흔히 있는 변명
| 합리화 | 현실 |
|---|---|
| "자신감이 있으니, 의심하는 단계는 건너뛰자" | 새로운 문제에 있어서는 자신감과 정답 간의 상관관계가 미미하다. 확신이 드는 순간이야말로 사각지대가 숨어 있는 때다. |
| "검토자를 배정하는 데는 비용이 많이 든다" | 프로덕션 환경에서 잘못된 커밋을 디버깅하는 데 드는 비용이 더 크다. 검사는 한계가 있지만, 버그에는 한계가 없다. |
| "리뷰어는 사소한 점만 따질 뿐이야" | 범위가 명확하지 않은 경우에만 그렇습니다. 프롬프트를 “계약 조건 하에서 이 코드가 실패하게 만들 수 있는 문제점”으로 제한하십시오. |
" /review를 통해 마지막에 의문을 제기할게요" |
/review는 최종 관문입니다. 의문을 바탕으로 한 검토는 방향이 틀렸을 때, 수정 비용이 적게 드는 초기 단계에서 이를 포착해 줍니다. PR 단계가 되면 이미 너무 늦습니다. |
| "매 단계마다 의문을 품다가는 절대 출시할 수 없을 텐데" | 이 기법은 사소한 키 입력 하나하나가 아니라, 비사소한 결정에 적용되는 것입니다. “사용하지 말아야 할 때” 부분을 다시 읽어보세요. |
| "두 가지 의견이 하나보다 항상 낫다" | 두 번째 의견이 맥락을 제대로 파악하지 못해 잡음을 일으키는 경우에는 그렇지 않습니다. 결정을 미루지 말고 조율하십시오. |
| "검토자가 반대했으니 내가 틀렸다" | 검토자는 당신의 맥락을 알지 못합니다. 의견 차이는 정보가 될 수는 있어도 최종 판결은 아닙니다. 결과물을 다시 살펴보고, 분류한 다음 결정하십시오. |
| "크로스 모델이 항상 더 낫다" | 크로스 모델은 단일 모델이 자체적으로 공유하는 사각지대를 포착하지만, 비용과 도구의 취약성을 가중시킵니다. 상호작용이 이루어지는 모든 의문 단계에서 이를 제안하십시오 — 아티팩트가 이를 필요로 하는지 여부는 사용자가 결정합니다. 에이전트의 역할은 선택지를 제시하는 것이지, 이를 제한하는 것이 아닙니다. |
| "사용자가 한 번 '예'라고 했으니, 계속 CLI를 호출해도 된다" | 각 호출은 그 자체로 별도의 승인 절차입니다. 아티팩트, 프롬프트, 플래그는 호출마다 달라집니다. 실행하기 전에 매번 사용자에게 정확한 명령을 재확인하십시오. |
주의 사항
- 한 줄의 이름 변경이나 서식 변경을 위해 새로운 컨텍스트의 검토자를 생성하는 경우
- 아티팩트 텍스트를 다시 읽지 않고 검토자의 출력을 최종적인 결과로 간주하는 경우
- 사용자에게 문제를 상신하지 않고 3회 이상 반복 검토
- 검토자에게 “이거 괜찮나요?”라고 묻는 대신 “문제점을 찾아주세요”라고 요청하지 않음
- 중요한 결정을 내려야 하는 상황에서 시간 압박을 받아 의구심을 무시하는 경우
- 변경되지 않은 아티팩트에 대해 새로운 컨텍스트를 다시 생성하는 경우 (동일한 결과가 나올 것이며, 이는 시간을 끌기 위한 행동입니다)
- 의심 쇼(검증 가능한 신호): 검토자가 2회 이상의 검토 주기 동안 실질적인 발견 사항을 제시했음에도, 실행 가능한 발견 사항으로 분류된 것이 하나도 없는 경우. 이는 의심을 하는 것이 아니라 검증하고 있는 것입니다. 중단하고 상급자에게 보고하십시오.
- 커밋한 후에야 의문을 제기하는 것 — 이는
/review일뿐, 의문 주도형 개발이 아닙니다 - 도구가 존재하는지, 구성되어 있는지, 그리고 정확히 그 구문을 수용하는지 사용자와 확인하지 않고 외부 CLI 호출을 하드코딩하는 경우
- 대화형 의심 주기에서 크로스 모델을 아무런 알림 없이 건너뛰는 경우. 권장하지 않더라도 해당 옵션은 반드시 표시되어야 합니다. 건너뛰는 것은 괜찮지만, 아무런 알림 없이 건너뛰는 것은 안 됩니다.
- 외부 CLI에서 오류가 발생하거나 존재하지 않을 때 아무런 알림 없이 대체 처리하는 경우 — 오류를 표면화하고 사용자가 리디렉션할 수 있도록 해야 합니다
- 검토자의 입력에서 계약 조건을 제거하는 것
- CLAIM을 검토자에게 전달하는 것 (동의 쪽으로 편향됨)
다른 스킬과의 상호작용
code-review-and-quality//review: 상호 보완적./review는사후 PR 판정인 반면, doubt-driven은 진행 중인 의사결정 단계에서 이루어집니다. 둘 다 사용하십시오.source-driven-development: SDD는 공식 문서를 기준으로 프레임워크에 대한 사실을 검증합니다. Doubt-driven은 아티팩트에 대한 여러분의 추론을 검증합니다. SDD는 API가 존재하는지 확인하고, Doubt-driven은 계약 조건에 따라 API를 올바르게 사용했는지 확인합니다.테스트 주도 개발(TDD): TDD의 RED 단계는 ‘의심’을 구체화한 것으로, 테스트 실패는 반증 시도입니다. TDD가 적용될 때, 그 테스트 실패는 행동 주장에 대한 ‘의심’ 단계가 됩니다.디버깅 및 오류 복구: 검토자가 실제 오류 모드를 발견하면, 디버깅 기술을 활용하여 오류 위치를 특정하고 수정하십시오.- 리포지토리 오케스트레이션 규칙 (
references/orchestration-patterns.md): 이 기술은 메인 세션에서 오케스트레이션을 수행합니다. 한 페르소나가 다른 페르소나를 호출하는 것은 안티패턴 B에 해당합니다 — 위의 ‘로딩 제약 조건’을 참조하십시오.
검증
의심 기반 개발(doubt-driven development)을 적용한 후:
- (위의 정의에 따라) 모든 비사소한 결정은 확정되기 전에 명시적으로 ‘주장(CLAIM)’으로 명명되었습니다
- 사소한 것이 아닌 아티팩트 하나당 최소 한 번의 새로운 맥락 검토가 이루어졌다(‘다른 기술과의 상호작용’에 따라, TDD의 RED 단계에서 생성된 실패한 테스트는 행동 주장의 경우 이 요건을 충족한다)
- 검토자는 ‘아티팩트’와 ‘계약’을 받았으며, ‘클레임’이나 개발자의 추론은 받지 않았습니다
- 검토자의 지침은 '문제 찾기'와 같은 대립적(adversarial) 방식이었으며, '좋은가'와 같은 타당성 검증 방식이 아니었습니다
- 발견된 사항은 아티팩트 텍스트를 기준으로(무비판적으로 승인하지 않고) 다음 우선순위에 따라 분류되었습니다: 계약 오독 / 조치 필요 / 절충안 / 잡음
- 종료 조건이 충족되었습니다(사소한 발견 사항, 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
모든 파일
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
복사





집
