TDD Workflow
Apply Test-Driven Development discipline with Red β Green β Refactor cycle, TDD commit convention, and compliance tracking.
What This Skill Provides
- TDD compliance checklist: Track TDD discipline throughout story
- TDD commit convention: π΄π’β»οΈ emoji pattern for Red β Green β Refactor
- Metrics gathering: Collect coverage, test counts, commit patterns
- Validation: Verify TDD compliance before merge
- AI-guided verification: Review TDD discipline and test quality
When to Use
- Starting story implementation (initialize checklist)
- Throughout development (track TDD discipline)
- Before merge (validate compliance)
- In code review (verify test-first approach)
Quick Start
1. Initialize TDD Checklist
```bash
From project root
./scripts/init-tdd-checklist.sh us-001 ```
Creates: ``` specs/{feature}/stories/us-001/checklists/ βββ tdd-compliance.md β Track TDD discipline ```
2. Follow TDD Commit Convention
Red β Green β Refactor Cycle:
```bash
π΄ RED: Write failing test
git add backend/tests/users.test.ts git commit -m "π΄ Test: POST /api/users validates email format"
οΏ½οΏ½ GREEN: Implement to pass
git add backend/src/api/users.ts git commit -m "π’ Implement email validation in createUser"
β»οΈ REFACTOR: Improve code quality
git add backend/src/api/users.ts backend/src/utils/validation.ts git commit -m "β»οΈ Extract email validation to reusable utility" ```
Emoji Guide:
- π΄ `:red_circle:` - Failing test (Red phase)
- π’ `:green_circle:` - Passing implementation (Green phase)
- β»οΈ `:recycle:` - Refactoring (Refactor phase)
3. Gather TDD Metrics
```bash ./scripts/gather-tdd-metrics.sh us-001 ```
Collects:
- TDD commit counts (π΄π’β»οΈ)
- Test coverage (backend, frontend)
- Test-to-code ratio
- Test file counts
4. Validate Before Merge
```bash ./scripts/validate-tdd-compliance.sh us-001 ```
Checks:
- [ ] All checklist items completed
- [ ] Coverage β₯ 80%
- [ ] TDD commit pattern detected (π΄βπ’)
- [ ] No skipped or commented tests
Exit code 0 = passed, 1 = failed.
TDD Commit Convention Details
See TDD discipline instructions for full details on commit convention enforcement.
Integration with Other Skills
- Task-delegation: TDD compliance tracked per delegation
- Feature-orchestration: TDD checklist in story checklists/ directory
- Retrospective-workflow: TDD metrics included in retro
- CLAUDE-framework: TDD is part of coding standards
Scripts
- `init-tdd-checklist.sh <story-id>` - Initialize TDD compliance checklist
- `gather-tdd-metrics.sh <story-id>` - Collect TDD metrics
- `validate-tdd-compliance.sh <story-id>` - Verify compliance (exit 0/1)
Prompts
- `verify-tdd-compliance` - AI-guided TDD verification workflow
Templates
- `tdd-compliance.checklist.md` - TDD discipline tracking