test-driven-development

Enforces red-green-refactor test-driven development workflow for writing code with failing tests first.

Updated Jan 2, 2025
One-click install
npx skills add https://github.com/mcinnisd/gymbro --skill test-driven-development-mcinnisd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/mcinnisd/gymbro/tree/main/.agents/skills/test-driven-development
Command: npx skills add https://github.com/mcinnisd/gymbro --skill test-driven-development-mcinnisd

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Developers often write production code before tests, producing tests that pass immediately and prove nothing about correctness. This Skill enforces a strict test-first discipline so every behavior is verified by a test that was watched failing before implementation. ## Core Features & Use Cases - Red-Green-Refactor Enforcement: Guides the full TDD cycle — write a failing test, verify it fails for the right reason, write minimal code to pass, then refactor while staying green. - Rationalization Detection: Lists common excuses for skipping TDD (e.g., "too simple to test", "I'll test after") and counters each with corrective guidance. - Test Quality Rules: A companion reference defines how to write honest tests — name the break each test catches, assert on real behavior instead of mocks, and run a mutation check before finishing. - 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 Ask the AI to implement a new feature or bug fix 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 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 before the code exists?

Write the test against the API you wish existed, with a clear name and a hand-derived expected value. Run it and confirm it fails because the feature is missing, not because of a typo or setup error.

When is it acceptable to skip test-driven development?

Only for throwaway prototypes, generated code, or configuration files, and only after confirming with your human partner. Exploration is fine, 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 was present, 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 during testing, which is testing after the fact and proves nothing about the test's validity.