test-driven-development

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

Updated Jan 31, 2023
One-click install
npx skills add https://github.com/Briian3306/Transporte --skill test-driven-development-briian3306
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Briian3306/Transporte/tree/main/.agents/skills/test-driven-development
Command: npx skills add https://github.com/Briian3306/Transporte --skill test-driven-development-briian3306

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 verified by a failing test before implementation begins. ## Core Features & Use Cases - Red-Green-Refactor Enforcement: Guides the full cycle of writing a failing test, verifying it fails for the right reason, writing minimal code to pass, and refactoring while staying green. - 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 that name the break they catch, exercise real code instead of mocks, and pass a mutation check. - 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 that makes it pass. Refactor only while all tests stay green, then repeat for the next behavior.

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

Write a test that reproduces the bug by asserting the correct behavior, such as expecting an error for empty input. Run it to watch it fail, implement the minimal fix, and confirm the test passes along with the rest of the suite.

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 from your human partner. Exploratory code is allowed if it is deleted and rewritten test-first.

Why should tests avoid asserting on mocks?▼

A mock assertion only proves the mock exists, not that the component works. Tests should assert the real component's observable behavior, mocking only slow or external dependencies while mirroring their 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 or adapting it biases the tests toward the existing code, so you never prove the test can catch the bug.