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-filesystem-testing-abstractionsgit 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-filesystem-testing-abstractions)<a href="https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-filesystem-testing-abstractions"><img src="https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-filesystem-testing-abstractions.svg" alt="Measured on agentmods" height="20"></a>- NVIDIA SkillSpector warn
SkillSpector: 1 finding, up to high
These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →
- high Prompt Injection · line 30 Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.Fix: Audit all comments and invisible characters. Remove any instructions that direct the agent to perform unauthorized actions. Use plain, reviewable content.
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.00191 | $0.01597 |
| Opus 5 | $0.00096 | $0.00798 |
| Sonnet 5 | $0.00038 | $0.00319 |
| Haiku 4.5 | $0.00019 | $0.00160 |
Grade A, and why
dotnet-testing-filesystem-testing-abstractions 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 8d 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 — 134 lines — stays where its author put it; the contents beside it link to each section on GitHub.
檔案系統測試:使用 System.IO.Abstractions 模擬檔案操作
核心原則
1. 檔案系統相依性的根本問題
傳統直接使用 System.IO 靜態類別的程式碼難以測試,原因包括:
- 速度問題:實際磁碟 IO 比記憶體操作慢 10-100 倍
- 環境相依:測試結果受檔案系統狀態、權限、路徑影響
- 副作用:測試會在磁碟上留下痕跡,影響其他測試
- 並行問題:多個測試同時操作同一檔案會產生競爭條件
- 錯誤模擬困難:難以模擬權限不足、磁碟空間不足等異常
2. System.IO.Abstractions 解決方案
將 System.IO 靜態類別包裝成介面的套件,支援依賴注入和測試替身。
必要 NuGet 套件:
<!-- 正式環境 -->
<PackageReference Include="System.IO.Abstractions" Version="22.1.0" />
<!-- 測試專案 -->
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="22.1.0" />
3. 重構步驟
步驟一:將直接使用靜態類別的程式碼改為依賴 IFileSystem
// ❌ 重構前(不可測試)
public class ConfigService
{
public string LoadConfig(string path) => File.ReadAllText(path);
}
// ✅ 重構後(可測試)
public class ConfigService
{
private readonly IFileSystem _fileSystem;
public ConfigService(IFileSystem fileSystem) => _fileSystem = fileSystem;
public string LoadConfig(string path) => _fileSystem.File.ReadAllText(path);
}
步驟二:在 DI 容器中註冊真實實作
services.AddSingleton<IFileSystem, FileSystem>();
步驟三:在測試中使用 MockFileSystem
var mockFs = new MockFileSystem(new Dictionary<string, MockFileData>
{
["config.json"] = new MockFileData("{ \"key\": \"value\" }")
});
var service = new ConfigService(mockFs);
MockFileSystem 測試模式
涵蓋四種核心測試模式:預設檔案狀態建立、驗證寫入結果、目錄操作測試、使用 NSubstitute 模擬 IO 異常(UnauthorizedAccessException 等)。另含進階技巧:串流操作測試、檔案資訊查詢測試、備份檔案測試。
完整 MockFileSystem 測試模式與進階技巧請參考 references/mockfilesystem-patterns.md
最佳實踐
應該這樣做
- 使用 Path.Combine 處理路徑 —
_fileSystem.Path.Combine("configs", "app.json") - 防禦性檢查檔案存在性 — 在讀取前先檢查
_fileSystem.File.Exists() - 自動建立必要目錄 — 寫入前確保目錄存在
- 妥善處理各種 IO 異常 — UnauthorizedAccessException、IOException、DirectoryNotFoundException
- 每個測試使用獨立的 MockFileSystem — 確保測試隔離
應該避免
- 硬編碼路徑分隔符號 — 使用
Path.Combine取代\\或/ - 在單元測試中使用真實檔案系統 — 使用 MockFileSystem
- 忽略例外處理 — 不要假設檔案一定存在
What ships with it
4 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.
- 8d ago First seen · 134 lines · 191 tokens per session scan A a2f8240cdfd6
dotnet-testing-filesystem-testing-abstractions is a skill published in the GitHub repository kevintsengtw/dotnet-testing-agent-skills (28 stars, last pushed 23d ago), licensed MIT. It adds 191 tokens to every session and 1,597 once invoked, about $0.0010 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
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.
cratis-specs-csharp
Step-by-step guidance for writing C# specs in Cratis with BDD Specification by Example — the Establish/Because/should pattern, for/when/and folder hierarchy, reusable given/ contexts, NSubstitute mocking, and the in-process scenario family. Use when writing C# unit or integration specs or structuring the for/when/and…
.NET Patterns
Use this skill when working in .NET projects (C#) and you want clean layering, safe async usage, and maintainable dependency injection patterns.
csharp-tunit
Get best practices for TUnit unit testing, including data-driven tests.