test-driven-development

Enforces test-first development using the red-green-refactor cycle for features and bugfixes.

Updated Sep 11, 2026
One-click install
npx skills add https://github.com/CYRUS-pinto/pi-bot --skill test-driven-development-cyrus-pinto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/CYRUS-pinto/pi-bot/tree/main/.agents/skills/test-driven-development
Command: npx skills add https://github.com/CYRUS-pinto/pi-bot --skill test-driven-development-cyrus-pinto

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-driven development discipline so every feature and bugfix is backed by a test that was watched failing first. ## Core Features & Use Cases - Red-Green-Refactor Workflow: Guides writing a failing test, verifying the failure, implementing minimal code, and refactoring while staying green. - 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 assert real behavior instead of mocks, mirror assertions, or change detectors. - Use Case: When fixing a bug where an empty email is accepted, write a failing test asserting the rejection error, watch it fail, implement the minimal validation, and confirm the suite passes. ## Quick Start Ask the agent to implement a new 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 for a new feature?

Write one minimal failing test describing the desired behavior, run it to confirm it fails for the expected reason, then write the simplest code that passes. 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, then run it to watch it fail. Implement the minimal fix, confirm the test passes, and keep it as a regression guard so the bug cannot return.

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. Tests should assert the real component's observable behavior, mocking only slow or external dependencies while keeping the side effects the test depends on real.

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 biases the tests toward the existing code, so they may pass immediately without proving they catch real bugs.