test-driven-development

Guides test-first development using the red-green-refactor cycle for code changes and bug fixes.

Updated May 19, 2026
One-click install
npx skills add https://github.com/LonelyTraderBay/vittrade-flutter --skill test-driven-development-lonelytraderbay
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/LonelyTraderBay/vittrade-flutter/tree/main/.agents/skills/test-driven-development
Command: npx skills add https://github.com/LonelyTraderBay/vittrade-flutter --skill test-driven-development-lonelytraderbay

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code changes made without tests are unverified and fragile. This Skill enforces a test-first workflow so every new behavior, bug fix, or refactor is proven by a failing-then-passing test instead of manual spot checks. ## 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 Bugs: Reproduce any reported bug with a failing test before attempting a fix, creating a permanent regression guard. - Test Quality Guidance: Apply the test pyramid, test size classification, DAMP-over-DRY style, state-based assertions, and a real-over-mocks preference order. - Use Case: A bug report says completing a task does not set its timestamp. Write a reproduction test that fails, implement the fix, watch the test pass, then run the full suite to confirm no regressions. ## Quick Start Ask the agent to implement the next feature or fix the reported bug using 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 on a new feature?

Write a failing test that describes the desired behavior first, then write the minimal code to make it pass, then refactor while keeping tests green. Repeat this red-green-refactor cycle for each increment of functionality.

How do I write a regression test for a bug fix?

Reproduce the bug with a test before fixing anything. Confirm the test fails, proving the bug exists, then implement the fix and confirm the test passes. This creates a permanent guard against the bug returning.

When should I use mocks versus real implementations in tests?

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

When is test-driven development not appropriate?

Skip TDD for pure configuration changes, documentation updates, or static content 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 assert on internal method calls or implementation details break during refactoring even when behavior is unchanged. Assert on inputs and outputs instead, testing state rather than interactions.