Official agent skill

Exp Test Maintainability

by dotnet in dotnet/skills

Detects duplicate boilerplate, copy-paste tests, and structural maintainability issues across .NET test suites.

OfficialMITAuto-check passedDevelopment

Install Exp Test Maintainability

skills CLI
$ npx skills add dotnet/skills --skill exp-test-maintainability -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install dotnet/skills exp-test-maintainability --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/dotnet/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/dotnet-experimental/skills/exp-test-maintainability .claude/skills/exp-test-maintainability && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
exp-test-maintainability
GitHub stars
5.6k
Used in
1 other repo
Token cost
~2.5k tokens
SKILL.md length
1,034 words
Files
1
Skills in repo
91
Repo updated
First seen
Licence
MIT

At a glance

Detects duplicate boilerplate, copy-paste tests, and structural maintainability issues across .NET test suites.

  • Works in 4 steps: Gather the test code → Identify maintainability issues → Apply calibration rules → …
  • The user asks to reduce repetition
  • SKILL.md covers When to Use, When Not to Use, Inputs and Workflow, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Exp Test Maintainability is an agent skill from dotnet/skills, published by the product's own GitHub organization. Detects duplicate boilerplate, copy-paste tests, and structural maintainability issues across .NET test suites. Use when the user asks to reduce repetition, consolidate similar test methods, convert copy-paste tests to data-driven parameterized tests, suggest a better test structure, or identify refactoring opportunities. Identifies repeated construction, assertion patterns, copy-paste methods convertible to DataRow/Theory/TestCase, redundant setup/teardown, and shared infrastructure. Produces an analysis report…

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Project scaffolding, Refactoring and Unit testing. It works with .NET. The repository describes itself as: Repository for skills to assist AI coding agents with .NET and C. The licence is MIT.

When your agent uses it

  • The user asks to reduce repetition
  • Consolidate similar test methods
  • Convert copy-paste tests to data-driven parameterized tests
  • Suggest a better test structure

Example prompts

  • “Use the exp-test-maintainability skill to detect duplicate boilerplate, copy-paste tests, and structural maintainability issues across .NET test…”
  • “/exp-test-maintainability”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Gather the test code
  2. Identify maintainability issues
  3. Apply calibration rules
  4. Report findings

What it can do on your machine

Read from SKILL.md and the folder at commit 8d670fa. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are csharp).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Exp Test Maintainability loads about 2.5k tokens when it runs. Until then it costs about 202 tokens; SKILL.md has 1,034 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~202
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from dotnet/skills at commit 8d670fa, republished under its MIT licence (© dotnet). 1,034 words, ~2,460 tokens.

