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 agentmods add skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-fluentvalidation-testingnpx skills add kevintsengtw/dotnet-testing-agent-skills --skill dotnet-testing-fluentvalidation-testinggit 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-fluentvalidation-testing)<a href="https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-fluentvalidation-testing"><img src="https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-fluentvalidation-testing.svg" alt="Measured on agentmods" height="20"></a>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.00183 | $0.03145 |
| Opus 5 | $0.00092 | $0.01572 |
| Sonnet 5 | $0.00037 | $0.00629 |
| Haiku 4.5 | $0.00018 | $0.00314 |
Grade A, and why
dotnet-testing-fluentvalidation-testing 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 6d 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 — 293 lines — stays where its author put it; the contents beside it link to each section on GitHub.
FluentValidation 驗證器測試指南
為什麼要測試驗證器?
驗證器是應用程式的第一道防線,測試驗證器能:
- 確保資料完整性 - 防止無效資料進入系統
- 業務規則文件化 - 測試即活文件,清楚展示業務規則
- 安全性保障 - 防止惡意或不當資料輸入
- 重構安全網 - 業務規則變更時提供保障
- 跨欄位邏輯驗證 - 確保複雜邏輯正確運作
前置需求
套件安裝
<PackageReference Include="FluentValidation" Version="12.1.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" Version="10.4.0" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="AwesomeAssertions" Version="9.4.0" />
注意:
FluentValidation.TestHelper命名空間(TestValidate、ShouldHaveValidationErrorFor等 API)已包含在FluentValidation主套件中,不需要額外安裝獨立套件。只需using FluentValidation.TestHelper;即可使用。
FluentValidation 12.x 注意事項:FluentValidation 12.0 為主要版本升級,最低需求為 .NET 8。已移除的 API 包括
Transform/TransformForEach(改用Must+ 手動轉換)、InjectValidator(改用建構子注入 +SetValidator)、CascadeMode.StopOnFirstFailure(改用RuleLevelCascadeMode = CascadeMode.Stop)。ShouldHaveAnyValidationError已更名為ShouldHaveValidationErrors。完整遷移指南請參閱 FluentValidation 12.0 Upgrade Guide。
基本 using 指令
using FluentValidation;
using FluentValidation.TestHelper;
using Microsoft.Extensions.Time.Testing;
using NSubstitute;
using Xunit;
using AwesomeAssertions;
核心測試模式
本節涵蓋 7 種核心測試模式,每種模式包含驗證器定義與完整測試範例。
完整程式碼範例請參考 references/core-test-patterns.md
- 模式 1:基本欄位驗證 — 使用
TestValidate+ShouldHaveValidationErrorFor/ShouldNotHaveValidationErrorFor測試單一欄位規則 - 模式 2:參數化測試 — 使用
[Theory]+[InlineData]測試多種無效/有效輸入組合 - 模式 3:跨欄位驗證 — 密碼確認、自訂
Must()規則等多欄位關聯驗證 - 模式 4:時間相依驗證 — 注入
TimeProvider,搭配FakeTimeProvider控制時間進行測試 - 模式 5:條件式驗證 — 使用
.When()的可選欄位驗證,測試條件觸發與跳過情境 - 模式 6:非同步驗證 —
MustAsync+TestValidateAsync,搭配 NSubstitute Mock 外部服務 - 模式 7:集合驗證 — 驗證集合非空與元素有效性
快速範例:基本欄位驗證
public class UserValidatorTests
{
private readonly UserValidator _validator = new();
[Fact]
public void Validate_空白使用者名稱_應該驗證失敗()
{
var result = _validator.TestValidate(
new UserRegistrationRequest { Username = "" });
result.ShouldHaveValidationErrorFor(x => x.Username)
.WithErrorMessage("使用者名稱不可為 null 或空白");
}
}
What ships with it
3 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.
- 6d ago First seen · 293 lines · 183 tokens per session scan A fa4457a4fb9b
dotnet-testing-fluentvalidation-testing is a skill published in the GitHub repository kevintsengtw/dotnet-testing-agent-skills (28 stars, last pushed 21d ago), licensed MIT. It adds 183 tokens to every session and 3,145 once invoked, about $0.0009 per session on Opus 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
clean-architecture-dotnet
Use when domain logic leaks into API/Infrastructure, project references violate layer boundaries, or you need to decide between CQS (always), CQRS bus (complex domains), and DDD patterns (invariants and events).
creating-dotnet-mcp-servers
Use when building Model Context Protocol (MCP) servers in .NET, configuring tools, transports (SSE/stdio), JSON serialization for AOT, or testing MCP endpoints.
dpg-migration
Migration logic for Azure SDK for .NET data-plane libraries migrating from AutoRest/Swagger to TypeSpec-based generation. Uses MCP tools from the generator-agent server for automated deterministic fixes.
mitigate-breaking-changes
Patterns and techniques for mitigating breaking changes in Azure management-plane SDKs. Covers SDK-side customizations (partial classes, CodeGenType, CodeGenSuppress) and TypeSpec decorator customizations (clientName, access, markAsPageable, alternateType, hierarchyBuilding).
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.
nunit-code-style
Use when writing or modifying C# method bodies, type declarations, or non-trivial logic in NUnit source. Covers NUnit's taste-and-judgment conventions — exception construction, simplification, naming intent, StringComparison, non-null check form, and var usage — that aren't already caught at build time.