tdd-workflowlisted
Install: claude install-skill aiskillstore/marketplace
# TDD Workflow Skill
## Overview
Test-Driven Development methodology for Node.js/TypeScript projects.
## The RED-GREEN-REFACTOR Cycle
### RED Phase: Design Failing Tests
Write tests BEFORE implementation:
1. **Identify Behavior**: What should the code do?
2. **Design Test Cases**: Cover all scenarios
3. **Write Tests**: Use AAA pattern
4. **Run Tests**: Confirm they FAIL
5. **Verify Failure**: Tests fail for the RIGHT reason
### GREEN Phase: Minimal Implementation
Make tests pass with minimal code:
1. **Focus**: One failing test at a time
2. **Implement**: Just enough to pass
3. **Verify**: Run tests, confirm GREEN
4. **Iterate**: Next failing test
5. **Complete**: All tests passing
### REFACTOR Phase: Improve Design
Improve code while keeping tests green:
1. **Review**: Identify code smells
2. **Plan**: Choose refactoring
3. **Apply**: Make the change
4. **Verify**: Tests still GREEN
5. **Repeat**: Until quality gates met
## AAA Pattern
```typescript
describe('Calculator', () => {
it('should add two numbers correctly', () => {
// Arrange - Set up test conditions
const calculator = createCalculator();
// Act - Execute the behavior
const result = calculator.add(2, 3);
// Assert - Verify the outcome
expect(result).toBe(5);
});
});
```
## Test Naming Convention
Format: `should {expectedBehavior} when {scenario}`
Examples:
```typescript
it('should return empty array when input is empty', ...);
it('should throw ValidationError when ema