Back to Skills

tdd

verified

Use for any code implementation task. Enforces RED-GREEN-REFACTOR cycle. "If you didn't watch it fail, you don't know if it tests the right thing."

View on GitHub

Marketplace

baxtercooper-nexus

BaxterCooper/nexus

Plugin

nexus-orchestrator

development-workflows

Repository

BaxterCooper/nexus

plugins/nexus-orchestrator/skills/tdd/SKILL.md

Last Verified

January 21, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/BaxterCooper/nexus/blob/main/plugins/nexus-orchestrator/skills/tdd/SKILL.md -a claude-code --skill tdd

Installation paths:

Claude
.claude/skills/tdd/
Powered by add-skill CLI

Instructions

# Test-Driven Development Skill

> **Core Principle**: If you didn't watch it fail, you don't know if it tests the right thing.

## The Cycle

```
    ┌──────────────────────────────────────────┐
    │                                          │
    ▼                                          │
┌───────┐    ┌───────┐    ┌──────────┐        │
│  RED  │ ──▶│ GREEN │ ──▶│ REFACTOR │ ───────┘
└───────┘    └───────┘    └──────────┘
Write test   Make pass    Clean up
Watch FAIL   Minimal code  Keep green
```

---

## RED Phase

### What to Do
1. Write a single failing test
2. Run the test
3. **Watch it fail**
4. Verify failure is for expected reason

### Why "Watch It Fail" Matters

| Without Watching Fail | With Watching Fail |
|-----------------------|-------------------|
| Test might always pass (bug in test) | Confirms test can fail |
| Test might fail for wrong reason | Confirms test checks right thing |
| No proof test validates behavior | Evidence of validation |

### Red Phase Checklist
- [ ] Test written for ONE behavior
- [ ] Test run
- [ ] Test failed
- [ ] Failure is for expected reason (not typo, import error, etc.)

---

## GREEN Phase

### What to Do
1. Write the **minimum** code to pass the test
2. Run the test
3. **Watch it pass**
4. Nothing more - no extras, no "while I'm here"

### What Minimum Means

| Too Much | Minimum |
|----------|---------|
| Add error handling for edge cases | Just make this test pass |
| Refactor related code | Just make this test pass |
| Add features "we'll need" | Just make this test pass |

### Green Phase Checklist
- [ ] Only code needed for this test written
- [ ] Test run
- [ ] Test passed
- [ ] No other tests broken

---

## REFACTOR Phase

### What to Do
1. Clean up the code
2. Run ALL tests after each change
3. Keep everything green
4. Stop when code is clean

### Safe Refactorings
- Rename for clarity
- Extract methods/functions
- Remove duplication
- Improve structure

### Refactor Phase Checklist
- [ ] Code is clean
-

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
3998 chars