Community程式設計與開發github.com

完成前驗證

在聲稱工作完成、已修復或測試通過之前,必須執行驗證指令並確認輸出結果,始終堅持「先有證據,再下結論」。

完成前驗證 是什麼?

這是一個強制性的工作流程技能,要求開發者或 AI 代理在聲明任何完成狀態(如「測試通過」、「問題已修復」、「建置成功」)之前,必須先執行完整的驗證命令並檢視輸出結果。它適用於 Claude Code、Cursor、Codex 等支援技能文件的平台,並基於「先有證據,再下結論」的核心原則。該技能定義了一個嚴格的閘門函數:識別證明聲明所需的命令、完整執行該命令、讀取輸出與錯誤碼、確認輸出是否確實支持聲明,最後才能做出有證據的陳述。技能還提供了常見失敗案例的對照表(如僅依賴先前測試結果或「應該會過」的推測)、防止自我合理化的機制(如「我很累」、「只此一次」等藉口),以及紅旗警告(如使用「可能」、「應該」等不確定詞彙或過早表達滿意)。對於測試驅動開發(TDD)的紅綠循環、建置驗證、需求清單檢查和代理委派等場景,它都有明確的驗證模式。總之,這項技能防止開發者或 AI 在缺乏新鮮證據的情況下做出誤導性的聲明,確保所有工作宣言都有可重現的實際輸出作為支撐。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/obra/superpowers/tree/main/skills/verification-before-completion

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

完成前驗證 是做什麼的?

概述

核心原則: 先有證據,再下結論,始終如此。

違反規則的字面意義,就是違反規則的精神。

鐵律

無新鮮驗證證據,不得聲稱完成

如果你還沒有在這則訊息中執行過驗證指令,你就不能說它通過了。

閘門函數

在聲稱任何狀態或表達滿意之前:

1. 識別:什麼指令能證明這個聲明?
2. 執行:完整執行該指令(全新、完整)
3. 讀取:完整輸出,檢查退出碼,統計失敗數
4. 驗證:輸出是否支持聲明?
   - 若否:陳述實際狀態並附上證據
   - 若是:做出聲明時附上證據
5. 然後才能:做出聲明

跳過任何一步 = 說謊,而非驗證

常見失敗

聲明需要不足之處
測試通過測試指令輸出:0 個失敗上次的執行結果、「應該會過」
Lint 乾淨Lint 輸出:0 個錯誤部分檢查、推測
建置成功建置指令:退出碼 0Lint 通過、日誌看起來正常
錯誤已修復測試原始症狀:通過程式碼已改動、假設已修復
回歸測試可用紅綠循環已驗證測試通過一次
代理已完成VCS 差異顯示變更代理報告「成功」
需求已滿足逐行檢查清單測試通過

紅旗警告 - 立即停止

  • 使用「可能」、「大概」、「看起來」
  • 在驗證之前表達滿意(「太好了!」、「完美!」、「完成!」等)
  • 即將提交/推送/建立 PR 而未驗證
  • 相信代理的成功報告
  • 依賴部分驗證
  • 想著「就這一次」
  • 累了,想趕快結束工作
  • 任何暗示成功卻未執行驗證的措辭

合理化預防

藉口現實
「現在應該可以了」執行驗證
「我很確定」確信 ≠ 證據
「就這一次」沒有例外
「Lint 通過了」Lint ≠ 編譯器
「代理說成功了」獨立驗證
「我很累」疲勞 ≠ 藉口
「部分檢查就夠了」部分證明不了任何事
「換個說法規則就不適用了」精神重於字面

關鍵模式

測試:

✅ [執行測試指令] [看到:34/34 通過] "所有測試通過"
❌ "現在應該會過了" / "看起來正確"

回歸測試(TDD 紅綠循環):

✅ 撰寫 → 執行(通過) → 還原修復 → 執行(必須失敗) → 恢復 → 執行(通過)
❌ "我已經寫了一個回歸測試"(沒有紅綠驗證)

建置:

✅ [執行建置] [看到:退出碼 0] "建置通過"
❌ "Lint 通過了"(lint 不檢查編譯)

需求:

✅ 重新閱讀計畫 → 建立檢查清單 → 逐項驗證 → 報告缺口或完成
❌ "測試通過,階段完成"

代理委派:

✅ 代理報告成功 → 檢查 VCS 差異 → 驗證變更 → 報告實際狀態
❌ 相信代理報告

何時應用

總是在以下情況之前:

  • 任何形式的成功/完成聲明
  • 任何表達滿意的語句
  • 任何關於工作狀態的正面陳述
  • 提交、建立 PR、任務完成
  • 前往下一個任務
  • 委派給代理

規則適用於:

  • 確切的措辭
  • 改寫與同義詞
  • 暗示成功
  • 任何暗示完成/正確的溝通

Individual skills in this repo

This repo contains 14 individual skills — each has its own dedicated page.

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).

diagnosing-superpowers

Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

dispatching-parallel-agents

Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies

executing-plans

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

finishing-a-development-branch

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work

receiving-code-review

Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation

requesting-code-review

Use when completing tasks, implementing major features, or before merging to verify work meets requirements

subagent-driven-development

Use when executing implementation plans with independent tasks in the current session

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

test-driven-development

Use when implementing any feature or bugfix, before writing implementation code

using-git-worktrees

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback

using-superpowers

Use when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions

writing-plans

Use when you have a spec or requirements for a multi-step task, before touching code

writing-skills

Use when creating new skills, editing existing skills, or verifying skills work before deployment

相關技能