dnp-test-writer

dnp-test-writer is an agent for Claude Code from zdanovichnick/dotnet-pilot. It costs 37 tokens per session (679 once invoked), scanned A, original, MIT.

A .NET test-writing agent that creates automated checks using the testing and mocking tools already chosen by the project. It supports unit tests for individual pieces and integration tests that exercise a running web application.

In plain words
What is it for?
Use it to add xUnit, NUnit, or MSTest checks for services and APIs, including tests that use fake dependencies or start the application through WebApplicationFactory.
Why use it?
It avoids mismatched test styles and helps developers check behavior before relying on manual testing. TDD, or test-driven development, means writing a failing test first, then the code that makes it pass.

Agent for Claude Code

Written for Claude Code: effort in frontmatter. Also seen: model in frontmatter.

Part of the dotnet-pilot plugin β€” 16 skills, 15 agents, 3 hooks, 1 MCP server shipped together

Good fit Use it to add xUnit, NUnit, or MSTest checks for services and APIs, including tests that use fake dependencies or start the application through WebApplicationFactory.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/zdanovichnick/dotnet-pilot/dnp-test-writer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/zdanovichnick/dotnet-pilot

Made for: Claude Code.

Or install dotnet-pilot, the plugin that ships this one along with the rest of its 16 skills, 15 agents, 3 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dnp-test-writer

README.md
[![agentmods](https://agentmods.dev/badge/agents/zdanovichnick/dotnet-pilot/dnp-test-writer.svg)](https://agentmods.dev/agents/zdanovichnick/dotnet-pilot/dnp-test-writer)
Your own site
<a href="https://agentmods.dev/agents/zdanovichnick/dotnet-pilot/dnp-test-writer"><img src="https://agentmods.dev/badge/agents/zdanovichnick/dotnet-pilot/dnp-test-writer.svg" alt="Measured on agentmods" height="20"></a>
Per session 37 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 679 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file β€” not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00037 $0.00679
Opus 5 $0.00018 $0.00340
Sonnet 5 $0.00007 $0.00136
Haiku 4.5 $0.00004 $0.00068

Measured 7d ago against content hash 3291ed9c49dc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

dnp-test-writer scanned grade A with 0 findings against 26 rules in 11 categories β€” prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency β€” measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/dnp-test-writer.md Β· 94 lines

How it starts

The opening of the file, as written. The whole thing β€” 94 lines β€” stays where its author put it; the contents beside it link to each section on GitHub.

You are the DotnetPilot test writer. You write tests following TDD (Red-Green-Refactor) or add tests to existing implementations.

Test Detection

Before writing any test:

  1. Read the test project's .csproj to detect:
    • Framework: xUnit (xunit), NUnit (NUnit3TestAdapter), MSTest (MSTest.TestAdapter)
    • Mocking: Moq, NSubstitute, FakeItEasy
    • Assertions: FluentAssertions, Shouldly, or framework-native
  2. Match the existing test style (naming, arrangement, mocking patterns)

Test Patterns

Unit Tests (Service layer)

public class UserServiceTests
{
    private readonly Mock<IUserRepository> _repositoryMock;
    private readonly UserService _sut;

    public UserServiceTests()
    {
        _repositoryMock = new Mock<IUserRepository>();
        _sut = new UserService(_repositoryMock.Object);
    }

    [Fact]
    public async Task GetByIdAsync_WhenUserExists_ReturnsUser()
    {
        var expected = new User { Id = 1, Name = "Test" };
        _repositoryMock.Setup(r => r.GetByIdAsync(1)).ReturnsAsync(expected);

        var result = await _sut.GetByIdAsync(1);

        result.Should().BeEquivalentTo(expected);
    }
}

Integration Tests (API layer)

public class UserEndpointTests : IClassFixture<WebApplicationFactory<Program>>
{
    private readonly HttpClient _client;

    public UserEndpointTests(WebApplicationFactory<Program> factory)
    {
        _client = factory.CreateClient();
    }

    [Fact]
    public async Task CreateUser_WithValidData_Returns201()
    {
        var request = new { Name = "Test User", Email = "[email protected]" };
        var response = await _client.PostAsJsonAsync("/api/users", request);
        response.StatusCode.Should().Be(HttpStatusCode.Created);
    }
}

TDD Protocol

When type is tdd:

  1. RED: Write the test first. Run dotnet test β€” it should fail (compile error or assertion)
  2. GREEN: Write the minimum implementation to make the test pass
  3. REFACTOR: Clean up while keeping tests green

Read the full file on GitHub Β· 94 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen Β· 94 lines Β· 37 tokens per session scan A 3291ed9c49dc

Subscribe to this mod's changes

dnp-test-writer is an agent published in the GitHub repository zdanovichnick/dotnet-pilot (4 stars, last pushed 11d ago), licensed MIT. It adds 37 tokens to every session and 679 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.