test-driven-development

Enforce the Red-Green-Refactor workflow by requiring failing tests before production code.

6|1|Updated Nov 8, 2025
One-click install
npx skills add https://github.com/LEEI1337/phantom-neural-cortex --skill test-driven-development-leei1337
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/LEEI1337/phantom-neural-cortex/tree/main/.claude/skills/test-driven-development
Command: npx skills add https://github.com/LEEI1337/phantom-neural-cortex --skill test-driven-development-leei1337

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill enforces the Test-Driven Development (TDD) methodology, ensuring that all new code is backed by verified tests. It prevents bugs, improves code quality, and provides confidence in refactoring by requiring a failing test before any production code is written, thereby reducing debugging time and technical debt.

Core Features & Use Cases

  • Red-Green-Refactor Cycle: Guides through the core TDD loop: write a failing test (Red), write minimal code to pass (Green), then clean up (Refactor).
  • Iron Law Enforcement: Strictly prohibits writing production code without a preceding failing test, ensuring tests truly validate behavior.
  • Comprehensive Checklist: Provides a verification checklist to ensure all TDD principles are followed before marking work complete.
  • Anti-Rationalization: Explicitly addresses common excuses for skipping TDD, reinforcing best practices.
  • Use Case: When implementing a new user authentication flow, use this skill to write tests for each step (e.g., valid email, password strength) before writing any backend logic, guaranteeing each component works as expected.

Quick Start

I'm using the test-driven-development skill to implement the new user registration feature. I'll start by writing a test for invalid email input.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I write tests before implementing code?

Test-driven development requires writing a failing unit test first, then implementing minimal production code to pass it. This Red-Green-Refactor cycle ensures tests validate actual behavior before refactoring, reducing bugs and technical debt while maintaining code quality throughout feature work and bug fixes.

What's the best way to ensure all code has test coverage?

TDD enforces strict test-first discipline by prohibiting production code without a preceding failing test. This iron law prevents untested code from entering the codebase, guaranteeing comprehensive coverage across features, bug fixes, and refactors with deterministic, maintainable tests.

How do I implement the Red-Green-Refactor workflow?

The Red-Green-Refactor cycle has three steps: write a failing test (Red), write minimal code to pass it (Green), then refactor while preserving behavior. This disciplined approach applies to all feature work and provides rapid feedback loops for quality assurance.

Can I use test-driven development for bug fixes and refactoring?

Yes. TDD applies to feature work, bug fixes, and refactors. Write a failing test that reproduces the bug or validates the refactor, implement the fix with minimal code, then refactor. This ensures behavior is preserved and prevents regressions.

What common mistakes should I avoid when starting TDD?

Avoid rationalizing why you can skip writing the test first—this breaks the discipline. TDD explicitly addresses common excuses through its iron law and comprehensive verification checklist, ensuring you follow best practices consistently across all code changes.