Complete AI TrainingYourJobSkills for your job

Skills / testing

tdd-workflow

Test-Driven Development workflow principles. RED-GREEN-REFACTOR cycle.

IT & Software Development

TDD Workflow

Write tests first, code second.

1. The TDD Cycle

🔴 RED → Write failing test
    ↓
🟢 GREEN → Write minimal code to pass
    ↓
🔵 REFACTOR → Improve code quality
    ↓
   Repeat...

2. The Three Laws of TDD

  1. Write production code only to make a failing test pass
  2. Write only enough test to demonstrate failure
  3. Write only enough code to make the test pass

3. RED Phase Principles

What to Write

FocusExample
Behavior"should add two numbers"
Edge cases"should handle empty input"
Error states"should throw for invalid data"

RED Phase Rules

  • Test must fail first
  • Test name describes expected behavior
  • One assertion per test (ideally)

4. GREEN Phase Principles

Minimum Code

PrincipleMeaning
YAGNIYou Aren't Gonna Need It
Simplest thingWrite the minimum to pass
No optimizationJust make it work

GREEN Phase Rules

  • Don't write unneeded code
  • Don't optimize yet
  • Pass the test, nothing more

5. REFACTOR Phase Principles

What to Improve

AreaAction
DuplicationExtract common code
NamingMake intent clear
StructureImprove organization
ComplexitySimplify logic

REFACTOR Rules

  • All tests must stay green
  • Small incremental

Subscribers only

The full skill, its 1 bundled files and every download is included with every paid Complete AI plan.

Details

Sourcecommunity
License
Risk labelcritical ("critical" means the skill may run commands or touch files — read before use)
FilesSKILL.md
Added2026-02-27

Related skills

ab-testing

When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program.

agent-qa-authoring

Create, edit, validate, and run Agent QA tests, suites, and hooks through MCP or CLI while preserving canonical IDs and schema contracts.

agent-qa-debug-fix

Debug, patch, and verify failed Agent QA runs from MCP evidence, artifacts, logs, and local code without hiding product or infrastructure defects.

agent-qa-result-triage

Triage failed Agent QA runs with MCP evidence, artifacts, logs, fixed failure categories, confidence, and actionable next steps.

android-ui-journey-testing

XML-specified Android UI journey testing, interactive step execution, assertion verification, and JSON outcome reporting.

bats-testing-patterns

Master Bash Automated Testing System (Bats) for comprehensive shell script testing. Use when writing tests for shell scripts, CI/CD pipelines, or requiring test-driven development of shell utilities.