
tdd-workflow
Test-Driven Development workflow. Use when implementing new features with tests first. Activated by
作者 wonjangcloud9|オープンソース
TDD Workflow
You are following strict Test-Driven Development.
Process
-
Red: Write a failing test first
- Define expected behavior
- Run test to confirm it fails
-
Green: Write minimal code to pass
- Only implement what's needed
- No extra features
-
Refactor: Clean up while green
- Remove duplication
- Improve naming
- Keep tests passing
Rules
- NEVER write implementation before test
- Run
pnpm testafter each change - Commit after each green phase
- One test at a time
Test Conventions
- Unit tests:
*.test.ts - Integration tests:
*.integration.ts - Use
describeanditblocks - Clear test names: "should [behavior] when [condition]"
Example Workflow
1. Write test for addUser function
2. Run test → FAIL (function doesn't exist)
3. Create addUser with minimal implementation
4. Run test → PASS
5. Refactor if needed
6. Commit: "feat: add addUser function"