Engineering
test-driven-development avatar

test-driven-development

Enforces strict Test-Driven Development (TDD) cycles: RED-GREEN-REFACTOR. Ensures production code is always backed by failing tests first.

Introduction

The test-driven-development skill is a core engineering methodology designed to replace ad-hoc coding with a systematic, verification-first approach. It is intended for software engineers and coding agents who need to maintain high code quality, reduce regression risks, and ensure that every production change is grounded in specific, verifiable behavior. By enforcing the Red-Green-Refactor cycle, this skill prevents the common pitfall of writing implementation code before verifying the requirement, ensuring that the software agent validates its assumptions before committing to any logic.

  • Implements the strict Red-Green-Refactor workflow: writing a minimal failing test (Red), creating the simplest implementation to pass the test (Green), and cleaning up code while maintaining test pass status (Refactor).

  • Enforces the iron law of No Production Code Without A Failing Test First, mandating the deletion of code written before its corresponding test to ensure unbiased verification.

  • Provides clear heuristics for writing effective tests, including minimal test scope, clear naming conventions, and behavior-driven design rather than implementation-focused testing.

  • Integrates with standard CLI test runners like npm test to verify failure, pass, and regression status in real-time.

  • Reduces technical debt by forcing automated documentation of behavior, enabling safe refactoring, and preventing the accumulation of untested or broken features.

  • Always activate this skill for new features, bug fixes, behavior changes, and refactoring tasks to ensure comprehensive coverage.

  • Exceptions to the methodology, such as throwaway prototypes or configuration files, should be negotiated with a human partner to maintain process integrity.

  • Use minimal, focused tests that demonstrate a single behavior; avoid over-engineering or mock-heavy testing patterns that obscure true code intent.

  • Verify the test fails correctly before writing implementation; if a test passes immediately, it suggests the behavior is already present or the test is incorrectly scoped.

  • Treat the test suite as the primary source of truth for the codebase; if logic changes, update tests first to reflect the new requirements.

  • High-recall keywords for retrieval: TDD, red-green-refactor, test-driven, software testing, unit tests, regression testing, code quality, automated verification, agile development, implementation plan, test coverage, debugging, software architecture.

Repository Stats

Stars
170,780
Forks
15,077
Open Issues
285
Language
Shell
Default Branch
main
Sync Status
Idle
Last Synced
Apr 28, 2026, 11:20 AM
View on GitHub