The guide lays out a repeatable TDD workflow, from identifying the test runner and writing a failing test to implementing the minimum code and refactoring while tests pass. It includes testing principles, anti-patterns, advice for checking whether tests catch mistakes, a reusable test template, and example test commands.
Guides you through the complete TDD workflow with Red-Green-Refactor cycle.
/tdd <ACTION> [ARGUMENTS]
Before the first Red phase, discover the repository's test runner and command from its manifest, task runner, docs, or CI. Do not assume TypeScript, Vitest, npm, or pnpm. Record the exact command used for the red failure and why it failed; a syntax/import error is not a valid Red state.
For risky behavior, name a plausible wrong implementation and choose an input whose expected result differs from it. A test that still passes when the relevant result or side effect is removed does not protect that behavior. Strengthen the observable assertion, not checks of private calls. If no honest automated test is practical, record the missing seam and use a repeatable manual check; do not claim automated regression coverage.
If the project already uses mutation testing, run it on the affected scope when useful. Inspect uncovered paths and surviving mutations against the contract. Add a test for a meaningful missed behavior; do not chase equivalent mutations or a perfect score, install a new tool by default, or delete code solely because coverage did not exercise it.
A test template is available at $SKILL_PATH/templates/test-template.md:
import { describe, it, expect } from "vitest";
import { functionName } from "./module";
describe("functionName", () => {
it("should return formatted output when given valid input", () => {
// Arrange - Setup test scenario
const input = "test input";
const expectedOutput = "expected output";
// Act - Execute the unit under test
const result = functionName(input);
// Assert - Verify expected outcome
expect(result).toBe(expectedOutput);
});
});npm test or pnpm testnpm test --watchnpm test --coverageTest-strength guidance is adapted from Robert C. Martin's
ub-mode — TDD, Test Behavior, and Mutator.
jellydn/my-ai-tools
1524f4a
npmnpm testpnpmpnpm testAlso appears in
since Nov 30, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.