test-driven-development

Enforce failing tests before implementation with per-repo test commands and trace.jsonl logging.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents untested production code by enforcing a test-first workflow so features, bug fixes, and refactors are validated before implementation. It eliminates the common failure modes of tests-written-after and unverified "works on my machine" changes, reducing regressions and technical debt.

Core Features & Use Cases

  • TDD Workflow Enforcement: Walks engineers through RED → GREEN → REFACTOR cycles and insists on watching tests fail before implementing.
  • Test Command Resolution: Guides resolving the correct project-specific test command from .superharness/spec or repository manifests to enable precise single-test execution.
  • Trace Logging & Verification: Requires logging implement:tdd_red and implement:tdd_green events to trace.jsonl for auditability and mandates verifying failures are real failures and passes are pristine.
  • Anti-Pattern Guardrails: Provides checks and references to avoid testing mock behavior, adding test-only production methods, and other common testing anti-patterns.
  • Use Cases: New feature development, bug fixes, refactors, and behavior changes where proof of testing discipline and reproducible verification are required.

Quick Start

Begin a TDD cycle for the feature "add user authentication" by writing a failing test first, resolving the repository test command, running that single test to confirm failure, implementing minimal code to make it pass, and logging the red/green events to trace.jsonl.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I enforce a test-first development workflow for new features and bug fixes?

Test-first development is enforced by walking engineers through RED, GREEN, and REFACTOR cycles, requiring a failing test to be written and verified before any implementation begins. This prevents untested production code and reduces regressions.

What is the red-green-refactor cycle and how does it validate code changes?

The red-green-refactor cycle validates code by first running a single test to confirm it fails (red), implementing minimal code to make it pass (green), and then refactoring. It mandates verifying that failures are real and passes are pristine.

How do I resolve the correct test command for single-test invocations in my repository?

Resolve the repository test command by checking project specifications or repository manifests like .superharness/spec. This enables precise single-test invocations for fast red and green loops during development.

How do I log test-driven development events for auditability?

Log test-driven development events by writing implement:tdd_red and implement:tdd_green records to trace.jsonl. This provides strict auditability for your test-first workflow and verifies that tests failed and passed appropriately.

What testing anti-patterns should I avoid during unit testing?

Avoid testing mock behavior and adding test-only production methods during unit testing. Guardrails help check for these common anti-patterns to ensure your tests validate real features rather than mock implementations.

Can I use test-driven development for refactoring existing code?

Yes, you can use test-driven development for refactors and behavior changes. It insists on watching tests fail before implementing changes, ensuring your refactoring efforts are validated by automated tests and reproducible verification.