Skip to content
21 changes: 15 additions & 6 deletions plugins/dotnet-test/agents/test-quality-auditor.agent.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
---
name: test-quality-auditor
description: >-
Audits .NET test suite quality: assertion depth, test smells, anti-patterns,
mock usage, test gaps, maintainability, coverage risk, and test tagging.
Use when asked to review test quality, audit a test suite, find weak tests,
check test health, or run a comprehensive test quality assessment. Routes to
specialized analysis skills based on user intent.
Runs multi-skill audit pipelines for comprehensive .NET test suite assessment
across an entire workspace or project, combining assertion quality, test smell
detection, mock usage analysis, test gap analysis, coverage risk, and test tagging
into unified reports. Use when asked for a broad test suite health check, full
multi-dimensional quality audit, or comprehensive assessment that requires
running multiple analysis skills in sequence. Do NOT use for reviewing a single
test file, class, or inline code snippet — those requests are handled directly
by individual skills like test-anti-patterns.
tools: ['read', 'search', 'edit', 'terminal', 'skill']
user-invokable: true
disable-model-invocation: false
Expand All @@ -22,6 +25,12 @@ You are a .NET test quality auditor. You help developers understand and improve
- Synthesizing findings from multiple skills into a unified report
- Identifying which quality dimensions matter most for a given codebase

## When Not to Invoke This Agent

- Single-file, single-class, or inline test snippet reviews
- Direct anti-pattern checks where the user is not asking for a broad multi-dimensional audit
- Focused requests that clearly map to one skill (invoke that skill directly)

## Domain Relevance Check

Before proceeding, verify the workspace contains .NET test projects:
Expand All @@ -39,7 +48,7 @@ Classify the user's request and route to the appropriate skill:
|---|---|---|
| "Are my assertions good enough?" / shallow testing / assertion diversity | `exp-assertion-quality` skill | dotnet-experimental |
| "Find test smells" / comprehensive formal audit | `exp-test-smell-detection` skill | dotnet-experimental |
| "Quick test review" / pragmatic anti-pattern check | `test-anti-patterns` skill | dotnet-test |
| "Pragmatic anti-pattern check" within a broader audit context | `test-anti-patterns` skill | dotnet-test |
| "Find test duplication" / boilerplate / DRY up tests | `exp-test-maintainability` skill | dotnet-experimental |
| "Are my mocks needed?" / over-mocking / mock audit | `exp-mock-usage-analysis` skill | dotnet-experimental |
| "Would my tests catch bugs?" / mutation analysis / test gaps | `exp-test-gap-analysis` skill | dotnet-experimental |
Expand Down
5 changes: 4 additions & 1 deletion plugins/dotnet-test/skills/test-anti-patterns/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: test-anti-patterns
description: "Quick pragmatic review of .NET test code for anti-patterns that undermine reliability and diagnostic value. Use when asked to review tests, find test problems, check test quality, or audit tests for common mistakes. Catches assertion gaps, flakiness indicators, over-mocking, naming issues, and structural problems with actionable fixes. Use for periodic test code reviews and PR feedback. For a deep formal audit based on academic test smell taxonomy, use exp-test-smell-detection instead. Works with MSTest, xUnit, NUnit, and TUnit."
description: "Quick pragmatic detection-focused review of .NET test code for anti-patterns that undermine reliability and diagnostic value. Use when asked to audit test quality, investigate flaky or coupled tests, find duplication or magic values, or when tests pass but don't actually verify anything. Best for identifying and prioritizing issues in existing tests with severity-ranked findings and targeted remediation guidance. Catches assertion gaps, swallowed exceptions, always-true assertions, flakiness indicators, test coupling, over-mocking, naming issues, magic values, duplicate tests, and structural problems. Do NOT use for direct MSTest API rewrites or implementation-only fixes (for example swapped Assert.AreEqual argument order or converting `DynamicData` from `IEnumerable<object[]>` to `ValueTuple`) — use writing-mstest-tests instead. For a deep formal audit based on academic test smell taxonomy, use exp-test-smell-detection instead. Works with MSTest, xUnit, NUnit, and TUnit."
---

