test-driven-development

Implements code changes using the red-green-refactor test-driven development loop.

Updated Apr 6, 2026
One-click install
npx skills add https://github.com/QT-7274/dotfiles --skill test-driven-development-qt-7274
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/QT-7274/dotfiles/tree/main/test-driven-development
Command: npx skills add https://github.com/QT-7274/dotfiles --skill test-driven-development-qt-7274

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code changes made without tests ship unverified behavior, and bug fixes without reproduction tests leave regressions unguarded. This Skill enforces a disciplined workflow where a failing test is written before any implementation, so every behavior change is proven rather than assumed. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Write a failing test first, implement the minimal code to pass it, then refactor with tests staying green. - Prove-It Pattern for Bug Fixes: Reproduce any reported bug with a failing test before attempting a fix, then verify the fix and run the full suite. - Stack Discovery and Test Quality Guidance: Detect the repository's own test runner (npm, Gradle, pytest, go test, Cargo) and apply best practices like the test pyramid, DAMP over DRY, state-based assertions, and real implementations over mocks. - Use Case: A bug report says completing a task doesn't set its timestamp. Write a failing reproduction test confirming the bug, implement the fix, watch the test pass, then run the full suite to confirm no regressions. ## Quick Start Use test-driven development to implement this feature, starting with a failing test before writing 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.

What is the red-green-refactor cycle in TDD?▼

Red means writing a test that fails because the behavior doesn't exist yet. Green means writing the minimal code to make it pass. Refactor means cleaning up the implementation while keeping all tests green.

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

Prefer real implementations first, then fakes, stubs, and mocks last. Mock only when the real dependency is too slow, non-deterministic, or has uncontrollable side effects like external APIs or email sending.

When should I not write tests for a change?▼

Skip tests for pure configuration changes, documentation updates, or static content changes with no behavioral impact. Any change that could alter or break existing behavior should have a corresponding test.

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

Tests that assert on internal method calls or implementation details break during refactoring even when behavior is unchanged. Assert on inputs and outputs (state-based testing) instead of interaction sequences.

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

Check the build files like 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 gate merges.