tdd

Writes a failing regression test before fixing a bug, then verifies it passes after the fix.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Bug fixes often ship without proof that the bug is actually resolved or that it will not regress later. This Skill enforces a test-driven bug-fixing workflow where the broken behavior is made executable as a failing test before any production code changes, giving concrete evidence the fix works. ## Core Features & Use Cases - Failing-Test-First Workflow: Guides a six-step process from understanding the bug through writing a failing regression test, fixing the code, and rerunning the test to confirm it passes. - Practical Fallbacks: When a real test is impractical (expensive harness, brittle mocks, slow end-to-end infrastructure), it substitutes the closest executable regression check such as a targeted script, manual reproduction command, or log assertion. - Guardrails Against Bad Tests: Prevents weakening existing assertions, mirroring implementation details in tests, or adding broad fixture churn unrelated to the bug. - Use Case: A user reports that canceling a run leaves orphaned child jobs. The Skill writes a focused unit test reproducing the orphan behavior, confirms it fails, applies the minimal fix, and confirms the test now passes. ## Quick Start Ask the AI to fix this bug using TDD by writing a failing regression test first, then making the minimal code change until the test passes.

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 focused test that reproduces the bug and confirm it fails for the intended reason. Then make the minimal production change that satisfies the intended behavior and rerun the test to confirm it passes.

How to write a regression test for a bug fix?▼

Encode the intended behavior in the narrowest executable check for the affected codepath, not a mirror of the current implementation. Verify it fails before the fix and passes after, keeping the test focused on the specific bug.

When should I skip writing a failing test for a bug?▼

Skip when the test would require broad harness setup, brittle mocks, slow end-to-end infrastructure, production-only state, or vague reproduction steps. Use the closest executable regression check instead, such as a targeted script or log assertion.

What if my regression test passes before the fix is applied?▼

A test that passes before the fix does not reproduce the bug. Correct the test or the reproduction steps until it fails for the intended reason before editing any production code.

Should I change existing tests to match a buggy implementation?▼

No. Do not change tests merely to match a wrong implementation or weaken existing assertions unless the expected behavior has genuinely changed and the reason is clear.