agentsclimarketplace

Tdd lite

Skill fripig/superpower-lite/skills/tdd-lite

Use when adding behaviour or fixing a bug that needs test coverage — the red-gate discipline (watch the test fail first) without the full TDD ceremonyFrom its SKILL.md

Install
npx -y skills add fripig/superpower-lite --skill tdd-lite

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

1.6 KB, as published. Nobody here has run it

TDD Lite

核心只有一條:沒看過測試失敗,就不知道它測到對的東西。其餘的 TDD 儀式(每步都 commit、逐行照表操課)視情況省略。

流程

  1. RED — 先寫測試,跑它,確認它失敗,而且失敗訊息是預期的原因(不是 typo、不是缺 import、不是環境沒設好)。
  2. GREEN — 寫最小實作讓它過。跑測試確認過。
  3. REFACTOR — 需要才做。重構後測試要再綠一次。

修 bug 時 RED 尤其重要:測試必須先重現該 bug 的症狀。重現不出來代表你還沒搞懂問題,回去 debug-root-cause。

什麼時候可以跳過 RED

  • 純重構(行為不變,既有測試就是護欄)
  • 設定檔、文件、格式化
  • 探索性 spike(但 spike 的產物不進 main,要重寫)

其他情況跳過 RED 前先講一聲原因,不要默默跳。

好測試的判準

  • 測行為,不測實作:測試不該知道被測物內部怎麼寫的,否則重構一定壞。
  • 一個測試一件事:失敗訊息要能直接指出壞在哪。
  • 不要 assert 空氣:assertTrue(true)、只檢查「有沒有拋例外」而不檢查結果、mock 到只在驗證 mock 自己——這些是假覆蓋。
  • 外部服務 mock 掉,但別把被測邏輯也 mock 掉。

測試改不綠時

同一個測試修 3 次仍不綠就停下來,改用 debug-root-cause,不要繼續猜著改。

Keep looking

Skills are one crate of 626,194. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.