tdd
以紅燈-綠燈-重構引導 TDD
當團隊測試內部實作或一開始就撰寫過多測試時,測試優先的工作方式常會變得脆弱。此技能會引導 Codex、Claude 和 Claude Code 進行以行為為核心的紅燈-綠燈-重構循環。
使用我的智慧代理安裝
將此請求複製給你的智慧代理,其中包含權威 Skill 頁面和清單。
Review the Skillstore skill "tdd" from https://skillstore.io/skills/mattpocock-tdd.md and its manifest at https://skillstore.io/api/skills/mattpocock-tdd/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.你的智慧代理仍應顯示其計畫,並依安全政策請求必要確認。
Agent 可讀資源
當 AI Agent、爬蟲或腳本需要乾淨脈絡、而不是讀取完整頁面時,請使用這些連結。
測試它
正在使用「tdd」。 我需要使用 TDD 新增結帳折扣。
預期結果:
- 公開結帳行為和測試介面的簡短計畫。
- 針對有效折扣情境的一個失敗行為測試。
- 一個最小實作步驟,接著是重構檢查清單。
正在使用「tdd」。 每當我重新命名內部服務時,測試就會失敗。
預期結果:
- 對實作細節斷言和內部 mock 的診斷。
- 驗證可觀察行為的替代測試描述。
- 僅圍繞外部系統使用 mock 的邊界建議。
正在使用「tdd」。 在我撰寫測試前,請檢視這個模組。
預期結果:
- 聚焦於依賴注入和回傳值的介面設計回饋。
- 建議在第一輪 TDD 循環中優先處理的行為。
- 應保留在初始測試範圍之外的風險。
安全審計
安全All static findings are false positives caused by markdown examples, code fences, or ordinary TDD prose. The skill contains guidance for behavior-focused testing and no executable scripts, prompt injection attempts, secret access, or network activity by the skill itself.
風險因素
分享與引用此報告
分享版本化評估報告、中性徽章、嵌入卡片與引用。Skillstore 只報告證據,不判斷該 Skill 是否安全。
複製報告連結
https://skillstore.io/skills/mattpocock-tdd/audits/4?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/mattpocock-tdd?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/mattpocock-tdd?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/mattpocock-tdd/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/mattpocock-tdd.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>學術引用 (APA · BibTeX · CFF)
APA 引用
mattpocock. (2026). tdd security audit report (audit version 4) [Author version unspecified]. Skillstore. https://skillstore.io/skills/mattpocock-tdd/audits/4BibTeX 引用
@techreport{mattpocock-mattpocock-tdd-2026,
author = {mattpocock},
title = {tdd security audit report (audit version 4)},
institution = {Skillstore},
year = {2026},
number = {4},
url = {https://skillstore.io/skills/mattpocock-tdd/audits/4},
note = {Author version unspecified}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "tdd security audit report (audit version 4)"
version: "unspecified"
type: report
authors:
- name: "mattpocock"
date-released: "2026-07-06"
url: "https://skillstore.io/skills/mattpocock-tdd/audits/4"
identifiers:
- type: other
value: "skillstore:mattpocock-tdd:audit:4"
description: "Skillstore immutable audit report identifier"
比較變體
3 個可安裝變體每位作者的技能都保留為獨立的可安裝項目。推薦變體依 Skillstore 證據排序。
為何此變體排名第一
Skillstore 評分
評分依據 證據置信度: 高你可以打造什麼
以測試優先建構功能
使用此技能來定義一個公開行為、撰寫失敗測試、實作最少程式碼,然後重複。
修復脆弱測試
使用此指引,透過公開介面將內部 mock 和私有方法斷言替換為以行為為核心的測試。
編碼前檢視可測試性
使用介面設計檢查清單來減少副作用、注入依賴項,並建立更簡單的邊界以利可靠測試。
試試這些提示
使用 tdd 技能。請在撰寫實作程式碼之前,協助我規劃公開介面和第一個要測試的行為。
使用 tdd 技能。請根據此需求,使用現有測試框架和公開 API,撰寫一個以行為為核心的失敗測試。
使用 tdd 技能。測試已通過。請找出安全的重構候選項目,並一次套用一個小型重構。
使用 tdd 技能。請稽核這些脆弱測試,找出實作耦合,並提出邊界更好的行為導向替代方案。
最佳實務
- 撰寫測試前,先確認公開介面和最高價值的行為。
- 撰寫一個失敗測試,只實作足以通過的程式碼,然後重複。
- 只 mock 真正的系統邊界,並讓測試聚焦於可觀察行為。
避免
- 在實作第一個行為之前,就撰寫每個計畫中的測試。
- mock 內部協作者,或斷言私有實作細節。
- 在測試仍失敗時進行重構。
常見問題
此技能能協助什麼?
此技能會執行測試嗎?
它偏好哪種測試?
我應該何時 mock 依賴項?
它能協助重構現有程式碼嗎?
它對 bug 修復有用嗎?
開發者詳細資訊
作者
mattpocock授權
MIT
Skillstore 修訂
r1
版本提示
作者未聲明版本。
引用
b8ca75d2c0a7e7102978993058777d82b8ab2610
維護新鮮度
2026/7/18
使用量
5 次下載 · 95 次瀏覽
檔案結構