test-driven-development

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

Updated Aug 3, 2026
One-click install
npx skills add https://github.com/Yvesdefaria/GymLab --skill test-driven-development-yvesdefaria
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Yvesdefaria/GymLab/tree/main/.opencode/skills/test-driven-development
Command: npx skills add https://github.com/Yvesdefaria/GymLab --skill test-driven-development-yvesdefaria

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 TDD cycle with mandatory verification that each test fails for the right reason before writing minimal passing code. - Rationalization Detection: Lists common excuses for skipping TDD and the red flags that mean code should be deleted and restarted test-first. - Test Quality Rules: A companion reference defines how to write honest tests that name the break they catch, assert real behavior instead of mocks, and pass a mutation check. - Use Case: When fixing a bug where an empty email is accepted, write a failing test asserting the rejection, 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 and watch it fail for the expected reason, then write the simplest code that makes it pass. Refactor only after all tests are green, then repeat the cycle 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 confirm it fails because the fix is missing, then implement the minimal fix and verify the test passes.

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. Exploration is allowed, but the exploratory code must be discarded and rewritten test-first.

Why should tests avoid asserting on mocks?

A mock assertion only proves the mock exists, not that the real component works. Assert the real component's observable behavior, mock only slow or external dependencies, and mirror the complete real data structure in any mock responses.

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 while writing tests is testing after the fact, which cannot prove the test actually catches the bug.