test-driven-development

Enforce red-green-refactor discipline by writing failing tests before production code.

Updated Apr 3, 2026
One-click install
npx skills add https://github.com/norrbacka/threejs_codex_base --skill test-driven-development-norrbacka
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/norrbacka/threejs_codex_base/tree/main/.codex/superpowers/skills/test-driven-development
Command: npx skills add https://github.com/norrbacka/threejs_codex_base --skill test-driven-development-norrbacka

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill prevents you from writing production code before you have a failing test that proves the behavior you need, reducing guesswork and late-stage defects.

Core Features & Use Cases

  • Red-Green-Refactor Workflow: Write one failing test, implement the smallest change to pass, then clean up without changing behavior.
  • Bug Fix Verification: Turn regressions into repeatable tests so the same issue cannot silently return.
  • Testing Guardrails: Avoid common mistakes like testing mock behavior, adding test-only methods, or over-mocking dependencies.
  • Use Case: A developer needs to add a retry feature or fix an empty-input bug and wants a disciplined process that proves the fix, preserves confidence, and keeps the codebase maintainable.

Quick Start

Ask the Skill to help you write a failing test first for the behavior you want, then implement the minimal code to make it pass and refactor only after verification.

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-driven development for a new feature?

Test-driven development starts by writing one failing unit test that proves the behavior you need, then implementing the smallest code change to pass it before refactoring. This red-green-refactor workflow ensures disciplined verification.

How do I fix a bug using TDD without it silently returning?

Bug fixes using TDD involve turning regressions into repeatable failing tests first. You implement the minimal code to make the test pass, ensuring the same issue cannot silently return and preserving codebase confidence.

What are common anti-patterns to avoid when writing unit tests?

Common testing anti-patterns include testing mock behavior instead of real behavior, adding test-only methods to production code, and over-mocking dependencies. Disciplined testing requires real-behavior assertions and minimal implementations.

When should I use refactoring in the red-green-refactor workflow?

Refactoring in test-driven development happens only after a failing test passes with minimal implementation code. You clean up the code without changing its behavior, ensuring the unit tests maintain their verification guardrails.

Does TDD apply to behavior changes and regression work?

Test-driven development applies to new features, bug fixes, refactoring, behavior changes, and regression work. It eliminates production code written before a failing test exists, reducing late-stage defects across all software modification tasks.