From test-builder
Generate unit tests for functions, classes, or modules — isolated, fast, with edge cases and mocks
How this skill is triggered — by the user, by Claude, or both
Slash command
/test-builder:unit-testsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate unit tests for: **$0**
Generate unit tests for: $0
Framework: $1 (default: vitest)
Read the target code — Understand the function/class signature, dependencies, return types, and side effects.
Identify test cases — For each public function or method:
Design mocks — Identify external dependencies:
Write tests — Follow this structure:
import { describe, it, expect, vi } from "vitest";
import { targetFunction } from "./target";
describe("targetFunction", () => {
// Group by behavior, not by method
describe("when given valid input", () => {
it("returns the expected result", () => {
const result = targetFunction("valid");
expect(result).toEqual(expected);
});
});
describe("when given invalid input", () => {
it("throws a ValidationError", () => {
expect(() => targetFunction("")).toThrow(ValidationError);
});
});
describe("edge cases", () => {
it("handles empty arrays", () => {
expect(targetFunction([])).toEqual([]);
});
});
});
<name>.test.ts colocated or in __tests__/it("returns null when user is not found") not it("test 1")Provides a checklist for code reviews covering functionality, security, performance, maintainability, tests, and quality. Use for pull requests, audits, team standards, and developer training.
npx claudepluginhub silviaare95/xari-plugins --plugin test-builder