test-driven-development

Guides test-first development using the RED-GREEN-REFACTOR cycle across any language or test framework.

Updated Aug 11, 2026
One-click install
npx skills add https://github.com/Kunj-Sharma03/agent-contextify --skill test-driven-development-kunj-sharma03
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Kunj-Sharma03/agent-contextify/tree/main/templates/skills/test-driven-development
Command: npx skills add https://github.com/Kunj-Sharma03/agent-contextify --skill test-driven-development-kunj-sharma03

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code changes without tests ship unverified behavior, and bug fixes without reproduction tests leave regressions unguarded. This Skill enforces a disciplined write-the-test-first workflow so every behavior change is proven by a failing-then-passing test. ## Core Features & Use Cases - RED-GREEN-REFACTOR Cycle: Write a failing test, 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 conventions (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 asserting completedAt is set, confirm it fails, implement the fix, and watch it pass — the regression is now permanently guarded. ## Quick Start Ask the agent to implement a new feature or fix a bug using test-driven development, writing a failing test first 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 on a bug fix?

Write a test that reproduces the bug first and confirm it fails, then implement the fix and confirm the test passes. This Prove-It Pattern guarantees the bug actually existed and the fix actually resolves it, while permanently guarding against regression.

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

Inspect the project's 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 actually gate merges.

Should tests use mocks or real implementations?

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, since over-mocking creates tests that pass while production breaks.

When should I not write tests first?

Skip TDD for pure configuration changes, documentation updates, or static content with no behavioral impact. Any change affecting logic, behavior, or edge cases should begin with a failing test.

Why do tests that pass immediately indicate a problem?

A test that passes on the first run proves nothing — it may not exercise the intended behavior at all. The RED step of TDD exists specifically to confirm the test actually fails before the implementation exists, validating the test itself.