test-driven-development

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

665|3|Updated Sep 12, 2026
One-click install
npx skills add https://github.com/rizqinrr/viserys-agent --skill test-driven-development-rizqinrr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/rizqinrr/viserys-agent/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/rizqinrr/viserys-agent --skill test-driven-development-rizqinrr

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 red-green-refactor workflow so 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 minimum code to pass, then refactor with tests staying green. - 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 runner (npm, Gradle, pytest, Cargo, Go) instead of assuming a default command. - Test Quality Guidance: Covers the test pyramid, DAMP over DRY, state-based assertions, and mock-avoidance heuristics. - 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, and confirm the test passes with the full suite green. ## Quick Start Use the test-driven-development skill to implement this feature by writing a failing test first, then the minimal code to make it pass.

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 and confirm it fails before touching the fix. Then implement the minimal change until the test passes, and run the full suite to check for regressions. This Prove-It Pattern guarantees the fix works and guards against regression.

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 minimum code to make it pass. Refactor means cleaning up the implementation while keeping all tests green, then repeating the loop.

Should I use mocks or real implementations in unit tests?

Prefer real implementations first, then fakes, stubs, and mocks last. Mocks that verify internal method calls break during refactoring even when behavior is unchanged. Reserve mocks for slow, non-deterministic, or side-effecting dependencies like external APIs.

When should I not write tests for a change?

Skip tests only for pure configuration changes, documentation updates, or static content with no behavioral impact. Any change to logic, behavior, or edge-case handling should have a corresponding test written first.

Why do my tests pass on the first run during TDD?

A test that passes immediately proves nothing and likely isn't testing what you think. Verify the test fails for the right reason before implementing, since a passing-first test may assert the wrong behavior or never execute the code under test.