Test-Driven Development
Implement $ARGUMENTS using strict TDD methodology.
Reference: Test-Driven Development by Example (Kent Beck)
TDD Strategy
The TDD workflow follows a strict cycle:
- RED - Write a failing test first
- GREEN - Write minimal code to pass
- REFACTOR - Clean up while keeping tests green
- REPEAT - Add next behavior
Dynamic Context
- Test framework: !
ls package.json 2>/dev/null && node -e "const p=require('./package.json');const d={...p.devDependencies,...p.dependencies};const f=['vitest','jest','mocha','ava','playwright','cypress'].find(t=>d[t]);console.log(f||'unknown')" 2>/dev/null || ls pytest.ini setup.cfg pyproject.toml Cargo.toml go.mod 2>/dev/null | head -1 || echo "unknown" - Existing test patterns: !
find . -name '*.test.*' -o -name '*.spec.*' -o -name '*_test.*' 2>/dev/null | head -5 || echo "No tests found" - Source structure: !
ls src/ app/ lib/ 2>/dev/null | head -10 || echo "N/A" - Coverage config: !
cat jest.config.* vitest.config.* pytest.ini pyproject.toml 2>/dev/null | grep -i coverage | head -3 || echo "N/A"
References
| Topic | Reference | Use for |
|---|---|---|
| Red-Green-Refactor | references/red-green-refactor.md | Full TDD protocol with JS/Python examples, cycle discipline rules |
| Test Patterns | references/test-patterns.md | Test types, naming conventions, test doubles, common pitfalls |
| Coverage & Reporting | references/coverage-and-reporting.md | Coverage targets, per-cycle reports, completion criteria, summary template |
Related Skills
- mutation-test - Verify test quality
- property-test - Property-based testing
- review-code - Code review
Resources
- Test-Driven Development by Example
- Growing Object-Oriented Software, Guided by Tests
- The Art of Unit Testing
Guardrails
- Prefer measured evidence over blanket rules of thumb.
- Ask for explicit human approval before destructive data operations (drops/deletes/truncates).
Source: gr1m0h/dot — distributed by TomeVault.