test-driven-development

Guides implementation of code changes using the red-green-refactor test-driven development cycle.

Updated Mar 14, 2026
One-click install
npx skills add https://github.com/yourlabpt/yourlabpt_website --skill test-driven-development-yourlabpt
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/yourlabpt/yourlabpt_website/tree/main/projects/skills/test-driven-development
Command: npx skills add https://github.com/yourlabpt/yourlabpt_website --skill test-driven-development-yourlabpt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code changes made without tests ship unverified behavior, and bug fixes without reproduction tests leave regressions undetected. This Skill enforces a disciplined workflow where every behavior change is proven by a failing-then-passing test. ## Core Features & Use Cases - Red-Green-Refactor Loop: Write a failing test first, implement the minimal code to pass it, then refactor with tests as a safety net. - Prove-It Pattern for Bugs: Reproduce any reported bug with a failing test before attempting a fix, guaranteeing the fix actually works. - Stack Discovery: Detects the repository's own test commands and frameworks (npm, Gradle, pytest, Cargo, Go) instead of assuming defaults. - Use Case: A bug report says completing a task doesn't set its timestamp. Write a failing test that asserts completedAt is set, watch it fail, implement the fix, watch it pass, then run the full suite to confirm no regressions. ## Quick Start Ask the agent to implement a new feature or fix a bug using test-driven development, writing a failing test before any implementation code.

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 when fixing a bug?▼

Write a test that reproduces the bug first and confirm it fails, then implement the fix and confirm the test passes. Finally run the full test suite to verify no regressions were introduced.

How do I find the right test command for a repository?▼

Inspect the project's build files such as package.json, pom.xml, pyproject.toml, go.mod, or Cargo.toml, and prefer checked-in wrappers like ./gradlew or make test. README, CONTRIBUTING, and CI workflows show the commands that actually gate merges.

Should I use mocks or real implementations in unit tests?▼

Prefer real implementations first, then fakes, stubs, and mocks last. Reserve mocks for dependencies that are too slow, non-deterministic, or have uncontrollable side effects like external APIs or email sending.

When should I not use test-driven development?▼

Skip TDD for pure configuration changes, documentation updates, or static content changes with no behavioral impact. Any change that alters logic or behavior should be covered by a test written first.

Why do my tests break every time I refactor code?▼

Tests that verify internal method calls or implementation details break on refactoring even when behavior is unchanged. Assert on inputs and outputs (state) rather than interaction sequences to keep tests resilient.