Guide · Agent skill
How to use the NUnit Testing Best Practices agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The csharp-nunit skill is a set of written guidelines that tells an AI agent how to write unit tests for C# code with the NUnit framework. Once it is installed, the agent follows conventions for project setup, test naming, arrange-act-assert structure, assertions, data-driven attributes and mocking when it writes or reviews test code. This guide covers what the skill changes, how to install it, how to ask for tests in a way that triggers it, and what it needs to run.
Quick start
- 1Download the ZIP. Download the csharp-nunit skill ZIP from this page.
- 2Unzip the skill folder. Unzip the file so the folder contains SKILL.md.
- 3Place the folder. Move it into ~/.claude/skills/ for personal use, or into your project's .claude/skills/ folder.
- 4Or upload it in the Claude apps. Go to Settings → Capabilities → Skills and upload the skill.
- 5Check your .NET setup. Make sure the .NET SDK is installed and the test project references NUnit, NUnit3TestAdapter and Microsoft.NET.Test.Sdk.
- 6Ask for tests by name. Request NUnit tests for a specific C# class, mentioning NUnit so the skill applies.
- 7Run and review. Run dotnet test and read the generated tests against the conventions.
What the csharp-nunit skill makes the agent do
An agent skill is a folder containing instructions that an AI agent reads when a task matches the skill. This one is a single file, SKILL.md, and it only affects how the agent writes and reviews NUnit tests. It contains no scripts and does not reach the internet.
The guidance covers project setup, test structure, standard tests, data-driven tests, assertions, mocking and isolation, and test organization. Test methods are expected to follow the pattern MethodName_Scenario_ExpectedBehavior, and test classes are expected to match the classes they test, such as CalculatorTests for Calculator.
- Separate test project named [ProjectName].Tests, referencing Microsoft.NET.Test.Sdk, NUnit and NUnit3TestAdapter
- Attributes such as [TestFixture], [Test], [SetUp] and [TearDown]
- Data-driven attributes: [TestCase], [TestCaseSource], [Values], [ValueSource], [Random], [Range], [Combinatorial] and [Pairwise]
- Constraint-model assertions with Assert.That, plus Assert.Throws<T> for exceptions
How do you install the csharp-nunit skill?
Download the ZIP for the skill from this page and unzip it. The skill is a folder that contains SKILL.md, so the unzipped folder should contain that file.
For a personal skill that works across your projects, place the unzipped folder in ~/.claude/skills/. To limit it to one project, place it in that project's .claude/skills/ folder.
You can also upload the skill in the Claude apps under Settings → Capabilities → Skills.
- Personal install: ~/.claude/skills/
- Project install: .claude/skills/ inside your project
- Claude apps: Settings → Capabilities → Skills, then upload
How do you trigger the skill with a natural request?
You do not need a special command. Ask the agent for NUnit tests in C# and mention NUnit by name so the request matches the skill. The more specific you are about the class and the behaviour, the more useful the tests will be.
The skill also applies when you ask for a review of existing NUnit tests against these conventions.
- "Write NUnit tests for my OrderService class, one test per behaviour, following the team naming convention."
- "Add data-driven NUnit tests for the TryParseAge method using TestCase."
- "Review my existing NUnit test classes for missing [TestFixture] attributes and unclear assertions."
- "Create a test project for my Billing library using NUnit and NUnit3TestAdapter."
What does a typical result look like?
Given a request for a Calculator class, the agent should produce a test project named after the library with a matching CalculatorTests class. Each test uses the MethodName_Scenario_ExpectedBehavior name and the arrange-act-assert layout, and inputs with several values are covered by data-driven attributes.
Check the output against the conventions before you accept it. The skill is guidance for the agent, so it does not guarantee that every test is correct for your code.
- Check that the test class names match the classes under test
- Check that each test covers a single behaviour
- Check that assertions use Assert.That with constraints unless you asked for the classic style
What do you need before you use it?
The skill assumes a .NET test setup. You need the .NET SDK, because the guidance runs tests with dotnet test. The test project needs the NUnit, NUnit3TestAdapter and Microsoft.NET.Test.Sdk NuGet packages.
Moq or NSubstitute is optional and only needed if your tests use mocking.
- Required: .NET SDK (for dotnet test)
- Required NuGet packages: NUnit, NUnit3TestAdapter, Microsoft.NET.Test.Sdk
- Optional: Moq or NSubstitute if you mock dependencies
dotnet testIs the csharp-nunit skill safe to use?
The skill runs no scripts and uses no network access. It is a text file of instructions, so the main safety consideration is reviewing the generated code the way you would review any change written by an agent. Read the tests before committing them, and run dotnet test to confirm they behave as intended.
- Runs scripts: no
- Uses network: no
- Only file in the package: SKILL.md
Tips for getting better NUnit tests
Give the agent the class and its dependencies, so it can decide which interfaces to mock. Interfaces make mocking easier, and the skill recommends them.
Ask for the specific attribute you want when you are learning. Requesting [TestCaseSource] or [Combinatorial] by name gives you a concrete example of how each attribute works.
- Name the framework explicitly: NUnit, not xUnit or MSTest
- Ask for one behaviour per test to keep failures easy to read
- Use [Explicit] or [Ignore("Reason")] for tests that should not run every time
What people use it for
- Generating a new [ProjectName].Tests project with NUnit packages for a C# library
- Writing data-driven tests with TestCase or TestCaseSource for parsing and validation methods
- Reviewing an existing NUnit test class for naming, structure and assertion style
- Learning how Combinatorial and Pairwise combine parameters in a test
Frequently asked questions
How do I install the csharp-nunit skill?
Download the ZIP from this page and unzip it so the folder contains SKILL.md. Place it in ~/.claude/skills/ for personal use, or in a project's .claude/skills/ folder. You can also upload it in the Claude apps under Settings → Capabilities → Skills.
Is the csharp-nunit skill free?
The skill is published under the MIT licence on github/awesome-copilot. The source does not state any price, so check the licence and the page for current terms.
What do I need to use the NUnit skill?
You need the .NET SDK for dotnet test, plus the NUnit, NUnit3TestAdapter and Microsoft.NET.Test.Sdk NuGet packages. Moq or NSubstitute is optional, only for mocking.
Does the skill work with xUnit or MSTest?
No. The guidance is specific to NUnit, so it would not match projects that use xUnit or MSTest. Use a framework-specific skill or write those tests without this one.
Does the skill run code or access the internet?
No. The package runs no scripts and uses no network access. It only contains SKILL.md, which gives the agent written guidelines.
Why isn't my agent using the skill?
Mention NUnit and C# explicitly in your request and confirm the folder is in ~/.claude/skills/ or the project's .claude/skills/ with SKILL.md at its top level. If you use the Claude apps, check that the upload appears under Settings → Capabilities → Skills.
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
Use this skill if you write C# tests with NUnit and want an agent to follow consistent naming, structure and attribute conventions. Pick something else if your project uses xUnit or MSTest, or if it is not written in C#, since the guidance would not match your framework.
Download the skill