test-driven-development

Write failing unit tests before production code using the Red-Green-Refactor cycle.

3|Updated Dec 22, 2025
One-click install
npx skills add https://github.com/JoaquinCampo/codex-skills --skill test-driven-development-joaquincampo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/JoaquinCampo/codex-skills/tree/main/test-driven-development
Command: npx skills add https://github.com/JoaquinCampo/codex-skills --skill test-driven-development-joaquincampo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams adopt test-driven development (TDD) by guiding you to write tests before implementing code, reducing defects and guiding design.

Core Features & Use Cases

  • Guided TDD Workflow: Write a failing test first, then implement the simplest code to pass, and refactor.
  • Risk Reduction: Encourages incremental, verifiable changes that prevent regressions during features, bug fixes, or refactors.
  • Use Case: When starting any feature or fixing a bug, apply the Red-Green-Refactor cycle to maintain quality.

Quick Start

Create a tiny failing test for a new function, implement the minimal code to pass, then run the test suite to verify.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
What is test-driven development and how does the red-green-refactor cycle work?

Test-driven development is a workflow mandating a failing unit test before production code. The red-green-refactor cycle involves writing a failing test, implementing minimal code to pass, then refactoring to maintain quality.

How do I start writing unit tests before implementing new software features?

Start writing unit tests by creating a tiny failing test for a new function, implement the simplest code to pass, then run the test suite to verify. This incremental approach reduces defects and guides design.

Can I apply test-driven development to bug fixes and code refactoring?

Yes, test-driven development applies to bug fixes and refactoring. Writing a test that reproduces the bug or verifies expected behavior before changing code prevents regressions and ensures reliable software.

Why should I write a failing test before writing production code?

Writing a failing test before production code ensures the test is effective and promotes minimal, verifiable implementation. This workflow reduces the risk of shipping defects and guides software design incrementally.

Does test-driven development require specific testing frameworks or dependencies?

No specific testing frameworks or dependencies are required. The test-driven development workflow applies across any codebase by enforcing the test-first cycle for feature work, bug fixes, and behavioral changes.

When should I not use test-driven development for software engineering tasks?

Avoid test-driven development when exploring throwaway prototypes or when verifiable behavior cannot be defined upfront. The workflow relies on writing failing unit tests, which requires clear expected outcomes before implementation.