One-click install
npx skills add https://github.com/sumpalabs/petrodb --skill tdd-sumpalabs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/sumpalabs/petrodb/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/sumpalabs/petrodb --skill tdd-sumpalabs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the common pain points of writing brittle tests that break during code refactors, building unverified features that introduce bugs, and maintaining low-value test suites that don't catch real behavior changes. It reduces rework and production issues by enforcing behavior-focused testing practices.

Core Features & Use Cases

  • Guided TDD Workflow: Walks you through the red-green-refactor cycle step-by-step, from planning to refactoring, with checklists to ensure each cycle follows best practices.
  • Test Quality Rules: Teaches you to write integration-style tests that verify public behavior instead of implementation details, so your test suite survives internal code changes.
  • Anti-Pattern Prevention: Explicitly warns against common mistakes like horizontal slicing (writing all tests before any implementation) that lead to low-value, fragile test suites.
  • Use Case: For example, when adding a new user checkout feature, this Skill guides you to write a single test for the checkout behavior first, implement only the minimal code to pass that test, then refactor safely without breaking existing functionality.

Quick Start

Use the tdd skill to write a failing test for the new user password reset feature before implementing any supporting code.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I write tests that don't break during code refactoring?

To write tests that survive refactoring, you must verify public API behavior instead of coupling tests to internal implementation details. This behavior-focused approach keeps your test suite stable during internal code changes.

What is the red-green-refactor cycle in test-driven development?

The red-green-refactor cycle in test-driven development is a workflow where you write a failing test, implement minimal code to pass it, then safely refactor. This cycle ensures verified feature development and reduces production bugs.

How do I start test-first development for a new software feature?

Start test-first development by writing a single failing test for the new feature's behavior before implementing any supporting code. Then write the minimal code required to pass that test before safely refactoring the design.

Why do my integration tests break when I change internal implementation details?

Integration tests break during internal changes because they are likely coupled to implementation details rather than public behavior. Writing behavior-focused integration tests prevents this brittleness and reduces maintenance overhead.

What are common test-driven development anti-patterns to avoid?

A common test-driven development anti-pattern is horizontal slicing, where you write all tests before any implementation. This leads to low-value, fragile test suites that fail to verify behavior effectively.

Can test-driven development help with deep module design and reducing test surface area?

Yes, test-driven development encourages deep module design by focusing tests on public behavior verification. This approach directly reduces your test surface area and minimizes long-term maintenance overhead.