dotnet-xunit — Claude Code skill for xUnit v3 tests
A skill for writing xUnit v3 tests in .NET: attributes, fixtures, parallel runs, IAsyncLifetime.
npx skills add wshaddix/dotnet-skills --skill dotnet-xunit -a claude-codeWhat dotnet-xunit does
The skill covers how to write xUnit v3 tests: [Fact] and [Theory] attributes, IClassFixture and ICollectionFixture fixtures, parallel execution settings, IAsyncLifetime for async setup and teardown, custom assertions and xUnit analyzers. A comparison table lays out what changed from v2: the xunit.v3 package replaces xunit, IAsyncLifetime now returns ValueTask, [ClassData] takes strongly typed TheoryDataRow<T> rows, and the optional message string on Assert methods is gone.
It targets .NET 8.0 and up. Your test project has to exist already with xUnit packages referenced — scaffolding belongs to dotnet-add-testing. Moving a project off xUnit v2 hits three spots: the IAsyncLifetime return type, the [ClassData] row format, and the removed Assert messages. Worth checking before you migrate.
Testing strategy and integration tests with WebApplicationFactory or Testcontainers are out of scope; separate skills handle those.
What it helps with
- write a parameterized test with
[Theory]and[InlineData] - share a database connection across tests via
IClassFixture - switch
IAsyncLifetimefromTasktoValueTaskduring a v3 migration - configure parallel test execution per collection
- replace an Assert message string with a custom assertion
Example prompts for the agent
- Write xUnit v3 tests for DiscountCalculator: a
[Fact]for the exception case and a[Theory]with[InlineData] - Show me how to put the database connection in an
IClassFixturewithIAsyncLifetime - What changes in my tests when I move from xUnit v2 to
xunit.v3?
How to install dotnet-xunit
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-xunit -a claude-code2Manually: put the files in place
~/.claude/skills/dotnet-xunit/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/dotnet-xunit/
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-xunit -a codex2Manually: put the files in place
.agents/skills/dotnet-xunit/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-xunit -a cursor2Manually: put the files in place
.cursor/skills/dotnet-xunit/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install wshaddix/dotnet-skills dotnet-xunit2Manually: put the files in place
.github/skills/dotnet-xunit/SKILL.md1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-xunit -a gemini-cli2Platform CLI
gemini skills install https://github.com/wshaddix/dotnet-skills --path skills/dotnet-xunitManually: put the files in place
.devin/skills/dotnet-xunit/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-xunit -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about dotnet-xunit
How do I install dotnet-xunit in Claude?
Run npx skills add wshaddix/dotnet-skills --skill dotnet-xunit -a claude-code. The skill lands in ~/.claude/skills/dotnet-xunit/SKILL.md.
What does dotnet-xunit do?
It guides the agent through xUnit v3 tests: [Fact] and [Theory] attributes, fixtures, parallel execution, IAsyncLifetime, custom assertions. It also spells out the v2 differences.
What do I need before using it?
A test project with xUnit packages referenced and a .NET 8.0 baseline. The skill does not scaffold projects or add package references.