test-driven-development

Enforces red-green-refactor test-driven development workflow for features and bugfixes.

Updated Apr 29, 2026
One-click install
npx skills add https://github.com/fred-meng/harness --skill test-driven-development-fred-meng
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/fred-meng/harness/tree/main/.github/skills/test-driven-development
Command: npx skills add https://github.com/fred-meng/harness --skill test-driven-development-fred-meng

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It prevents untested production code by enforcing a strict test-first workflow, eliminating rationalizations that lead to writing implementation before tests and shipping unverified behavior. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Guides writing a failing test, verifying the failure, implementing minimal code, and refactoring while keeping tests green. - Anti-Rationalization Rules: Counters common excuses like "I'll test after" or "deleting code is wasteful" with concrete counterarguments and red flags. - Testing Anti-Patterns Reference: Covers testing mock behavior, test-only production methods, incomplete mocks, and mocking without understanding dependencies. - Use Case: When fixing a bug where empty emails are accepted, write a failing test asserting the rejection error, watch it fail, implement the minimal validation, and confirm all tests pass. ## Quick Start Use the test-driven-development skill to implement this feature by writing a failing test first, then the minimal code to make it pass.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I practice test-driven development on a new feature?

Write one minimal failing test describing the desired behavior, run it to confirm it fails for the right reason, then write the simplest code to pass. Refactor only after all tests are green, then repeat the cycle for the next behavior.

How do I write a failing test for a bug fix?

Write a test that reproduces the bug, such as asserting that an empty email returns an error, and run it to watch it fail. Then implement the minimal fix and verify the test passes along with all existing tests.

Should I write tests before or after implementation code?

Write tests before implementation. Tests written after code pass immediately, which proves nothing about whether they test the right behavior, and they tend to verify the implementation rather than the requirements.

When is it acceptable to skip TDD?

Only for throwaway prototypes, generated code, or configuration files, and only after asking your human partner. Exploration is fine, but the exploratory code should be discarded and rewritten test-first.

Why is testing mock behavior a problem in unit tests?

Asserting on mock elements verifies the mock exists rather than real component behavior, so the test passes for the wrong reason. Test the real component, or mock at a lower level while preserving the side effects the test depends on.