tdd

Enforces RED-GREEN-REFACTOR test-driven development with mutation testing at the PR-readiness gate.

Updated May 18, 2024
One-click install
npx skills add https://github.com/joshhornby/dotfiles --skill tdd-joshhornby
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/joshhornby/dotfiles/tree/main/.claude/skills/tdd
Command: npx skills add https://github.com/joshhornby/dotfiles --skill tdd-joshhornby

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It prevents production behavior changes from being written without failing tests first, and stops teams from shipping code whose tests only appear adequate because coverage numbers look high. ## Core Features & Use Cases - RED-GREEN-REFACTOR workflow: Requires a failing behavior test before any production code, minimal implementation to pass, then assessed refactoring under a green safety net. - Fast feedback loop guidance: Directs use of repository-owned watch commands, Vitest changed/related selection, and affected one-shots instead of running the full suite after every edit. - End-of-phase mutation gate: Runs mutation testing once per PR-sized slice, or records explicit N/A with alternate evidence such as contract, integration, or operational proof. - Use Case: When adding a validation rule to a user service, write the failing behavior test first, implement the minimum code, keep the watcher green through refactors, then run the mutation gate before opening the PR. ## Quick Start Ask the agent to implement a new feature or bug fix using strict TDD with a failing test first and a mutation testing check before the PR.

Frequently Asked Questions about tdd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I practice TDD with fast test feedback?

Write one failing behavior test, then keep a single repository-owned watcher running so only affected tests rerun after each edit. Avoid running the full suite after every change; reserve the complete non-watch run for the pre-PR gate.

When should mutation testing run in a TDD workflow?

Run mutation testing once at the end-of-phase PR-readiness gate against the accumulated branch scope, not after every increment. Address valuable surviving mutants within that gate, then finish the remaining PR checks.

Does vitest --changed --watch recompute affected tests on every save?

No. Vitest clears the changed selector after initial selection, so later reruns follow the retained Vite module graph rather than recomputing Git impact. Use it only after a live proof against your installed version and configuration.

When should TDD not be used for a code change?

Pure behavior-preserving refactoring and complexity reduction should not fabricate failing tests; they start from passing preservation evidence and stay green. Plan-only requests should use a planning skill first, and disputed bug fixes return to RED.

Why is a watch-mode test run not valid PR evidence?

Watch mode is an inner-loop accelerator that may cover only affected tests. The pre-PR record must come from a completed non-watch full run against the final tree, including all configured projects in a monorepo.