tdd

Writes a failing regression test before fixing a bug with a clear test path.

Updated Sep 2, 2026
One-click install
npx skills add https://github.com/jnyross/pstack-muse --skill tdd-jnyross
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/jnyross/pstack-muse/tree/main/skills/tdd
Command: npx skills add https://github.com/jnyross/pstack-muse --skill tdd-jnyross

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Bug fixes often ship without proof that the bug is actually resolved, letting the same defect regress later. This Skill enforces a test-driven bug-fixing workflow: reproduce the broken behavior as a failing test first, then make the smallest production change that turns it green. ## Core Features & Use Cases - Failing-Test-First Workflow: Guides a seven-step process from understanding the bug through writing the failing test, fixing the code, and rerunning validation. - Pragmatic Fallbacks: When a failing test is impractical (expensive harness, brittle mocks, production-only state), it directs you to the closest executable regression check instead of forcing a bad test. - Guardrails Against Bad Tests: Prevents weakening assertions, mirroring broken implementations, or adding tests with weak signal. - Use Case: A user reports that date parsing crashes on leap years. The Skill walks you through writing a focused unit test that fails on the leap-year input, fixing the parser, and confirming the test passes along with nearby validation. ## Quick Start Ask the AI to fix this bug using TDD by first writing a failing regression test that reproduces the issue, then making the minimal fix.

Frequently Asked Questions about tdd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix a bug using test-driven development?

Write the smallest test that reproduces the bug and confirm it fails for the intended reason, then make the minimal production change and rerun the test until it passes. Finish by running nearby tests, type checks, or lint to catch broader risk.

When should I write a regression test for a bug fix?

Write one when the bug has a clear, cheap test target such as an existing unit or integration test for that codepath. Skip it when the test would need broad harness setup, brittle mocks, slow end-to-end infrastructure, or production-only state.

What should I do if a failing test is impractical to write?

Explicitly explain why the failing test is not worth the cost, then use the closest executable regression check such as a targeted script, manual reproduction command, log assertion, or snapshot comparison. Prefer no new test over a bad test that mostly tests mocks.

Why should the test fail before I fix the bug?

A failing-before test proves the test actually captures the bug rather than passing for unrelated reasons. If it passes immediately or fails for the wrong reason, the test or reproduction must be corrected before touching the implementation.

When is TDD the wrong approach for a bug fix?

TDD is the wrong fit when the test path is unclear, expensive, integration-heavy, or not requested, or when the only possible test would encode current implementation details or depend on timing and global state. Use manual or scripted verification instead and state why.