Download SKILL.mdSave it as .claude/skills/exp-test-maintainability/SKILL.md (or your agent's skills folder).
name
exp-test-maintainability
description
Detects duplicate boilerplate, copy-paste tests, and structural maintainability issues across .NET test suites. Use when the user asks to reduce repetition, consolidate similar test methods, convert copy-paste tests to data-driven parameterized tests, suggest a better test structure, or identify refactoring opportunities. Identifies repeated construction, assertion patterns, copy-paste methods convertible to DataRow/Theory/TestCase, redundant setup/teardown, and shared infrastructure. Produces an analysis report with concrete before/after suggestions. Works with MSTest, xUnit, NUnit, and TUnit. DO NOT USE FOR: writing new tests (use writing-mstest-tests), reviewing test quality or anti-patterns (use test-anti-patterns), or deep mock auditing (use exp-mock-usage-analysis).
license
MIT

Test Maintainability Assessment

Analyze .NET test code for maintainability issues: duplicated boilerplate, copy-paste test methods, and structural repetition across test methods and classes. Produce a report of refactoring opportunities with concrete before/after suggestions. The goal is analysis only — do not modify any files.

When to Use

  • User asks to find duplicated code or boilerplate in tests
  • User wants to know where test code can be DRY-ed up
  • User asks to reduce test duplication, improve test readability, or clean up test boilerplate
  • User asks for refactoring opportunities in a test suite
  • User wants to identify shared setup or teardown candidates
  • User asks "what patterns repeat across my tests?"
  • User wants to centralize test data, introduce builders or helpers

When Not to Use

  • User wants to write new tests from scratch (use writing-mstest-tests)
  • User wants to detect anti-patterns or code smells (use test-anti-patterns)
  • User wants to actually perform the refactoring (help them directly, this skill only analyzes)

Inputs

InputRequiredDescription
Test codeYesOne or more test files or a test project directory to analyze
Production codeNoThe code under test, for context on what abstractions might help
ScopeNoWhether to analyze within a single class or across multiple classes

Workflow

Step 1: Gather the test code

Read all test files the user provides or references. If the user points to a directory or project, scan for all test files using these framework markers:

FrameworkTest class markersTest method markers
MSTest[TestClass][TestMethod], [DataTestMethod]
xUnit(none — convention-based)[Fact], [Theory]
NUnit[TestFixture][Test], [TestCase], [TestCaseSource]
TUnit(none — convention-based)[Test]
Step 2: Identify maintainability issues

Scan for these categories:

Category 1: Repeated object construction

Look for the same object being constructed in 3+ test methods with identical or near-identical parameters.

Indicators:

  • new ClassName(...) appearing with identical arguments in multiple tests
  • Multiple tests creating the same "system under test" with similar configuration
  • Repeated mock/fake/stub creation with the same setup

Potential refactorings:

  • Extract a factory method or test helper (e.g., CreateSut(), CreateDefaultOrder())
  • Use [TestInitialize]/constructor/[SetUp] for shared construction
  • Introduce a builder pattern for complex objects with many variations

Example — before:

csharp
[TestMethod]
public void Process_ValidOrder_Succeeds()
{
    var logger = new FakeLogger();
    var email = new FakeEmailService();
    var inventory = new FakeInventory(stock: 100);
    var processor = new OrderProcessor(logger, email, inventory);
    // ...
}

[TestMethod]
public void Process_EmptyItems_Fails()
{
    var logger = new FakeLogger();
    var email = new FakeEmailService();
    var inventory = new FakeInventory(stock: 100);
    var processor = new OrderProcessor(logger, email, inventory);
    // ...
}

After — extract factory:

csharp
private static OrderProcessor CreateProcessor(int stock = 100)
{
    return new OrderProcessor(new FakeLogger(), new FakeEmailService(), new FakeInventory(stock));
}
Category 2: Repeated assertion patterns

Look for the same sequence of assertions appearing in 3+ test methods.

Indicators:

  • Multiple tests asserting the same set of properties on a result object
  • Repeated null-check-then-value-check sequences
  • Same collection of Assert.AreEqual calls across methods

Potential refactorings:

  • Extract a custom assertion helper (e.g., AssertValidOrder(order, expectedTotal, expectedStatus))
  • Use framework-specific assertion extensions
  • Introduce a Verify method that checks a standard set of properties
Category 3: Copy-paste test methods

Look for test methods with near-identical bodies differing only in input values or a single parameter.

Indicators:

  • 3+ methods with the same structure but different literal values
  • Methods that could be collapsed into [DataRow]/[Theory]/[TestCase]
  • Test names that follow a pattern like Method_Input1_Result, Method_Input2_Result

Potential refactorings:

  • Convert to parameterized tests with [DataRow]/[InlineData]/[TestCase]
  • Use [DynamicData]/[MemberData]/[TestCaseSource] for complex inputs
  • Prefer [DataRow] with DisplayName over [DynamicData] when all values are compile-time constants. Reserve [DynamicData] for computed or complex values.
  • Add DisplayName for non-obvious parameter values. [DataRow("Gold", 100.0, 90.0)] is self-explanatory; [DataRow(3, 7, 42)] is not.
Category 4: Duplicated setup/teardown logic

Look for initialization or cleanup code repeated across test classes.

Indicators:

  • Multiple [TestInitialize]/[SetUp] methods with similar bodies
  • Repeated database seeding, file creation, or HTTP client configuration
  • Same using/IDisposable cleanup pattern across classes

Potential refactorings:

  • Extract a shared test base class or fixture
  • Use composition with a shared helper class
  • Create a test context factory
Category 5: Repeated test infrastructure

Look for structural patterns shared across test classes.

Indicators:

  • Same mock interfaces configured identically in multiple classes
  • Repeated HttpClient setup with similar DelegatingHandler patterns
  • Same logging/configuration scaffolding across test classes

Potential refactorings:

  • Extract a shared test fixture or helper library
  • Create reusable fake implementations
  • Introduce a test harness class
Show full SKILL.md (409 more words)Show less
Step 3: Apply calibration rules

Before reporting, filter findings through these rules:

  • Only report at 3+ occurrences. Two similar setups are not boilerplate — they may be intentional clarity.
  • Don't flag simple constructors. new Calculator() or new List<int>() is not meaningful boilerplate. Don't recommend builders for new User(1, "Alice") either.
  • Respect intentional verbosity. If each test is self-contained and reads clearly on its own, explicit setup per test is a valid choice. Note it but don't flag it as a problem.
  • Distinguish structural similarity from true duplication. Tests that follow AAA (Arrange-Act-Assert) will look similar by nature. Only flag when the actual code (not just the structure) is duplicated.
  • Consider the blast radius of refactoring. A helper shared across 20 tests creates coupling. Note the trade-off.
  • If tests are already well-maintained, say so. A report finding only minor opportunities is perfectly valid. Acknowledge what's already good.
Step 4: Report findings

Present findings in this structure:

  1. Summary — How many patterns found, broken down by category. If the test suite is clean, lead with that.
  2. Findings by category — For each pattern found:
    • Category name and description
    • Locations: list the specific test methods and files involved
    • The duplicated code pattern (show a representative sample)
    • Suggested refactoring with a concrete before/after example
    • Estimated impact: how many lines/methods would be simplified
  3. Refactoring priority — Rank findings by:
    • Occurrence count (more occurrences = higher value)
    • Complexity of the duplicated code (complex setup > simple construction)
    • Risk (low-risk extractions first)
  4. Trade-offs — For each suggestion, note:
    • What readability is gained
    • What locality/independence is lost
    • Whether it's worth it given the occurrence count

Validation

  • Every finding includes specific file and method locations
  • Every finding shows the actual duplicated code, not just a description
  • Every suggestion includes a concrete before/after example
  • Findings are filtered through the 3+ occurrence threshold
  • Simple constructors are not flagged
  • Trade-offs are acknowledged for each suggestion
  • If tests are clean, the report says so upfront

Common Pitfalls

PitfallSolution
Flagging AAA structure as duplicationThe Arrange-Act-Assert pattern is not boilerplate — flag only when the actual code repeats
Suggesting extraction for 2 occurrencesWait for 3+ before recommending extraction
Recommending base classes for everythingPrefer composition (helpers, factories) over inheritance
Ignoring the readability costEvery extraction adds indirection — note the trade-off
Flagging simple new X() as boilerplateOnly flag complex construction with multiple parameters or configuration
Recommending DRY at the expense of test isolationTests that share mutable state through helpers become coupled — warn about this

© dotnet, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/dotnet-experimental/skills/exp-test-maintainability of dotnet/skills.

Open the folder on GitHubat commit 8d670fa

Used in 1 other repository

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in dotnet/skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Exp Test Maintainability next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Exp Test Maintainability compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Exp Test Maintainability this skilldotnet/skills5.6k1 repos~2.5kAutomated safety check: PassMIT
Raven Test Triagemarinasundstrom/raven108—~1.4kAutomated safety check: PassMIT
Corvus Build And Testcorvus-dotnet/Corvus.JsonSchema199—~5.5kAutomated safety check: PassApache-2.0
ScottPlot Test RunnerScottPlot/ScottPlot6.8k—~308Automated safety check: PassMIT
Testing Guidefullstackhero/dotnet-starter-kit6.8k—~935Automated safety check: PassMIT
Console Testingsynnaxlabs/synnax128—~5.4kAutomated safety check: PassCustom licence

Similar skills

  • Raven Test Triage

    marinasundstrom/raven

    Testing and stabilization workflow for the Raven compiler test suite.

    108 GitHub stars~1.4k tokensUpdated today
    Testing & QAAuto-check passed
  • Corvus Build And Test

    corvus-dotnet/Corvus.JsonSchema

    Build, test, and run the Corvus.JsonSchema solution correctly.

    199 GitHub stars~5.5k tokensUpdated today
    Testing & QAAuto-check passed
  • ScottPlot Test Runner

    ScottPlot/ScottPlot

    Run or add ScottPlot 5 tests. Use for unit-test and cookbook-test work; unless explicitly asked otherwise, restrict manual test execution to the Unit Tests…

    6.8k GitHub stars~308 tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • Testing Guide

    fullstackhero/dotnet-starter-kit

    Write tests for an FSH feature — xUnit + Shouldly + NSubstitute + AutoFixture, with naming and AAA conventions.

    6.8k GitHub stars~935 tokensUpdated 7 days ago
    Testing & QAAuto-check passed
  • Console Testing

    synnaxlabs/synnax

    Rules for writing and editing unit tests in the Console (console/src//.spec.ts[x]).

    128 GitHub stars~5.4k tokensUpdated today
    Testing & QAAuto-check passed
  • Run Tests

    runceel/ReactiveProperty

    Runs .NET tests with dotnet test. An agent skill from runceel/ReactiveProperty.

    944 GitHub stars~3.6k tokensUpdated 1 mo ago
    Testing & QAAuto-check passed

More from dotnet/skills

All 91 skills in this repo
  • Official

    Resolves .NET runtime frames in Apple .ips crash logs to function names, source files and line numbers using dSYM symbols, atos and the Microsoft symbol server.

    5.6k GitHub starsUsed in 1 repo~2.4k tokens
    Auto-check passed
  • Official

    Resolves native crash frames from .NET Android tombstones to function names, source files and line numbers using BuildIds, Microsoft's symbol server and llvm-symbolizer.

    5.6k GitHub starsUsed in 1 repo~2.1k tokens
    Auto-check passed
  • Official

    Scans C# and .NET code for about 50 performance anti-patterns and reports prioritized findings with concrete fixes, at a scan depth you choose.

    5.6k GitHub starsUsed in 3 repos~3.1k tokens
    Auto-check passed
  • Official

    Statically pairs source files with test files to list code that no test references, using Roslyn for C# or tree-sitter for many languages, with no build.

    5.6k GitHub starsUsed in 1 repo~3.3k tokens
    Auto-check passed
  • Microbenchmarking

    dotnet/skills

    Official

    Activate this skill when BenchmarkDotNet (BDN) is involved in the task — creating, running, configuring, or reviewing BDN benchmarks.

    5.6k GitHub starsUsed in 3 repos~3.3k tokens
    Auto-check passed
  • Official

    Makes .NET projects compatible with Native AOT and trimming by resolving IL trim and AOT analyzer warnings through annotations rather than suppressions.

    5.6k GitHub starsUsed in 2 repos~4.2k tokens
    Auto-check passed

Works with

Questions about Exp Test Maintainability

What does Exp Test Maintainability do?

Detects duplicate boilerplate, copy-paste tests, and structural maintainability issues across .NET test suites. Exp Test Maintainability is an agent skill from dotnet/skills, published by the product's own GitHub organization.NET test suites.

When should I use Exp Test Maintainability?

Exp Test Maintainability fits situations like: the user asks to reduce repetition; consolidate similar test methods; convert copy-paste tests to data-driven parameterized tests; suggest a better test structure.

How do I install Exp Test Maintainability in Claude Code?

Run `npx skills add dotnet/skills --skill exp-test-maintainability -a claude-code`. Or copy the skill folder (plugins/dotnet-experimental/skills/exp-test-maintainability in dotnet/skills) into .claude/skills/exp-test-maintainability in your project. Claude Code loads it when a task matches its description.

How do I install Exp Test Maintainability in Codex?

Run `npx skills add dotnet/skills --skill exp-test-maintainability -a codex`. Or copy the skill folder (plugins/dotnet-experimental/skills/exp-test-maintainability in dotnet/skills) into .agents/skills/exp-test-maintainability in your project. Codex loads it when a task matches its description.

Can I use Exp Test Maintainability in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add dotnet/skills --skill exp-test-maintainability -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/exp-test-maintainability, .gemini/skills/exp-test-maintainability, .github/skills/exp-test-maintainability and .opencode/skills/exp-test-maintainability in your project.

What does Exp Test Maintainability need to run?

SKILL.md names no scripts, command-line tools or credentials: Exp Test Maintainability is instructions for the agent only.

Does Exp Test Maintainability access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Exp Test Maintainability safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Exp Test Maintainability use?

Exp Test Maintainability is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Exp Test Maintainability use?

About 2.5k tokens (SKILL.md is roughly 9.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Exp Test Maintainability?

Skills that share tags, products or a category with Exp Test Maintainability: Raven Test Triage (marinasundstrom/raven, 108 stars), Corvus Build And Test (corvus-dotnet/Corvus.JsonSchema, 199 stars), ScottPlot Test Runner (ScottPlot/ScottPlot, 6.8k stars) and Testing Guide (fullstackhero/dotnet-starter-kit, 6.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Exp Test Maintainability?

dotnet (a GitHub organization, an official publisher) maintains it in dotnet/skills, which has 5,568 GitHub stars. The repository holds 91 skills in this directory. The repository was last updated on October 7, 2026.

Source: dotnet/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.