harness:test-driven-development

Enforce RED-GREEN-REFACTOR cycles with failing tests before production code.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Prevents shipping unreliable code by forcing a failing test first, then implementing the minimum code needed to make that test pass.

Core Features & Use Cases

  • Test-first discipline: Ensures every new feature, bugfix, or refactor is preceded by a failing test that validates real behavior.
  • Red-Green-Refactor loop: Drives a strict cycle of watch it fail, implement minimally, verify everything passes, then clean up without adding behavior.
  • Acceptance-criteria traceability: Uses the current building feature’s features.json acceptance_criteria as the source for what the tests must cover, and enforces mapping via evaluation rules.

Use case: When you’re implementing a rate-limit change, write tests that directly map to each acceptance criterion (e.g., 6th request rejected with 429 and Retry-After), then implement only what those tests require.

Quick Start

Tell your AI to write a failing test that maps to the current building feature’s acceptance_criteria in features.json, verify the test fails, then implement the smallest code change to make it pass and re-run the test suite.

Frequently Asked Questions about harness:test-driven-development

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

FAQPage Schema
How do I enforce test-driven development when writing new features?

Test-driven development is enforced by requiring a failing test before writing production code, ensuring every feature is validated by real behavior. You write a test that fails, implement the minimum code to pass it, and then refactor.

What is the red-green-refactor cycle in automated testing?

The red-green-refactor cycle is a strict testing loop: watch the test fail, implement minimally to make it pass, then clean up without adding behavior. This ensures every code change is directly driven by test validation.

How do I map unit tests to acceptance criteria for a new feature?

Unit tests map to acceptance criteria by using the feature's acceptance_criteria as the source for test coverage. Each test must directly validate a specific criterion, ensuring traceability from requirements through implementation.

Why write a failing test before fixing a bug?

Writing a failing test before fixing a bug validates that the test fails for the expected reason, proving the bug exists. You then implement the smallest code change to make it pass, preventing future regressions.

Does test-driven development work for refactoring existing code?

Test-driven development works for refactoring by ensuring behavior is validated before changes. You write failing tests that capture current expected behavior, refactor the code, and verify the tests still pass with pristine output.

When should I not use the test-first approach for development?

You should not use test-first development when behavior cannot be clearly validated or when acceptance criteria are undefined. The approach requires explicit verification that failures happen for expected reasons and implementations pass tests.