Generates complete, runnable unit tests across C#/.NET, TypeScript/JavaScript, Python, Java/Kotlin, and Go, with proper mocking and edge cases. Use when asked to write tests for a class, service, handler, module, or function.
Ships in AI for Developers Toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Write complete, runnable unit tests for the supplied code - happy paths, edge cases, and failure cases - using Arrange/Act/Assert structure and proper test doubles, in the project's own test framework.
You don't need pasted snippets. Accept any scope and figure out what to test yourself:
git clone --depth 1 <url> /tmp/repo && cd /tmp/repoFor a folder/project, list the units you'll cover and start with the highest-value ones. Skip trivial DTOs/data classes. Always say which files you generated tests for.
| Manifest | Stack | Default framework | Default doubles / asserts |
|---|---|---|---|
*.csproj | C# / .NET | xUnit | NSubstitute + FluentAssertions |
package.json | TS / JS | Vitest (Jest if already present) | vi.fn/vi.mock or jest.fn/jest.mock |
pyproject.toml, requirements*.txt | Python | pytest | unittest.mock / pytest-mock (mocker) |
pom.xml, build.gradle(.kts) | Java / Kotlin | JUnit 5 | Mockito + AssertJ (Kotlin: MockK) |
go.mod | Go | testing (table-driven) | hand-written fakes on interfaces; testify if already used |
Always match what the project already uses - read one existing test file for framework, mocking library, assertion style, naming, and file layout (*Tests.cs, *.test.ts/*.spec.ts, test_*.py, *Test.java, *_test.go). Only ask if there are no tests yet and the choice is genuinely ambiguous.
Find targets and existing coverage, e.g.:
# .NET
grep -rln "public class\|public record\|public sealed class" --include=*.cs <target> | grep -vi "/obj/\|/bin/\|Tests"
# Node / TS
find <target> -name "*.test.ts" -o -name "*.spec.ts" | grep -v node_modules
# Python
find <target> -name "test_*.py" -o -name "*_test.py"
# Java / Kotlin
find <target> -path "*src/test*" -name "*Test.*"
# Go
find <target> -name "*_test.go"
integration-test-setup, not faked.Method_Scenario_Expected (.NET/Java), it("returns failure when customer has no credit") (JS), test_place_order_without_credit_returns_failure (Python), TestPlaceOrder/no_credit subtests (Go).TimeProvider, fake timers, freezegun/time-machine, Clock, a now func()), seed or inject random sources.| Concern | C# / .NET | TS / JS | Python | Java / Kotlin | Go |
|---|---|---|---|---|---|
| Test | [Fact] | it / test | def test_... | @Test | func TestX(t *testing.T) |
| Data-driven | [Theory] + [InlineData]/[MemberData] | it.each / test.each | @pytest.mark.parametrize | @ParameterizedTest + @ValueSource/@CsvSource/@MethodSource | table-driven + t.Run |
| Double | Substitute.For<T>() / new Mock<T>() | vi.fn() / jest.fn(), vi.mock() | Mock(), AsyncMock(), mocker.patch | @Mock / mock(), mockk() | fake struct implementing the interface |
| Verify call | Received(1) / Verify(...) | toHaveBeenCalledWith | assert_called_once_with | verify(...) | assert on fake's recorded calls |
| Expect error | Should().ThrowAsync<T>() / Assert.ThrowsAsync | await expect(...).rejects.toThrow() | with pytest.raises(...) | assertThrows / assertThatThrownBy | if err == nil / errors.Is |
| Setup | constructor / IAsyncLifetime | beforeEach | fixtures | @BeforeEach | helper funcs, t.Cleanup |
Default xUnit + NSubstitute + FluentAssertions; if the project uses Moq, NUnit, MSTest, or built-in Assert, match it.
public class OrderServiceTests
{
private readonly IOrderRepository _repo = Substitute.For<IOrderRepository>();
private readonly IUnitOfWork _uow = Substitute.For<IUnitOfWork>();
private readonly OrderService _sut;
public OrderServiceTests() => _sut = new OrderService(_repo, _uow);
[Fact]
public async Task PlaceOrder_WhenValid_PersistsAndReturnsId()
{
// Arrange
var cmd = new CreateOrderCommand(CustomerId: Guid.NewGuid(), Lines: new() { new("SKU1", 2) });
// Act
var result = await _sut.PlaceOrderAsync(cmd, CancellationToken.None);
// Assert
result.IsSuccess.Should().BeTrue();
await _repo.Received(1).AddAsync(Arg.Any<Order>(), Arg.Any<CancellationToken>());
await _uow.Received(1).SaveChangesAsync(Arg.Any<CancellationToken>());
}
[Theory]
[InlineData(0)]
[InlineData(-1)]
public async Task PlaceOrder_WithNonPositiveQuantity_ReturnsFailure(int qty)
{
var cmd = new CreateOrderCommand(Guid.NewGuid(), new() { new("SKU1", qty) });
var result = await _sut.PlaceOrderAsync(cmd, CancellationToken.None);
result.IsSuccess.Should().BeFalse();
await _repo.DidNotReceive().AddAsync(Arg.Any<Order>(), Arg.Any<CancellationToken>());
}
}
Task, never async void.TimeProvider (or an IClock) instead of DateTime.UtcNow in the unit under test so time is controllable.import { describe, it, expect, vi, beforeEach } from "vitest";
describe("OrderService.placeOrder", () => {
const repo = { add: vi.fn() };
let sut: OrderService;
beforeEach(() => { vi.resetAllMocks(); sut = new OrderService(repo); });
it("persists a valid order", async () => {
const result = await sut.placeOrder({ customerId: "c1", lines: [{ sku: "SKU1", qty: 2 }] });
expect(result.ok).toBe(true);
expect(repo.add).toHaveBeenCalledTimes(1);
});
it.each([0, -1])("rejects quantity %i", async (qty) => {
const result = await sut.placeOrder({ customerId: "c1", lines: [{ sku: "SKU1", qty }] });
expect(result.ok).toBe(false);
expect(repo.add).not.toHaveBeenCalled();
});
});
Prefer constructor-injected fakes over module mocking (vi.mock/jest.mock); use module mocks only when the code imports a dependency directly. Use vi.useFakeTimers() / jest.useFakeTimers() for time.
import pytest
from unittest.mock import AsyncMock
@pytest.fixture
def repo():
return AsyncMock()
async def test_place_order_valid_persists(repo):
result = await OrderService(repo).place_order(customer_id="c1", lines=[("SKU1", 2)])
assert result.ok
repo.add.assert_awaited_once()
@pytest.mark.parametrize("qty", [0, -1])
async def test_place_order_non_positive_qty_fails(repo, qty):
result = await OrderService(repo).place_order(customer_id="c1", lines=[("SKU1", qty)])
assert not result.ok
repo.add.assert_not_awaited()
Async tests need pytest-asyncio or anyio (match the project's marker/config). Use autospec=True / create_autospec so mocks fail on wrong signatures.
JUnit 5 + Mockito (@ExtendWith(MockitoExtension.class), @Mock, @InjectMocks) + AssertJ; @ParameterizedTest with @ValueSource(ints = {0, -1}) for boundaries. Kotlin: MockK (mockk, coEvery, coVerify for coroutines), runTest from kotlinx-coroutines-test. Keep Spring out of unit tests - no @SpringBootTest for pure logic.
func TestPlaceOrder(t *testing.T) {
tests := []struct {
name string
qty int
wantErr bool
}{
{"valid", 2, false},
{"zero qty", 0, true},
{"negative qty", -1, true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
repo := &fakeRepo{}
svc := NewOrderService(repo)
_, err := svc.PlaceOrder(context.Background(), "c1", []Line{{SKU: "SKU1", Qty: tt.qty}})
if (err != nil) != tt.wantErr {
t.Fatalf("err = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
Prefer small hand-written fakes over generated mocks; use testify (require/assert) or gomock only if the project already does. Mark helpers with t.Helper().
## Test plan
<stack + framework detected; bulleted list of the cases you'll cover and why>
## Tests
<the full test file(s), ready to run>
## Not covered here (needs integration tests)
<anything that hits real I/O - flagged, not mocked into meaninglessness>
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/ai-dev-toolkit:unit-test-generatorfrom AI for Developers Toolkit
npx claudepluginhub stefanthecode/ai-for-developers --plugin ai-dev-toolkit45 skills in this plugin
/api-endpoint-scaffolderScaffold HTTP API endpoints in any stack - ASP.NET Core Minimal APIs or controllers, Express, Fastify, NestJS, FastAPI, Django REST Framework, Spring Boot controllers, Go net/http, chi, Gin - one feature per endpoint (REPR style) with request validation, typed responses, route grouping, auth, and OpenAPI metadata. Use this skill whenever the user wants to add an endpoint or route, convert controllers to minimal APIs, structure routes or routers, set up endpoint groups, TypedResults, route handlers, request DTOs/schemas (zod, Pydantic, Bean Validation, binding tags), or asks "how do I add an endpoint / structure my API routes". Always use this skill for endpoint scaffolding; it generates a complete, validated endpoint that matches the project's conventions./architecture-test-generatorGenerate architecture tests / fitness functions that fail the build when architectural rules are violated - layer dependencies, module boundaries, cycles, naming, and visibility conventions - in any stack: NetArchTest or ArchUnitNET (.NET), ArchUnit or Konsist (Java/Kotlin), dependency-cruiser or eslint-plugin-boundaries (TypeScript/JavaScript), import-linter (Python), go-arch-lint or depguard (Go). Use this skill whenever the user wants architecture tests, to enforce layering or the dependency rule, dependency rules as tests, import rules, forbidden imports, no circular dependencies, naming conventions, fitness functions, or asks "how do I stop people breaking the architecture / enforce my layers / keep modules from importing each other". Always use this skill for architecture-test requests; it generates rules matching the project's real structure./async-await-auditorAudit async and concurrent code in any language for correctness and performance bugs - C#/.NET (async/await, Task), JavaScript/TypeScript (Promises, async/await), Python (asyncio), Java/Kotlin (CompletableFuture, virtual threads, coroutines), Go (goroutines, channels, context), Rust (tokio/async). Use this skill whenever the user shares async or concurrent code, or asks about deadlocks, hangs, blocking calls, .Result/.Wait(), async void, ConfigureAwait, floating or unhandled promises, await in a loop vs Promise.all, blocking the event loop, forgotten await, asyncio.gather/TaskGroup, CompletableFuture.join, virtual thread pinning, goroutine leaks, context cancellation, WaitGroup/errgroup, holding a lock across .await, fire-and-forget tasks, cancellation tokens, or "why does my async code hang". Always use this skill for async/concurrency reviews instead of answering from memory; it applies a fixed checklist and rewrites the code./authorization-setupDesign API authorization in any stack - policy-based, role-based, claims/permission-based, and resource-based (ownership) checks. Covers ASP.NET Core policies and AuthorizationHandler, NestJS guards, Express middleware and CASL, FastAPI dependencies/scopes, Django and DRF permission classes, Spring Security (@PreAuthorize, SecurityFilterChain), Go middleware, and Casbin/OPA. Use this skill whenever the user wants authorization policies, role/claim/permission checks, RBAC/ABAC, custom authorization rules, resource-based authorization, IDOR protection, "deny by default", or asks "how do I authorize this / policy vs role / restrict this endpoint to X / stop users seeing other users' data". Always use this skill for authorization requests; it generates policies, handlers, and endpoint wiring./benchmark-setupSet up correct micro-benchmarks in any stack and interpret the results - BenchmarkDotNet (.NET), JMH (Java/Kotlin), pytest-benchmark / pyperf (Python), Vitest bench / tinybench / mitata (JavaScript/TypeScript), Go testing.B + benchstat, Rust criterion. Use this skill whenever the user wants to benchmark code, measure performance, compare two implementations or functions, set up a benchmark harness, or asks "which is faster", "benchmark these two functions", "how do I benchmark this", "is this optimization worth it", or "interpret these benchmark results". Always use this skill for micro-benchmarking requests; it writes correct benchmarks, avoids the classic pitfalls, and explains the numbers./caching-strategy-setupAdd the right caching to an app in any stack - in-process, distributed (Redis/Valkey/Memcached), two-level, or HTTP/output caching - with correct keys, expiration, stampede protection, and invalidation. Covers HybridCache / IMemoryCache / IDistributedCache / output caching in .NET, lru-cache / keyv / cache-manager / ioredis in Node, functools / cachetools / redis-py / Django cache in Python, Spring Cache with Caffeine or Redis in Java/Kotlin, and ristretto / groupcache / singleflight / go-redis in Go. Use this skill whenever the user wants caching, to cache a query/response, Redis caching, @Cacheable, lru_cache, HybridCache, cache-aside, output caching, or asks "how do I cache this / add caching / avoid cache stampede / invalidate this cache". Always use this skill for caching requests; it picks the right layer and wires expiration + invalidation correctly.Other plugins' skills for the same job