Guide · Agent skill
How to use the TUnit Testing Best Practices agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The csharp-tunit skill is a written set of best practices that an AI agent reads before helping you write C# unit tests with TUnit, a testing framework for .NET. Once it is installed, the agent follows guidance on project setup, test structure, standard and data-driven tests, asynchronous fluent assertions and migrating existing xUnit tests. This guide walks you through what the skill does, how to install it, how to ask for it, and where it fits.
Quick start
- 1Download the ZIP. Download the csharp-tunit skill ZIP from this page and unzip it. The folder contains SKILL.md.
- 2Choose a location. Place the folder in ~/.claude/skills/ for all projects, or in a project's .claude/skills/ folder for one project.
- 3Or upload it in the apps. In the Claude apps, go to Settings → Capabilities → Skills and upload the ZIP.
- 4Prepare your test project. Make sure you have .NET SDK 8.0 or higher and the TUnit and TUnit.Assertions NuGet packages in a [ProjectName].Tests project.
- 5Ask for tests in plain language. Describe the class and behavior you want tested, mentioning TUnit or C# tests.
- 6Run the tests. Run dotnet test to check the generated tests and review them before committing.
What the skill makes the agent do
A skill is a set of instructions that an agent loads when a request matches it. This one is a guide, not a tool: it does not run anything on its own. The agent reads the SKILL.md file and then writes or reviews tests according to its rules.
The guidance covers how to lay out a separate test project named [ProjectName].Tests, how to name tests as MethodName_Scenario_ExpectedBehavior, and how to use the Arrange-Act-Assert pattern. It also covers which TUnit attributes to use for setup, teardown, data-driven tests, and parallel execution.
- Uses [Test] instead of xUnit's [Fact] and needs no test class attributes
- Uses [Arguments] for inline data and [MethodData] for method-based data
- Writes assertions as await Assert.That(value).IsEqualTo(expected) and similar
- Lists xUnit-to-TUnit replacements such as [Theory] to [Test] and IClassFixture<T> to [Before(Class)]
Install the csharp-tunit skill
Download the skill ZIP from this page and unzip it. The skill is a single file, SKILL.md. Put the unzipped folder in one of these locations, depending on whether you want the skill for all projects or just one:
For all your projects, place it in ~/.claude/skills/. For one project only, place it in that project's .claude/skills/ folder.
You can also upload the ZIP in the Claude apps under Settings → Capabilities → Skills.
- Personal: ~/.claude/skills/ (available everywhere)
- Project: .claude/skills/ inside your repository (shared with the team if committed)
- Claude apps: Settings → Capabilities → Skills, then upload the ZIP
Check what you need before you start
The skill assumes a .NET environment. You need the .NET SDK 8.0 or higher, plus the TUnit and TUnit.Assertions NuGet packages in your test project. The skill itself does not install these packages for you.
TUnit tests are run with the standard .NET command, so you should be comfortable running dotnet test.
- .NET SDK 8.0 or higher
- TUnit and TUnit.Assertions NuGet packages referenced in the test project
- Runs scripts: no. Uses network: no.
dotnet testTrigger the skill with natural requests
You do not need a special command. Describe the testing task in plain language that mentions TUnit or C# tests, and the agent can apply the skill. Being specific about your goal helps the agent choose the right pattern.
Good requests name the class under test, the behavior you want covered and, when relevant, that you are migrating from xUnit.
- "Write TUnit tests for my Calculator class, covering division by zero."
- "Convert these xUnit tests from [Fact] and [Theory] to TUnit."
- "Add a data-driven TUnit test for my date parser using [Arguments]."
- "Set up a new TUnit test project for my .NET 8 API."
Examples of what you get
For a data-driven test, the skill points the agent to [Arguments], which is the TUnit counterpart of xUnit's [InlineData]. Multiple [Arguments] attributes can sit on the same method, and [MethodData] handles data supplied by a method. Assertions are awaited, so a typical check reads as await Assert.That(result).IsEqualTo(expected).
When migrating, the agent replaces Assert.Equal with await Assert.That(actual).IsEqualTo(expected), replaces constructor and IDisposable setup with [Before(Test)] and [After(Test)], and replaces IClassFixture<T> with [Before(Class)] and [After(Class)].
Note that the source does not include a complete code sample for a full test class, so review what the agent writes against the TUnit documentation for your installed version.
Safety notes
The skill is plain text guidance. It runs no scripts and makes no network requests. Its effect comes from the instructions it gives the agent, so the code the agent writes still needs your review, just as with any generated code.
Because the skill recommends parallel execution by default, check that your tests do not share mutable state or external resources. The guidance says to use [NotInParallel] or [ParallelLimit<T>] where needed.
- No scripts are included in the skill
- No network access is used by the skill
- Review generated tests and run dotnet test before relying on them
Tips for better results
Keep each request to one class or one behavior, since the skill asks for focused tests with a single behavior each. Ask the agent to make tests independent, because the guidance says tests should run in any order and avoid [DependsOn] unless needed.
If your suite is on xUnit, ask for a migration in small steps so you can run dotnet test after each file.
- Name the class under test so the agent can follow the CalculatorTests-for-Calculator convention
- Ask for [Repeat(n)] or [Retry(n)] only when you have a specific reason
- Use [Category] and [DisplayName] to organise tests in larger suites
What people use it for
- Starting a new TUnit test project for a .NET 8 service with a consistent layout
- Converting an existing xUnit suite that uses [Fact], [Theory] and [InlineData] to TUnit
- Writing data-driven tests with [Arguments] or [MethodData] for input validation
- Adding fluent assertions such as IsEqualTo, Contains and Throws to existing tests
Frequently asked questions
Is the TUnit Testing Best Practices skill free?
The skill is published under the MIT licence in the github/awesome-copilot repository. The source does not state any price, so check the licence text there for the terms.
What do I need to use the csharp-tunit skill?
You need the .NET SDK 8.0 or higher and the TUnit and TUnit.Assertions NuGet packages. The skill is a guide the agent reads and does not install these packages itself.
Where do I put the csharp-tunit skill?
Place the unzipped folder in ~/.claude/skills/ to use it everywhere, or in a project's .claude/skills/ folder to use it for one project. You can also upload the ZIP under Settings → Capabilities → Skills in the Claude apps.
Does the skill run tests or scripts for me?
No. The skill includes only SKILL.md, runs no scripts and uses no network. It shapes how the agent writes tests, and you still run them yourself with dotnet test.
Can I use this skill if I still use xUnit?
The guidance is specific to TUnit, so there is little reason to use it if you plan to stay on xUnit, NUnit or MSTest. It is most useful if you are starting TUnit or migrating from xUnit.
Does it work for projects that are not in C#?
No. The content only covers the .NET ecosystem and C# unit tests written with TUnit.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
This skill suits C# developers on .NET 8 or later who are starting a TUnit project or moving tests from xUnit, especially if they want help with data-driven tests. It is a plain guide that changes how the agent writes tests, so it does nothing if you do not use TUnit. If your team is staying on xUnit, NUnit or MSTest, or works outside .NET, choose a different approach.
Download the skill