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/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-filesystem-testing-abstractions"><img src="https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-filesystem-testing-abstractions.svg" alt="Reviewed on agentmods" width="80" 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.00145 | $0.01639 |
| Opus 5.5 | $0.00058 | $0.00656 |
| Sonnet 5.5 | $0.00029 | $0.00328 |
| Haiku 4.5 | $0.00015 | $0.00164 |
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 2mo 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.
- 2mo ago Changed · -46 tokens per session 96d742fa8ad2
- 3mo 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 (30 stars, last pushed 1mo ago), licensed MIT. It adds 145 tokens to every session and 1,639 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.
dotnet-testing-filesystem-testing-abstractions compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| dotnet-testing-filesystem-testing-abstractionskevintsengtw/dotnet-testing-agent-skills | Skill | 30 | 1mo ago | MIT | A | 145 | Claude Code, Codex |
| author-testAzure/azure-sdk-for-net | Skill | 6.1k | today | MIT | A | 68 | Claude Code, Codex |
| migrate-xunit-to-xunit-v3managedcode/dotnet-skills | Skill | 527 | 16d ago | MIT | A | 149 | Claude Code, Codex |
| clean-architecture-dotnetSebastienDegodez/copilot-instructions | Skill | 199 | 24d ago | Apache-2.0 | A | 50 | Claude Code, Codex |
| creating-dotnet-mcp-serversSebastienDegodez/copilot-instructions | Skill | 199 | 24d ago | Apache-2.0 | A | 43 | Claude Code, Codex |
| csharp-xunitPracticalSwan/agent-skills | Skill | 25 | 15d ago | MIT | A | 25 | Codex |
| cratis-specifications-isolate-behaviorCratis/AI | Skill | 4 | today | MIT | A | 46 | Claude Code, Codex |