# Test Anti-Pattern Detection
Expand All @@ -18,6 +18,9 @@ Quick, pragmatic analysis of .NET test code for anti-patterns and quality issues
## When Not to Use

- User wants to write new tests from scratch (use `writing-mstest-tests`)
- User wants direct implementation fixes in MSTest code rather than a diagnostic review (use `writing-mstest-tests`)
- User asks to fix swapped `Assert.AreEqual` argument order (use `writing-mstest-tests`)
- User asks to convert `DynamicData` from `IEnumerable<object[]>` to `ValueTuple` (use `writing-mstest-tests`)
- User wants to run or execute tests (use `run-tests`)
- User wants to migrate between test frameworks or versions (use migration skills)
- User wants to measure code coverage (out of scope)
Expand Down
12 changes: 7 additions & 5 deletions plugins/dotnet-test/skills/writing-mstest-tests/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: writing-mstest-tests
description: "Best practices for writing MSTest 3.x/4.x unit tests. Use when the user needs to write, improve, fix, or review MSTest tests, including modern assertions, data-driven tests, test lifecycle, and common anti-patterns. Also use when fixing test issues like swapped Assert.AreEqual arguments, incorrect assertion usage, or modernizing legacy test code. Covers MSTest.Sdk, sealed classes, Assert.Throws, DynamicData with ValueTuples, TestContext, and conditional execution."
description: "Best practices for writing new MSTest 3.x/4.x unit tests and implementing concrete fixes in existing MSTest code. Use when the user asks to write, create, implement, repair, or modernize tests (including fix-it prompts such as 'something seems off, fix issues'). Primary fit for direct code changes like correcting swapped Assert.AreEqual argument order, replacing outdated assertion patterns, and converting DynamicData from IEnumerable<object[]> to ValueTuple-based data sets. Covers modern assertions, data-driven tests, test lifecycle, MSTest.Sdk, sealed classes, Assert.Throws, DynamicData with ValueTuples, TestContext, and conditional execution. Do NOT use for broad test quality audits, flaky-test investigations, or test smell detection reports — use test-anti-patterns instead."
---

# Writing MSTest Tests
Expand All @@ -10,16 +10,18 @@ Help users write effective, modern unit tests with MSTest 3.x/4.x using current
## When to Use

- User wants to write new MSTest unit tests
- User wants to improve or modernize existing MSTest tests
- User wants to improve or modernize existing MSTest tests by implementing concrete fixes
- User asks about MSTest assertion APIs, data-driven patterns, or test lifecycle
- User needs targeted help fixing or modernizing MSTest tests
- User needs help fixing a specific MSTest test bug or failing assertion
- User asks to fix swapped `Assert.AreEqual` argument order (expected first, actual second)
- User asks to convert `DynamicData` from `IEnumerable<object[]>` to ValueTuple-based data

## When Not to Use

- User needs a test quality audit, anti-pattern detection, or flaky-test investigation (use `test-anti-patterns`)
Comment thread
Evangelink marked this conversation as resolved.
- User needs to run or execute tests (use the `run-tests` skill)
- User needs to upgrade from MSTest v1/v2 to v3 (use `migrate-mstest-v1v2-to-v3`)
- User needs to upgrade from MSTest v3 to v4 (use `migrate-mstest-v3-to-v4`)
- User needs to review or audit existing tests for anti-patterns or test quality (use `test-anti-patterns`)
- User needs CI/CD pipeline configuration
- User is using xUnit, NUnit, or TUnit (not MSTest)

Expand All @@ -28,7 +30,7 @@ Help users write effective, modern unit tests with MSTest 3.x/4.x using current
| Input | Required | Description |
|-------|----------|-------------|
| Code under test | No | The production code to be tested |
| Existing test code | No | Current tests to improve or modernize |
| Existing test code | No | Current tests to fix, update, or modernize |
| Test scenario description | No | What behavior the user wants to test |

## Workflow
Expand Down