Guide · Agent skill
How to use the MSTest Unit Testing Guide agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The csharp-mstest skill is a guide of MSTest best practices that you install into an AI agent so it writes and reviews C# unit tests the way the guide describes. It is for C# developers who use MSTest 3.x or 4.x. After this tutorial you will know what the skill changes, how to install it, how to trigger it with plain requests, and what it needs before it helps.
Quick start
- 1Download the ZIP. Download the csharp-mstest ZIP from this page and unzip it so you have the folder containing SKILL.md.
- 2Place the folder. Move the folder into ~/.claude/skills/ for all projects, or into your project's .claude/skills/ for one project.
- 3Or upload it in the apps. In the Claude apps, open Settings → Capabilities → Skills and upload the skill instead.
- 4Confirm your setup. Make sure your project has a .NET SDK and MSTest 3.x or 4.x NuGet packages in a separate [ProjectName].Tests project.
- 5Ask for tests in plain language. Request MSTest unit tests for a named class or method, mentioning C# or MSTest.
- 6Run dotnet test. Run dotnet test yourself to confirm the generated tests pass and build.
What the csharp-mstest skill makes the agent do
An agent skill is a folder with a SKILL.md file that gives an AI agent extra instructions for a specific task. When this skill is loaded, the agent follows the MSTest conventions written in its SKILL.md when it writes or reviews tests.
The guide covers project setup, test class structure, test lifecycle, assertions and data-driven tests. It tells the agent to seal test classes, use the AAA (Arrange-Act-Assert) pattern and name tests MethodName_Scenario_ExpectedBehavior.
- Put tests in a separate test project named [ProjectName].Tests
- Use [TestMethod] rather than [DataTestMethod], and prefer constructors over [TestInitialize] for setup
- Choose modern assertions such as Assert.Throws, Assert.ThrowsExactly and Assert.ContainsSingle
- Use DataRow and DynamicData for data-driven tests, preferring ValueTuple or TestDataRow over object[]
Install the skill from the ZIP file
Download the csharp-mstest ZIP from this page and unzip it. The skill is a single file, 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 instead.
You can also upload the skill in the Claude apps under Settings → Capabilities → Skills.
Trigger the skill with natural requests
You do not need a special command. Ask the agent for tests in plain language that mentions MSTest or C# unit tests, and the agent can apply the skill when it matches the request.
Be specific about the method or class you want covered. The guide's conventions are then applied to that code.
- Write MSTest unit tests for the Calculator.Add method
- Review these C# tests and tell me where they break MSTest best practices
- Convert these tests from ExpectedException to Assert.ThrowsExactly
- Add data-driven tests for this parser using DataRow
See what the output looks like
The guide shows the expected shape of a test class: a sealed class with a [TestMethod] that arranges inputs, acts once and asserts the result. Agent output should follow this layout.
[TestClass]
public sealed class CalculatorTests
{
[TestMethod]
public void Add_TwoPositiveNumbers_ReturnsSum()
{
// Arrange
var calculator = new Calculator();
// Act
var result = calculator.Add(2, 3);
// Assert
Assert.AreEqual(5, result);
}
}Check what you need before you start
The skill needs a C# / .NET SDK so that dotnet test can run, and MSTest 3.x or 4.x NuGet packages in your test project. The guide notes that referencing MSTest 3.x+ packages includes analyzers, and that MSTest.Sdk can simplify project setup.
The skill does not run tests by itself. It is a written set of conventions, so you run dotnet test yourself to check the agent's code.
Safety notes: scripts and network
According to the item details, this skill runs no scripts and uses no network access. It contains only SKILL.md, so there is no executable code to review inside the skill folder.
Code the agent writes still runs in your project, so review it as you would any change before committing.
Tips for getting better results
Give the agent the class under test and any existing test project conventions. Ask it to match your MSTest version, since 4.x adds Assert.That and returns typed results from Assert.IsInstanceOfType, while 3.x uses an out parameter for that call.
Run dotnet test after each change and review assertions the agent chose, because the guide's rules are conventions rather than checks.
What people use it for
- Writing a first set of MSTest tests for a C# service class
- Reviewing existing tests for sealed classes, naming and AAA layout
- Migrating older MSTest assertions to Assert.ThrowsExactly and other modern APIs
- Turning repeated test cases into DataRow or DynamicData tests
Frequently asked questions
How do I install the csharp-mstest skill?
Download the ZIP from this page and unzip it. Place the folder in ~/.claude/skills/ for personal use or in a project's .claude/skills/ folder, or upload it in the Claude apps under Settings → Capabilities → Skills.
What do I need to use the MSTest skill?
You need a C# / .NET SDK so that dotnet test works, and MSTest 3.x or 4.x NuGet packages in your test project. The skill itself runs no scripts and uses no network.
Is the csharp-mstest skill free?
The skill is listed under the MIT licence on its source repository. Check the licence file in the source for the terms that apply.
Does the skill run my tests?
No. It is a written guide of MSTest conventions. You run dotnet test yourself to build and run the tests the agent writes.
Can I use this skill with NUnit or xUnit?
No. The guidance is MSTest-specific, so it does not apply to NUnit, xUnit or other test frameworks. Non-.NET languages are also out of scope.
What is the difference between Assert.Throws and Assert.ThrowsExactly?
Assert.Throws matches the given exception type or a derived type. Assert.ThrowsExactly matches only the exact type. The guide recommends these over the older ExpectedException attribute.
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 csharp-mstest if you write or review C# unit tests with MSTest 3.x or 4.x and want consistent naming, structure and modern assertions from your agent. Pick a different skill or guide if your project uses NUnit, xUnit or a non-.NET language, since this guidance does not apply there.
Download the skill