test-driven-development

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

Updated Aug 5, 2026
One-click install
npx skills add https://github.com/JhonMA82/api-starter --skill test-driven-development-jhonma82
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/JhonMA82/api-starter/tree/main/.agents/skills/test-driven-development
Command: npx skills add https://github.com/JhonMA82/api-starter --skill test-driven-development-jhonma82

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code written before tests often ships untested or with tests that pass immediately and prove nothing. This Skill enforces a strict test-first discipline so every behavior change is backed by a test that was watched failing before implementation. ## Core Features & Use Cases - Red-Green-Refactor Enforcement: Mandates writing a failing test first, verifying it fails for the right reason, then writing minimal code to pass. - Rationalization Detection: Lists common excuses for skipping TDD ("too simple to test", "I'll test after") with concrete rebuttals and red flags that trigger a restart. - Test Quality Rules: A companion reference defines how to write honest tests — naming the break each test catches, avoiding mock assertions, and running a mutation check. - Use Case: When fixing a bug where empty emails are accepted, write a failing test asserting the rejection, watch it fail, implement the minimal validation, and confirm the suite stays green. ## Quick Start Ask the agent to implement your next feature or bugfix using strict test-driven development with a failing test written first.

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 and confirm it fails for the right reason, then write the simplest code that passes. Refactor only while tests stay green, then repeat with the next failing test.

How do I fix a bug using TDD?▼

Write a failing test that reproduces the bug first, then implement the minimal fix until it passes. The test proves the fix works and prevents the bug from regressing later.

When is it acceptable to skip test-driven development?▼

Exceptions are limited to throwaway prototypes, generated code, and configuration files, and only with explicit approval. Exploratory code is allowed if it is deleted and rewritten test-first afterward.

Why should tests avoid asserting on mocks?▼

A mock assertion only proves the mock exists, not that the real component works. Assert on real behavior and mock only slow or external dependencies, mirroring the complete real data structure.

What should I do if I already wrote code before the test?▼

Delete the implementation and start over with a failing test. Keeping it as reference leads to adapting it, which is testing after the fact and proves nothing about the test's validity.