tdd-workflow
SKILL.md
TDD Workflow
Principle: Red -> Green -> Refactor (STRICT order!)
PHASE 0: Test Planning (FIRST STEP)
Fill test cases table BEFORE any code:
## TEST CASES (fill BEFORE implementation!)
| # | Scenario | Input | Expected Output | Type | Status |
|---|----------|-------|-----------------|------|--------|
| 1 | Happy path | <input> | <expected> | Unit | pending |
| 2 | Edge case: empty | [] | <expected> | Unit | pending |
| 3 | Edge case: null | null | Error | Unit | pending |
| 4 | Integration | <context> | <expected> | Integration | pending |
Coverage categories:
- Happy path (main scenario)
- Edge cases (empty data, boundaries, null/undefined)
- Error cases (invalid input, exceptions)
- Integration points (if dependencies exist)
STOP: Do NOT proceed to Phase 1 until table is filled!
PHASE 1: RED -- Write Failing Tests
- Create test file (
feature.test.ts) - Write tests for ALL cases from Phase 0 table
- Run tests -- they MUST FAIL:
npm test -- --grep "feature" # Expected: FAIL
STOP: Do NOT write implementation until tests fail!
PHASE 2: GREEN -- Minimal Code
- Write MINIMAL code to make tests pass
- Do NOT optimize, do NOT add "for later"
- Run tests:
npm test -- --grep "feature" # Expected: PASS - Repeat for each test case
STOP: Do NOT refactor until ALL tests are green!
PHASE 3: REFACTOR
- All tests green? -> Refactor
- Remove duplication, improve readability
- After EACH change:
npm test(must stay green)
PHASE 4: VERIFY
## TDD VERIFICATION
| Category | Written | Passing | Skipped |
|----------|---------|---------|---------|
| Happy path | X | X | 0 |
| Edge cases | X | X | 0 |
| Error cases | X | X | 0 |
| Integration | X | X | 0 |
| **TOTAL** | X | X | 0 |
FORBIDDEN
- Writing code BEFORE test cases table
- Writing code BEFORE failing tests
- Refactoring with red tests
- Skipping checkpoints
- "I'll write tests later"
Weekly Installs
1
Repository
dmitryprg-ai/cu…utorulesGitHub Stars
6
First Seen
7 days ago
Security Audits
Installed on
zencoder1
amp1
cline1
openclaw1
opencode1
cursor1