test-driven-development

Enforce a Red-Green-Refactor TDD loop for features and bug fixes.

115|54|Updated May 25, 2026
One-click install
npx skills add https://github.com/totvs/engpro-advpl-tlpp-skills --skill test-driven-development-totvs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/totvs/engpro-advpl-tlpp-skills/tree/main/skills/superpowers/test-driven-development
Command: npx skills add https://github.com/totvs/engpro-advpl-tlpp-skills --skill test-driven-development-totvs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the risk of shipping unverified changes by enforcing a test-first workflow that proves the feature works before any production code is added.

Core Features & Use Cases

  • Red-Green-Refactor TDD loop: write a failing test, verify it fails for the expected reason, implement minimal code to pass, verify all tests pass, then refactor without changing behavior.
  • Iron Law for quality: requires a failing test first and rejects rationalizations like “just this once,” “test later,” or “keep it as reference/adapt existing code.”
  • Anti-pattern guardrails for testing: discourages testing mock behavior, adding test-only methods to production code, mocking without understanding dependencies, and incomplete mocks.

Use it when implementing any new feature, fixing a bug, or refactoring while needing strong confidence and regression protection (especially when your agent or team tends to code before validating behavior).

Quick Start

Use the test-driven-development skill to guide the agent to implement changes by writing a failing test, verifying the failure is for the missing feature, writing the smallest production code to make it pass, then running the test suite to confirm no regressions.

Frequently Asked Questions about test-driven-development

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

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

Test-first development requires writing a failing test, verifying it fails for the expected reason, implementing minimal production code to pass, and running the test suite to confirm no regressions. This Red-Green-Refactor cycle ensures the feature works before code is added.

What's the best way to prevent regressions when refactoring existing code?

To prevent regressions when refactoring, enforce a strict TDD verification loop by writing a failing test first, making minimal code changes to pass it, and confirming the entire test suite passes before refactoring without altering behavior.

What are common mocking anti-patterns in unit testing?

Common mocking anti-patterns in unit testing include testing mock behavior instead of real interactions, adding test-only methods to production code, and mocking dependencies without understanding them, all of which undermine software quality and regression prevention.

Can I use test-driven development for fixing bugs?

Yes, you can use test-driven development for fixing bugs by writing a failing test that reproduces the bug, verifying the failure is for the correct reason, then applying minimal code changes to make the test pass and ensure regression protection.