tdd-masterlisted
Install: claude install-skill noxxer/core-team
# TDD Master Skill
Test-Driven Development methodology for writing reliable, maintainable code.
## When to Activate
This skill activates automatically when:
- Implementing new features (write tests FIRST)
- Fixing bugs (reproduce with failing test FIRST)
- Writing or reviewing tests
- Refactoring code (ensure tests exist)
## Core Workflow: Red-Green-Refactor
### Step 1: Test List
Before coding, create a list of scenarios:
```markdown
## Test List for [Feature]
- [ ] Happy path: main scenario
- [ ] Edge case: empty input
- [ ] Edge case: boundary values
- [ ] Error case: invalid input
- [ ] Error case: external service failure
```
### Step 2: RED - Write Failing Test
Write test that defines expected behavior:
```python
def test__{what}__{scenario}__{outcome}():
# Arrange
order = Order(items=[Item(price=1500)])
# Act
discount = calculate_discount(order)
# Assert
assert discount == Decimal('150')
```
**CRITICAL**: Predict HOW the test will fail before running.
### Step 3: GREEN - Minimal Code
Write **MINIMUM** code to pass:
- Hardcoded values OK
- Simple if-statements OK
- "Fake it till you make it" OK
### Step 4: REFACTOR
After test passes:
- Remove duplication
- Improve naming
- Extract helpers
- Keep tests green
### Step 5: REPEAT
Next test from list until complete.
## Three Laws of TDD (Uncle Bob)
| # | Law |
|---|-----|
| 1 | Cannot write production code without failing test |
| 2 | Cannot write more test than sufficient to fail