test-driven-development

Enforce test-first development with red-green-refactor and F.I.R.S.T principles.

1|1|Updated Apr 9, 2026
One-click install
npx skills add https://github.com/gaoqiongxie/skills-ai --skill test-driven-development-gaoqiongxie
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/gaoqiongxie/skills-ai/tree/main/test-driven-development
Command: npx skills add https://github.com/gaoqiongxie/skills-ai --skill test-driven-development-gaoqiongxie

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the common issue of writing fragile, hard-to-maintain code that is prone to bugs and difficult to modify, by enforcing a test-first development approach that catches defects early in the development cycle before they reach production.

Core Features & Use Cases

  • Strict TDD Workflow Guidance: Provides clear step-by-step instructions for the red-green-refactor loop to use for new feature development, bug fixes, and legacy code refactoring.
  • High-Quality Test Best Practices: Shares F.I.R.S.T principle rules, AAA test structure templates, and test naming conventions to help you write effective, maintainable test cases.
  • Pitfall Avoidance: Lists explicit anti-patterns to prevent common TDD mistakes like writing tests after implementation or testing implementation details instead of expected behavior.
  • Use Case: When building a new user authentication feature, this Skill guides you to first write a failing test for valid credential login, implement the minimal code to pass the test, then refactor to add password validation logic.

Quick Start

Ask the AI to implement a new user password reset feature following TDD red-green-refactor steps, starting with writing a failing test for valid reset token handling.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I apply test-driven development to fix bugs in legacy code?

To apply test-driven development for bug fixing and legacy code refactoring, reproduce the defect by writing a failing test, implement minimal code to pass it, then refactor safely.

What is the red-green-refactor loop in TDD?

The red-green-refactor loop in test-driven development involves writing a failing test, implementing minimal code to pass that test, then refactoring the code for maintainability.

How do I write high-quality unit tests using AAA structure and F.I.R.S.T principles?

High-quality unit tests using AAA structure and F.I.R.S.T principles require Arrange-Act-Assert formatting alongside tests that are Fast, Independent, Repeatable, Self-validating, and Timely.

Can I use test-driven development for new feature implementation?

Yes, test-driven development supports new feature implementation by enforcing a test-first workflow that catches defects early, ensuring reliable code before production deployment.

What are common TDD anti-patterns to avoid during code refactoring?

Common test-driven development anti-patterns include writing tests after implementation and testing internal implementation details instead of expected software behavior.

When should I not use test-first development for software testing?

Test-first development may not suit exploratory spikes or throwaway prototypes where immediate code viability is prioritized over building a comprehensive, maintainable test suite.