csharp-xunit

csharp-xunit is a skill for Claude Code, Codex from PracticalSwan/agent-skills. It costs 25 tokens per session (1,473 once invoked), scanned A, original, MIT.

A guide for writing unit tests in C# with xUnit, a testing framework for .NET applications. It covers regular tests and data-driven tests that run the same checks against multiple inputs.

In plain words
What is it for?
It is for designing test cases, naming tests, organizing setup, checking failure paths, and verifying changes with builds, linting, or test runs.
Why use it?
It helps tests describe expected behavior clearly and cover errors, edge cases, and dependency or environment changes instead of only successful cases.

Skill for Claude CodeCodex

Install

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.

agentmods
npx agentmods add skills/practicalswan/agent-skills/csharp-xunit
Any agent
npx skills add PracticalSwan/agent-skills --skill csharp-xunit
Clone the repo
git clone --depth 1 https://github.com/PracticalSwan/agent-skills

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for csharp-xunit

README.md
[![agentmods](https://agentmods.dev/badge/skills/practicalswan/agent-skills/csharp-xunit.svg)](https://agentmods.dev/skills/practicalswan/agent-skills/csharp-xunit)
Your own site
<a href="https://agentmods.dev/skills/practicalswan/agent-skills/csharp-xunit"><img src="https://agentmods.dev/badge/skills/practicalswan/agent-skills/csharp-xunit.svg" alt="Measured on agentmods" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,473 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00025 $0.01473
Opus 5 $0.00013 $0.00737
Sonnet 5 $0.00005 $0.00295
Haiku 4.5 $0.00003 $0.00147

Measured today against content hash 185cdd3b7637, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

csharp-xunit 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 today.

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.

csharp-xunit/SKILL.md · 158 lines

How it starts

The opening of the file, as written. The whole thing — 158 lines — stays where its author put it; the contents beside it link to each section on GitHub.

XUnit Best Practices

Optimized for current .NET SDK releases, C# 12+, xUnit 2.x, and FluentAssertions 6+.

Your goal is to help me write effective unit tests with XUnit, covering both standard and data-driven testing approaches.

  • Leverage native parallel subagent dispatch and 200k+ context windows where available.

Anti-Patterns

  • Treating fixtures as hidden setup: Readers lose sight of the behavior under test when too much state is shared implicitly.
  • Asserting only the happy path: Unit tests miss the contract if failure and edge cases are not explicit.
  • Using vague test names: A failing test should explain the broken behavior before anyone opens the body.

Verification Protocol

Before claiming "skill applied successfully":

  1. Pass/fail: The Csharp Xunit implementation names the target runtime, framework version, and affected files.
  2. Pass/fail: Build, lint, test, or equivalent local validation is run for the changed surface.
  3. Pass/fail: Edge cases for errors, dependency drift, and environment differences are addressed or explicitly out of scope.
  4. Pressure-test scenario: Apply the workflow to a change that passes happy-path tests but fails one boundary condition.
  5. Success metric: Zero untested success claims; every implementation claim maps to a command or artifact.

Before and After Example

// Before
[Fact]
public async Task SavesOrder()
{
    var id = await service.SaveAsync(order);
    Assert.True(id > 0);
}

// After
[Fact]
public async Task SaveAsync_WhenOrderIsValid_PersistsAndReturnsId()
{
    // Arrange
    var order = new Order("ORD-42", 3);

    // Act
    var id = await service.SaveAsync(order);

    // Assert
    id.Should().BeGreaterThan(0);
}

Moves from a vague assertion to an explicit Arrange-Act-Assert flow with a descriptive name.

Project Setup

  • Use a separate test project with naming convention [ProjectName].Tests
  • Reference Microsoft.NET.Test.Sdk, xunit, and xunit.runner.visualstudio packages
  • Create test classes that match the classes being tested (e.g., CalculatorTests for Calculator)
  • Use .NET SDK test commands: dotnet test for running tests

Read the full file on GitHub · 158 lines

Files

What ships with it

1 file 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.

Changes

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.

  1. today Changed 185cdd3b7637
  2. 4d ago First seen · 158 lines · 25 tokens per session scan A 0acf48b54504

Subscribe to this mod's changes

csharp-xunit is a skill published in the GitHub repository PracticalSwan/agent-skills (13 stars, last pushed 3d ago), licensed MIT. It adds 25 tokens to every session and 1,473 once invoked, about $0.0001 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.

Related

Other skills, from other repositories

test-driven-development

TDD: enforce RED-GREEN-REFACTOR, tests before code.

mateaix/mateclaw · 20 tokens

plugin-quality

审查和改进 Zhin.js 插件质量(Plugin Runtime)。Use when asked to review plugin code, audit structure, or improve before publishing. 检查 definePlugin、约定目录、发送链与安全。.

zhinjs/zhin · 49 tokens

plugin-test

为 Zhin.js 插件编写和运行测试(Plugin Runtime)。Use when asked to write tests, add test coverage, or verify defineCommand / definePlugin behavior. 引导编写符合 Runtime 的 Vitest 测试。.

zhinjs/zhin · 51 tokens

qa-bug-root-cause-analysis

当某个 Bug 频繁复现、线上有缺陷需要做事后分析、或者发现同一类问题反复出现需要根治时使用此技能。从症状出发用 5Why、因果图和鱼骨图等方法系统化定位缺陷根源,区分直接原因、间接原因和系统原因。不要只修症状——根因分析的价值在于找到让同类 Bug 不再发生的系统性改进措施,同时分析漏测原因来优化测试设计。 ⚠️ 本技能示例可能调用外部日志/监控工具,请在受控环境执行。.

Kokxi/qa-test-skills · 143 tokens

qa-bug-lifecycle

Skill "qa-bug-lifecycle" from Kokxi/qa-test-skills, covering 缺陷生命周期管理, 核心原则, 缺陷生命周期, 状态流转 and 状态定义.

Kokxi/qa-test-skills · 105 tokens

qa-bug-reporting

当发现了一个 Bug 需要提交、自己提的 Bug 被开发打回来了、或者团队 Bug 质量参差不齐需要统一规范时使用此技能。一个高质量的 Bug 报告应该让开发看一遍就能复现并定位,不需要来回追问。包含清晰的复现步骤(从环境准备到操作序列到预期/实际结果)、根因推测、影响范围评估和必要附件。 ⚠️ 本技能示例可能调用外部抓包/日志工具,请在受控环境执行。.

Kokxi/qa-test-skills · 127 tokens