Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add kevintsengtw/dotnet-testing-agent-skills --skill dotnet-testing-test-data-builder-patterngit clone --depth 1 https://github.com/kevintsengtw/dotnet-testing-agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-test-data-builder-pattern)<a href="https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-test-data-builder-pattern"><img src="https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-test-data-builder-pattern/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-test-data-builder-pattern"><img src="https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-test-data-builder-pattern.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00145 | $0.01720 |
| Opus 5.5 | $0.00058 | $0.00688 |
| Sonnet 5.5 | $0.00029 | $0.00344 |
| Haiku 4.5 | $0.00015 | $0.00172 |
Grade A, and why
dotnet-testing-test-data-builder-pattern scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 22d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 125 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Test Data Builder Pattern 測試資料建構器模式
核心概念
什麼是 Test Data Builder Pattern?
Test Data Builder Pattern 是 Object Mother Pattern 的改良版,主要解決以下問題:
- 固定測試資料的問題:Object Mother 提供固定的測試物件,難以針對特定測試情境調整
- 測試意圖不明確:直接建立物件時,測試的關注點容易被大量屬性設定所掩蓋
- 重複程式碼:相似的物件建立邏輯在多個測試中重複出現
為何需要 Builder Pattern?
// ❌ 問題:過多參數設定,測試意圖不明確
var user = new User
{
Name = "John Doe", Email = "[email protected]", Age = 30,
Roles = new[] { "User" }, Settings = new UserSettings { Theme = "Dark", Language = "zh-TW" },
IsActive = true, CreatedAt = DateTime.Now, ModifiedAt = DateTime.Now
};
// ✅ 改善:意圖明確,只設定測試關注的屬性
var user = UserBuilder.AUser().WithName("John Doe").WithValidEmail().Build();
實作指南
基本 Builder 結構
一個標準的 Test Data Builder 應包含:
- 預設值:為所有必要屬性提供合理的預設值
- 流暢介面:使用
With*方法鏈來設定屬性 - 語意化方法:提供有意義的預設建立者(如
AnAdminUser()、ARegularUser()) - Build 方法:最終建立並回傳目標物件
涵蓋完整 UserBuilder 實作(預設值、With* 流暢方法、語意化靜態工廠方法、Build 方法)、單一測試情境與配合 Theory 使用的範例。
完整 Builder 實作與測試使用範例請參考 references/builder-implementation.md
最佳實踐
涵蓋五項實踐:提供合理的預設值、使用語意化命名(UserScenarios)、Builder 之間的組合(OrderBuilder 組合 UserBuilder + ProductBuilder)、避免過度複雜化、統一管理測試資料(TestData 靜態類別)。
完整最佳實踐與進階模式請參考 references/best-practices-and-patterns.md
與其他模式的比較
Test Data Builder vs. Object Mother
| 特性 | Test Data Builder | Object Mother |
|---|---|---|
| 彈性 | 高度彈性,可針對測試調整 | 固定的測試資料 |
| 可讀性 | 流暢介面,意圖明確 | 需要查看方法實作 |
| 維護性 | 集中管理,易於修改 | 變更影響所有測試 |
| 使用場景 | 單元測試、情境測試 | 簡單的整合測試 |
Test Data Builder vs. AutoFixture
| 特性 | Test Data Builder | AutoFixture |
|---|---|---|
| 控制度 | 完全控制物件建立 | 自動產生,控制度較低 |
| 設定複雜度 | 需手動建立 Builder | 幾乎零設定 |
| 測試意圖 | 非常明確 | 需額外說明 |
| 適用時機 | 需要精確控制的測試 | 大量資料產生、匿名測試 |
What ships with it
5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 22d ago Changed · -1 lines · -42 tokens per session 2ec09ab26342
- 1mo ago First seen · 126 lines · 187 tokens per session scan A 9353484a5c25
dotnet-testing-test-data-builder-pattern is a skill published in the GitHub repository kevintsengtw/dotnet-testing-agent-skills (30 stars, last pushed 18d ago), licensed MIT. It adds 145 tokens to every session and 1,720 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
author-test
Generate a test given sample. Parameters: C# SDK repository root; Package name: one of Azure.AI.Projects, Azure.AI.Projects.Agents or Azure.AI.Extensions.OpenAI; the sample to use as a starting point for the test.
migrate-xunit-to-xunit-v3
Migrate .NET test projects from xUnit.net v2 to xunit.v3 and fix v3 breaks. Use for package/CPM conversion, OutputType=Exe, preserving the VSTest or MTP runner (including projects currently using YTest.MTP.XUnit2), incompatible TFMs, async void tests, string-to-Type attributes, custom Fact/Theory/BeforeAfterTest…
csharp-xunit
Your goal is to help me write effective unit tests with XUnit, covering both standard and data-driven testing approaches.
migrate-nunit-to-mstest
Convert .NET tests from NUnit 3/4 to MSTest v4 while preserving VSTest or MTP. Use for replacing NUnit/NUnit3TestAdapter packages, Test/TestCase/ TestCaseSource/Values attributes, constraint assertions, SetUp/TearDown, OneTimeSetUp, SetUpFixture, FixtureLifeCycle, TestContext, categories, retries, timeouts, and NUnit…
csharp-tunit
Get best practices for TUnit unit testing, including data-driven tests.
csharp-nunit
Get best practices for NUnit unit testing, including data-driven tests.