/dotnet-ai-kit:add-testsfrom dotnet-ai-kit
Scans .NET code for untested classes, handlers, and controllers, then generates missing unit/integration tests. Detects test framework, mocking library, and follows existing patterns.
Ships in dotnet-ai-kit. Installing the plugin adds it to Claude Code.
Scan existing code for classes, handlers, and controllers without test files and generate missing tests. Detects the test framework, mocking library, and follows existing test patterns.
/dotnet-ai.add-tests $ARGUMENTS
Examples:
OrderService -- Generate tests for a specific class--handlers -- Generate tests for all MediatR handlers--coverage 80 -- Generate tests until estimated 80% coverage--dry-run -- Show what tests would be generated--list -- Show file list only--verbose -- Show scanning and detection details| Flag | Description |
|---|---|
--handlers | Target all MediatR/CQRS handlers only |
--controllers | Target all controllers only |
--services | Target all service classes only |
--coverage {N} | Generate tests targeting N% coverage estimate |
--dry-run | Display generated test code without writing |
--list | List test files that would be created with descriptions, no code output |
--verbose | Show scanning progress, pattern detection, coverage estimates |
--no-build | Skip post-generation build and test run |
.csproj with test SDK reference).
[Fact], [Theory], Xunit namespace[Test], [TestCase], NUnit.Framework[TestMethod], [TestClass], Microsoft.VisualStudio.TestToolsMock<T>, Moq namespaceSubstitute.For<T>, NSubstitute namespaceA.Fake<T>, FakeItEasy namespace{Class}Tests, {Class}Should, When{Action}_{Result})CustomConstructorFaker, Bogus Faker<T>){Handler}Tests.cs{Controller}Tests.cs{Service}Tests.cs--handlers, --controllers, specific class name)Read agents/test-engineer.md for testing patterns. Also read the project's primary architect agent for architecture context:
agents/command-architect.mdagents/query-architect.mdagents/cosmos-architect.mdagents/processor-architect.mdagents/gateway-architect.mdagents/controlpanel-architect.mdagents/command-architect.md and agents/query-architect.mdagents/dotnet-architect.mdBounded skill selection (FR-012): keep one architect agent for the project type loaded, load at most 2 task-specific skills initially, and run MCP queries (codebase-memory-mcp) before broad file reads.
skills/testing/unit-testing -- unit test structure, assertions, mocking patternsskills/testing/integration-testing -- integration test setup, WebApplicationFactoryskills/testing/test-fixtures -- shared fixtures, test data builders, fakers--coverage {N} specified: prioritize by impact (handlers first, then services, then controllers)For Handlers:
Test/Commands/{Handler}Tests.cs or matching existing structureFor Controllers/Endpoints:
Test/Controllers/{Controller}Tests.csFor Services:
Test/Services/{Service}Tests.csFor Validators:
Test/Validators/{Validator}Tests.csTest/Integration/{Feature}IntegrationTests.csWebApplicationFactory or custom test server pattern from existing testsdotnet build on test project -- verify compilation.dotnet test -- verify generated tests pass.Generated {N} test files with {M} test methods.
- Handlers: {X} tested
- Controllers: {Y} tested
- Services: {Z} tested
All tests passing.
--dry-run: Show generated test code with file headers. No writes.--list: List test files that would be created with class counts. No code, no writes.Graph/dependency/ownership/architecture questions: query codebase-memory-mcp first; use csharp-ls for symbol-precise lookups; grep/file reads only as last resort.
If MCP is unavailable, emit exactly:
MCP unavailable: codebase-memory-mcp is not connected or below >=0.6.1; falling back to csharp-ls + grep/read.
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub faysilalshareef/dotnet-ai-kit --plugin dotnet-ai-kit27 commands in this plugin
/add-aggregateAdd AggregateGenerates an event-sourced aggregate with events. Use when adding a new command-side domain entity./add-crudAdd CRUDGenerates full CRUD stack for an entity. Use when adding complete create/read/update/delete operations./add-endpointAdd EndpointGenerates an API endpoint with request/response. Use when adding a new REST or Minimal API route./add-entityAdd EntityGenerates a query-side entity with handler. Use when adding a new read model for projections./add-eventAdd EventGenerates a domain event type for an aggregate. Use when adding a new event to an existing aggregate./add-pageAdd PageGenerates a Blazor page with data grid. Use when adding a new control panel UI page.Other plugins' commands for the same job