/test-smell-detection
Deep-dive audit using the full testsmells.org 19-smell academic catalog for tests in any language. Every finding maps to a named, citable smell from the research literature (Assertion Roulette, Duplicate Assert, Mystery Guest, Eager Test, Sensitive Equality, Conditional Test
$ npx -y skills add managedcode/dotnet-skills --skill test-smell-detection --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/test-smell-detection
Context preview
The summary Claude sees to decide when to auto-load this skill.
Deep-dive audit using the full testsmells.org 19-smell academic catalog for tests in any language. Every finding maps to a named, citable smell from the research literature (Assertion Roulette, Duplicate Assert, Mystery Guest, Eager Test, Sensitive Equality, Conditional Test
SKILL.md
test-smell-detection.SKILL.mdname: test-smell-detection
description: >
Deep-dive audit using the full testsmells.org 19-smell academic catalog
for tests in any language. Every finding maps to a named, citable smell
from the research literature (Assertion Roulette, Duplicate Assert,
Mystery Guest, Eager Test, Sensitive Equality, Conditional Test Logic,
Sleepy Test, Magic Number Test, etc.) with research-backed severity.
Polyglot: .NET (MSTest/xUnit/NUnit/TUnit), Python (pytest/unittest),
TS/JS (Jest/Vitest/Mocha/node:test), Java (JUnit/TestNG), Go, Ruby
(RSpec/Minitest), Rust, Swift, Kotlin (JUnit/Kotest), PowerShell
(Pester), C++ (GoogleTest/Catch2).
INVOKE ONLY when explicitly asked for the testsmells.org 19-smell
academic catalog or citable smell names from the literature.
DO NOT USE FOR: general or pragmatic audits — use test-anti-patterns;
writing new tests (use code-testing-agent, or writing-mstest-tests for
MSTest); running tests (use run-tests); framework migration.
license: MIT
Test Smell Detection
Deep formal audit of test code in any supported language using an academic test smell taxonomy. Detects symptoms of bad design or implementation decisions that make tests harder to understand, more fragile, less effective at catching bugs, or more expensive to maintain. Produces a severity-ranked report with specific locations and actionable fixes.
> **Language-specific guidance**: Call the `test-analysis-extensions` skill to discover available extension files, then read the file matching the target codebase. The extension file documents test markers, sleep / time / random APIs, skip annotations, setup/teardown, mystery-guest indicators (file/database/network/env), integration markers, and language-specific calibration notes that drive the smell detectors below.
Why Test Smells Matter
Test smells erode confidence in a test suite and inflate maintenance costs:
| Problem | Consequence | |---------|-------------| | Tests with conditional logic | Some paths never execute — hidden testing gaps | | Tests that depend on external resources | Flaky failures, slow execution, environment coupling | | Tests that sleep to wait for results | Non-deterministic timing, slow suites, false failures | | Tests without assertions | False confidence — coverage looks good but nothing is verified | | Tests that call many production methods | Hard to diagnose failures, unclear what's being tested | | Tests with magic numbers | Unreadable intent, unclear boundary conditions | | Tests relying on ToString for comparison | Brittle to formatting changes, obscure failure messages | | Tests with exception handling logic | Swallowed failures, tests that pass when they shouldn't |
When to Use
- User asks for a comprehensive or formal test smell audit
- User asks "are my tests well-written?" and wants a thorough analysis
- User wants a test quality health check with academic rigor
- User asks for a review of test design or structure using standard smell categories
- User suspects tests are fragile, flaky, or giving false confidence and wants a deep investigation
When Not to Use
- User wants a quick pragmatic test review (use `test-anti-patterns` — faster, covers the most common issues)
- User wants to evaluate assertion diversity specifically (use `assertion-quality`)
- User wants to find duplicated boilerplate across tests (use `exp-test-maintainability`)
- User wants to write new tests from scratch (help them directly)
- User wants to fix a specific failing test (diagnose and fix directly)
Inputs
| Input | Required | Description | |-------|----------|-------------| | Test code | Yes | One or more test files or a test project directory to analyze | | Production code | No | The code under test, for context on whether patterns are justified |
Workflow
Step 1: Detect language and load extension
Identify the target codebase's language and test framework. Call the `test-analysis-extensions` skill and read the matching extension file (e.g., `extensions/dotnet.md`, `extensions/python.md`, `extensions/typescript.md`, `extensions/go.md`). The extension file lists the framework-specific test markers, sleep / wait APIs, skip / ignore attributes, mystery-guest indicators, and integration-test markers that the smell detectors below need.
Step 2: Gather the test code
Read all test files the user provides. If the user points to a directory or project, scan for all test files using the markers in the loaded language extension file.
For a thorough audit, also consult the [extended smell catalog](references/test-smell-catalog.md) which covers 9 additional smell types beyond the core 10 below.
Step 3: Scan for test smells
For each test method and class, check for the following smell categories. Examples reference .NET attributes but the patterns apply across all supported languages — use the loaded language extension file to map each pattern to the framework you are auditing.
Smell 1: Conditional Test Logic
Test methods containing `if`, `else`, `switch`, ternary (`? :`), `for`, `foreach`, `while`, or pattern-match arms that change assertion behavior. Control flow in tests means some paths may never execute, hiding gaps.
**Severity:** High **Detection:** Any control-flow statement inside a test method body that affects which assertions run. **Exceptions (per-language idioms, do NOT flag):**
- **Foreach-assert** used solely to assert every item in a known collection (the assertion *is* the loop body).
- **Go / Rust table-driven tests**: `for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ... }) }` (Go) or `#[rstest]` parametrized loops are idiomatic.
- **`it.each(...)` / `test.each(...)` / `@pytest.mark.parametrize` / `[Theory] + [InlineData]` / `@ParameterizedTest`** parametrization driven by data tables.
- **Pester `-ForEach` / `-TestCases`** and **RSpec `where` blocks**.
- **Catch2 `SECTION`s and `GENERATE(...)`**, **doctest `SUBCASE`**, **GoogleTest `INSTANTIAT
Read more
name: test-smell-detection description: > Deep-dive audit using the full testsmells.org 19-smell academic catalog for tests in any language. Every finding maps to a named, citable smell from the research literature (Assertion Roulette, Duplicate Assert, Mystery Guest, Eager Test, Sensitive Equality, Conditional Test Logic, Sleepy Test, Magic Number Test, etc.) with research-backed severity. Polyglot: .NET (MSTest/xUnit/NUnit/TUnit), Python (pytest/unittest), TS/JS (Jest/Vitest/Mocha/node:test), Java (JUnit/TestNG), Go, Ruby (RSpec/Minitest), Rust, Swift, Kotlin (JUnit/Kotest), PowerShell (Pester), C++ (GoogleTest/Catch2). INVOKE ONLY when explicitly asked for the testsmells.org 19-smell academic catalog or citable smell names from the literature. DO NOT USE FOR: general or pragmatic audits — use test-anti-patterns; writing new tests (use code-testing-agent, or writing-mstest-tests for MSTest); running tests (use run-tests); framework migration. license: MIT
Test Smell Detection
Deep formal audit of test code in any supported language using an academic test smell taxonomy. Detects symptoms of bad design or implementation decisions that make tests harder to understand, more fragile, less effective at catching bugs, or more expensive to maintain. Produces a severity-ranked report with specific locations and actionable fixes.
> **Language-specific guidance**: Call the `test-analysis-extensions` skill to discover available extension files, then read the file matching the target codebase. The extension file documents test markers, sleep / time / random APIs, skip annotations, setup/teardown, mystery-guest indicators (file/database/network/env), integration markers, and language-specific calibration notes that drive the smell detectors below.
Why Test Smells Matter
Test smells erode confidence in a test suite and inflate maintenance costs:
| Problem | Consequence | |---------|-------------| | Tests with conditional logic | Some paths never execute — hidden testing gaps | | Tests that depend on external resources | Flaky failures, slow execution, environment coupling | | Tests that sleep to wait for results | Non-deterministic timing, slow suites, false failures | | Tests without assertions | False confidence — coverage looks good but nothing is verified | | Tests that call many production methods | Hard to diagnose failures, unclear what's being tested | | Tests with magic numbers | Unreadable intent, unclear boundary conditions | | Tests relying on ToString for comparison | Brittle to formatting changes, obscure failure messages | | Tests with exception handling logic | Swallowed failures, tests that pass when they shouldn't |
When to Use
- User asks for a comprehensive or formal test smell audit
- User asks "are my tests well-written?" and wants a thorough analysis
- User wants a test quality health check with academic rigor
- User asks for a review of test design or structure using standard smell categories
- User suspects tests are fragile, flaky, or giving false confidence and wants a deep investigation
When Not to Use
- User wants a quick pragmatic test review (use `test-anti-patterns` — faster, covers the most common issues)
- User wants to evaluate assertion diversity specifically (use `assertion-quality`)
- User wants to find duplicated boilerplate across tests (use `exp-test-maintainability`)
- User wants to write new tests from scratch (help them directly)
- User wants to fix a specific failing test (diagnose and fix directly)
Inputs
| Input | Required | Description | |-------|----------|-------------| | Test code | Yes | One or more test files or a test project directory to analyze | | Production code | No | The code under test, for context on whether patterns are justified |
Workflow
Step 1: Detect language and load extension
Identify the target codebase's language and test framework. Call the `test-analysis-extensions` skill and read the matching extension file (e.g., `extensions/dotnet.md`, `extensions/python.md`, `extensions/typescript.md`, `extensions/go.md`). The extension file lists the framework-specific test markers, sleep / wait APIs, skip / ignore attributes, mystery-guest indicators, and integration-test markers that the smell detectors below need.
Step 2: Gather the test code
Read all test files the user provides. If the user points to a directory or project, scan for all test files using the markers in the loaded language extension file.
For a thorough audit, also consult the [extended smell catalog](references/test-smell-catalog.md) which covers 9 additional smell types beyond the core 10 below.
Step 3: Scan for test smells
For each test method and class, check for the following smell categories. Examples reference .NET attributes but the patterns apply across all supported languages — use the loaded language extension file to map each pattern to the framework you are auditing.
Smell 1: Conditional Test Logic
Test methods containing `if`, `else`, `switch`, ternary (`? :`), `for`, `foreach`, `while`, or pattern-match arms that change assertion behavior. Control flow in tests means some paths may never execute, hiding gaps.
**Severity:** High **Detection:** Any control-flow statement inside a test method body that affects which assertions run. **Exceptions (per-language idioms, do NOT flag):**
- **Foreach-assert** used solely to assert every item in a known collection (the assertion *is* the loop body).
- **Go / Rust table-driven tests**: `for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ... }) }` (Go) or `#[rstest]` parametrized loops are idiomatic.
- **`it.each(...)` / `test.each(...)` / `@pytest.mark.parametrize` / `[Theory] + [InlineData]` / `@ParameterizedTest`** parametrization driven by data tables.
- **Pester `-ForEach` / `-TestCases`** and **RSpec `where` blocks**.
- **Catch2 `SECTION`s and `GENERATE(...)`**, **doctest `SUBCASE`**, **GoogleTest `INSTANTIAT
Stop explaining .NET to your AI. Start building. We've all been there: asking Claude to use Entity Framework, only to get EF6 patterns in a .NET 8 project. Explaining to Copilot that Blazor Server and Blazor WebAssembly aren't the same thing.
Repo: managedcode/dotnet-skills
Other skills on dotnet-skills.
- /aspnet-core
Build, debug, modernize, or review ASP.NET Core applications with correct hosting, middleware, security, configuration, logging, and deployment patterns on current .NET. USE FOR: working on ASP.NET Core apps, services, or middleware; changing auth, routing, configuration,
Open skill - /aspire
Build, upgrade, and operate Aspire 13.4.x C# or TypeScript application hosts with the current CLI, AppHost, ServiceDefaults, integrations, dashboard, testing, MCP, and deployment patterns for distributed apps. USE FOR: Aspire.AppHost.Sdk, Aspire.Hosting.*,
Open skill - /azure-functions
Build, review, or migrate Azure Functions in .NET with correct execution model, isolated worker setup, bindings, DI, and Durable Functions patterns. USE FOR: working on Azure Functions in .NET; migrating from the in-process model to the isolated worker model; adding Durable
Open skill - /blazor
Build and review Blazor applications across server, WebAssembly, web app, and hybrid scenarios with correct component design, state flow, rendering, and hosting choices. USE FOR: building interactive web UIs with C# instead of JavaScript; choosing between Server, WebAssembly, or
Open skill - /entity-framework6
Maintain or migrate EF6-based applications with realistic guidance on what to keep, what to modernize, and when EF Core is or is not the right next step. USE FOR: EF6 codebases; runtime versus ORM migration decisions; EDMX, code-first, ObjectContext, and legacy data-access
Open skill - /entity-framework-core
Design, tune, or review EF Core data access with proper modeling, migrations, query translation, performance, and lifetime management for modern .NET applications. USE FOR: DbContext, migrations, model configuration, EF queries, tracking, loading, performance, transactions, and
Open skill

