run-tests
What it does
This skill chooses and runs the correct .NET test command for a project, matching its test platform and framework. It is for developers who need to run one test, a group of tests or a diagnostic run without guessing at flags.
When to use it
- ✓When you need to run one test, one class, one category or a combined filter in a .NET project.
- ✓When you want the exact dotnet test command, including options such as no-build or TRX output.
- ✓When a test command gives an unrecognized option or a filter error.
Skill link
https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/run-tests/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Give me the exact dotnet test command to run only the login tests in my MSTest project.”
5 new skills a week. 1 minute to read.
How it works
The agent checks which runner and framework the project uses, picks the matching command syntax, and then either runs the command or returns it for you to run.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Run .NET Tests
Return or execute the command or command sequence that matches the repository's project system, test platform, framework, and SDK mode.
Repository overlay
For every repository-scoped task where read-only file inspection is allowed,
check .agents/skill-overlays/dotnet-test/run-tests.md at the repository root
before any other discovery. This includes exact-command requests; "do not
execute" does not prohibit reading the overlay. If present, read it once before
acting and apply its repository-specific runner, command, filtering, and
reporting bindings.
Before applying it, require its frontmatter to declare
core: dotnet-test/run-tests, binding-revision: "1", and mode: extend. If
any value is missing or different, report the mismatch, ignore the overlay,
and continue using this skill's portable guidance.
Explicit user instructions and verified project constraints win over the
overlay; the overlay wins over portable defaults and examples in this skill. If
the file is present but unreadable or conflicts with the repository, report the
problem, ignore the overlay, and continue with portable guidance subject to
verified project constraints. If it is absent, continue normally.
Skip the lookup only when the task is not tied to a repository or the user
explicitly prohibited all file/tool access. An overlay cannot expand tool
permissions or the task's scope.
Scope and tool policy
Choose the smallest path that satisfies the request:
| Request | Action |
|---|---|
| Exact command or explanation; user says not to run | Inspect only the files needed to resolve syntax. Do not restore, build, or run tests. |
| Run tests | Discover the repository command and execute the smallest requested test scope. |
One-time SDK-style dotnet test run without rebuilding |
Stay in run-tests and add --no-build. |
| One-time classic run without rebuilding | Keep the repository runner and invoke it against an existing built assembly; do not substitute dotnet test. |
| Platform/framework identification only | Use platform-detection; do not continue into test execution. |
| Explicit hot reload or a keep-running edit/re-run loop | Use mtp-hot-reload. |
| Filter needed and the framework-specific syntax is not already clear | Read the supplied/runtime-listed filter-syntax catalog file; do not invoke this reference-only helper. |
Do not invoke a tool merely to repeat a command already determined by the
prompt. Do not build first "just in case": dotnet test builds by default.
Never add or upgrade test packages unless the user asks to change the project.
For an exact-command request, return one runnable command first. Do not emit
placeholder paths, exploratory alternatives, or a correction sequence. Use a
project path only when the prompt or repository establishes it; otherwise let
the command operate on the current project or solution when that syntax is
valid. Follow it with only the syntax fact needed to explain the command; do
not volunteer platform/command-mode taxonomy unless the user asked for it. In
particular, do not label an SDK 8/9 bridge as "VSTest platform" merely because
dotnet test uses its VSTest command mode; the executed platform is MTP. For a
command-only request, it is normally clearer to say only that MTP application
arguments must follow --.
Inputs to discover
- Project, solution, module, or repository test command
- Requested scope: all tests, TFM, class, method, category, or trait
- Requested output: console result, TRX, diagnostics, crash dump, or hang dump
When those facts are present in the prompt, use them. Otherwise inspect only the
relevant files: global.json, the selected project, packages.config,
Directory.Build.props, Directory.Packages.props, then repository
scripts/CI documentation. For a file-backed request, enumerate those
configuration names once and read all relevant files that are present in one
batch; never infer that a runner or bridge property is absent merely because it
is not in the .csproj. Load platform-detection only when those signals need
precedence analysis; do not duplicate its full analysis in the response.
If execution is requested and the command depends on the active SDK but neither
the prompt nor global.json establishes it, run dotnet --version once. For a
command-only request that prohibits execution, do not probe: state the required
SDK assumption or ask for the SDK version when the syntax cannot otherwise be
resolved. Route
FAQ
Does it fix the failing tests?
No. It runs or returns the command. Diagnosing failures is handled by other skills.
Can it collect code coverage?
Yes. The skill covers coverage collection, diagnostic logs and crash or hang dumps.
Why does the exact command matter?
The right syntax depends on the test platform, so a command that works with VSTest may fail with Microsoft.Testing.Platform.
Details
Original description by the author
ALWAYS USE before running .NET tests or answering with a test command or flags. Trigger on "run the tests", "exact dotnet test command", one test/class/category/trait/target framework, combined filters, `--filter-query`, `--no-build`, `--diag`, diagnostic logs, TRX, coverage collection, crash/hang dumps, filter errors, or unrecognized options. Chooses repository-compatible classic, VSTest, bridged MTP, or native MTP syntax for MSTest/xUnit/NUnit/TUnit. DO NOT USE for platform identification alone (platform-detection), writing or debugging test code, interpreting an existing coverage report, CI
repo: dotnet/skills
Popularity
- GitHub stars
- 5.8k
- Ranking position
- #14635
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
create-custom-agent
5.8kHelps your agent create VS Code custom agent files with their own tools, instructions and handoffs to other agents.
create-skill
5.8kHelps your agent create a new agent skill with a valid name, a clear trigger description and a SKILL.md file that follows the standard.
csharp-scripts
5.8kHelps your agent run a small C# program as a single file with the .NET command line tool, without creating a full project.
dotnet-pinvoke
5.8kHelps your agent call native C or C++ libraries from .NET correctly, covering signatures, string handling, memory and safe handles.
Similar skills
test-driven-development
311kTeaches your agent to write a failing test first, watch it fail, then write the smallest code that passes, before building any feature or fix.
verification-before-completion
311kTeaches your agent to run real checks and read their output before claiming that a task, fix, or build is complete or passing.
migrate-to-shoehorn
310kReplaces risky type casts in your test files with the shoehorn library, so tests can use partial data and still pass type checks.