Generates test data builders, factories, and object mothers for C#/.NET, TypeScript/JavaScript, Python, Java/Kotlin, and Go. Reduces brittle, repetitive test setup by creating fluent builders with sensible defaults.
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.
Generate builders/factories (and object mothers) so tests construct valid domain objects in one readable line, with only the fields that matter to each test made explicit.
Works on a target: a class/file, folder, project, or GitHub URL (clone first: git clone --depth 1 <url> /tmp/repo). Read the domain types and the existing tests to see the real setup pain: repeated constructor calls / object literals, copy-pasted fixtures, invalid objects built by bypassing factories.
| Manifest | Stack | Hand-written pattern | Libraries (use if present or a good fit) |
|---|---|---|---|
*.csproj | C# / .NET | fluent builder + object mother | Bogus, AutoFixture |
package.json | TS / JS | factory function with overrides | fishery, @faker-js/faker |
pyproject.toml, requirements*.txt | Python | factory function / pytest fixture | factory_boy, Faker, polyfactory (Pydantic/dataclasses) |
pom.xml, build.gradle(.kts) | Java / Kotlin | builder class (Java), data class defaults + copy (Kotlin) | Instancio, Datafaker |
go.mod | Go | builder or functional options returning a struct | gofakeit |
Find setup duplication, e.g.:
grep -rn "new Order(\|new Order {" --include=*Tests.cs <target>
grep -rnE "const \w+ = \{|new \w+\(" --include=*.{test,spec}.ts <target> | grep -v node_modules
grep -rnE "^\s+\w+ = \w+\(" --include=test_*.py <target>
If the project already uses a library (Bogus, fishery, factory_boy, Instancio), extend that rather than introducing another.
WithoutLines()), never by accident.Orders.Confirmed(), orderFactory.confirmed(), OrderFactory(confirmed=True).build() for unit tests; create()/save helpers only for integration tests.public class OrderBuilder
{
private Guid _customerId = Guid.NewGuid();
private OrderStatus _status = OrderStatus.Pending;
private readonly List<OrderLine> _lines = new() { new("SKU1", 1) };
public OrderBuilder ForCustomer(Guid id) { _customerId = id; return this; }
public OrderBuilder WithStatus(OrderStatus s) { _status = s; return this; }
public OrderBuilder WithLines(params OrderLine[] l) { _lines.Clear(); _lines.AddRange(l); return this; }
public Order Build() => Order.Create(_customerId, _lines).Value with { Status = _status };
public static implicit operator Order(OrderBuilder b) => b.Build();
}
public static class Orders // object mother
{
public static Order Pending() => new OrderBuilder();
public static Order Confirmed() => new OrderBuilder().WithStatus(OrderStatus.Confirmed);
}
// test: only what matters is explicit
Order order = new OrderBuilder().WithStatus(OrderStatus.Confirmed);
Faker<T> with RuleFor, UseSeed(...)) for realistic values in bulk; use CustomInstantiator to go through the domain factory.fixture.Build<T>().With(...).Create()); combine with builders for the parts you do care about. Can fight private setters and invariants - prefer builders for rich domain types.import { Factory } from "fishery";
import { faker } from "@faker-js/faker";
class OrderFactory extends Factory<Order> {
confirmed() { return this.params({ status: "confirmed" }); }
}
export const orderFactory = OrderFactory.define(({ sequence }) => ({
id: `order-${sequence}`,
customerId: faker.string.uuid(),
status: "pending",
lines: [{ sku: "SKU1", qty: 1 }],
}));
const order = orderFactory.confirmed().build({ customerId: "c1" });
Without a library, a factory function makeOrder(overrides: Partial<Order> = {}): Order => ({ ...defaults, ...overrides }) is often enough. Call faker.seed(n) for reproducible runs. If Order is a class with invariants, build through its constructor/factory (fishery's onCreate/after-build hooks or a plain function).
import factory
class OrderFactory(factory.Factory):
class Meta:
model = Order
id = factory.Sequence(lambda n: n + 1)
customer_id = factory.Faker("uuid4")
status = "pending"
lines = factory.LazyFunction(lambda: [OrderLine("SKU1", 1)])
class Params:
confirmed = factory.Trait(status="confirmed")
order = OrderFactory(confirmed=True, customer_id="c1")
Use factory.django.DjangoModelFactory / factory.alchemy.SQLAlchemyModelFactory when persisting in integration tests; OrderFactory.build() stays in memory. For Pydantic models or dataclasses, polyfactory generates valid instances from type hints. Expose common objects as pytest fixtures that call the factory.
withX(...) methods whose build() calls the domain constructor/factory; an object mother class with static named scenarios. Instancio fills whole object graphs (Instancio.of(Order.class).set(field(Order::getStatus), CONFIRMED).create()) for "don't care" data; Datafaker for realistic values.fun anOrder(status: OrderStatus = PENDING, lines: List<OrderLine> = listOf(defaultLine())) = Order.create(...) with default arguments usually replaces a builder; copy(...) for variants of data classes.type OrderBuilder struct{ o Order }
func AnOrder() *OrderBuilder {
return &OrderBuilder{o: Order{ID: uuid.NewString(), Status: StatusPending, Lines: []Line{{SKU: "SKU1", Qty: 1}}}}
}
func (b *OrderBuilder) WithStatus(s Status) *OrderBuilder { b.o.Status = s; return b }
func (b *OrderBuilder) Build() Order { return b.o }
order := AnOrder().WithStatus(StatusConfirmed).Build()
Functional options (NewTestOrder(WithStatus(StatusConfirmed))) work equally well. Use gofakeit for realistic values and seed it for reproducibility. If the type has a validating constructor, Build() should call it and t.Fatal on error via a helper taking testing.TB.
## Detected
<stack, existing test data approach, library recommendation and why>
## Builders / factories
<generated code, one per type, plus object mother / traits>
## Before / after
<one existing test rewritten to use the builder>
## Notes
<invariants respected, seeding, what still needs persistence helpers>
"Generate a test data builder for Order", "fishery factories for these types", "factory_boy factories for my Django models", "reduce my test setup boilerplate", "object mothers for these domain types", "builders vs AutoFixture for this". Pairs with unit-test-generator and integration-test-setup.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
TypeScript, JavaScript, Python, Go, .NET
45 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./ai-dev-toolkit:test-data-builder-generatorfrom AI for Developers Toolkit
npx claudepluginhub stefanthecode/ai-for-developers --plugin ai-dev-toolkitOther plugins' skills for the same job