|
| 1 | +--- |
| 2 | +name: tdd+ |
| 3 | +description: "Invoke AFTER plan+ is approved. Wraps superpowers:test-driven-development with full-loop assertions, no-mock enforcement, zero-defect, stale test detection, and scoped test runs. Implements plan tasks with RED-GREEN-REFACTOR discipline." |
| 4 | +argument-hint: "[plan file path or task range]" |
| 5 | +user-invocable: true |
| 6 | +--- |
| 7 | + |
| 8 | +# tdd+ — Disciplined Implementation |
| 9 | + |
| 10 | +Wraps `superpowers:test-driven-development`. Requires superpowers to be installed. |
| 11 | + |
| 12 | +**This skill activates tdd+ phase in the enforcement layer.** During this phase: |
| 13 | + |
| 14 | +- Full test suite runs are redirected (use scoped tests only) |
| 15 | +- Stale test warnings fire when source edits lack test updates |
| 16 | +- Constitutional no-mock rules are enforced |
| 17 | + |
| 18 | +## Procedure |
| 19 | + |
| 20 | +### Phase A: Setup |
| 21 | + |
| 22 | +1. Announce phase entry: |
| 23 | + |
| 24 | + ``` |
| 25 | + Now using tdd+ skill. Enforcement layer active: |
| 26 | + - Test scope: scoped runs only (full suite reserved for verify+) |
| 27 | + - Stale tests: warnings when source edited without test updates |
| 28 | + - Zero-defect: every failure must be fixed before proceeding |
| 29 | + ``` |
| 30 | + |
| 31 | +2. Load the plan from `docs/plans/`. |
| 32 | + |
| 33 | +3. Identify the task(s) to implement. |
| 34 | + |
| 35 | +### Phase B: Implement Each Task (delegate to superpowers:test-driven-development) |
| 36 | + |
| 37 | +1. For each task in the plan, follow RED-GREEN-REFACTOR: |
| 38 | + |
| 39 | + **RED — Write the failing test first:** |
| 40 | + - Write a test that captures the task's requirement |
| 41 | + - Use full-loop assertions where applicable: |
| 42 | + - Primary: does the function return the expected value? |
| 43 | + - Second-order: did the side effect occur? (state change, log entry, event) |
| 44 | + - Third-order: is the system still consistent? (no orphan records, no leaked connections) |
| 45 | + - Run the test: it MUST fail (if it passes immediately, the test is wrong) |
| 46 | + - Show the failure output |
| 47 | + |
| 48 | + **GREEN — Write minimal code to make the test pass:** |
| 49 | + - Write the smallest possible implementation |
| 50 | + - Do not add features not in the plan |
| 51 | + - Run the scoped test: `npx vitest run tests/path/to/specific.test.ts` |
| 52 | + - Show the passing output |
| 53 | + |
| 54 | + **REFACTOR — Clean up while tests pass:** |
| 55 | + - Improve code structure without changing behavior |
| 56 | + - Run scoped tests after each refactoring step |
| 57 | + - Commit after each completed task |
| 58 | + |
| 59 | +2. After each source file edit, check: |
| 60 | + - Was the corresponding test file also updated? |
| 61 | + - If not, the enforcement layer will emit a stale test warning |
| 62 | + - Address it before proceeding to the next task |
| 63 | + |
| 64 | +### Phase C: Task Completion |
| 65 | + |
| 66 | +1. After each task, verify: |
| 67 | + - [ ] Test was written first and shown to fail |
| 68 | + - [ ] Implementation makes the test pass |
| 69 | + - [ ] Scoped test run passes (not full suite) |
| 70 | + - [ ] No constitutional rules violated |
| 71 | + - [ ] Commit made with descriptive message |
| 72 | + |
| 73 | +2. Proceed to next task or exit tdd+ phase when all plan tasks complete. |
| 74 | + |
| 75 | +## Test Scope Rules |
| 76 | + |
| 77 | +During tdd+ phase, the enforcement layer redirects: |
| 78 | + |
| 79 | +- `npx vitest run` (full suite) → advise to run scoped tests only |
| 80 | +- `pytest` (full suite) → advise to run specific test file |
| 81 | + |
| 82 | +Use scoped commands: |
| 83 | + |
| 84 | +``` |
| 85 | +npx vitest run tests/router/resolver.test.ts |
| 86 | +pytest tests/test_config.py::test_load_config |
| 87 | +``` |
| 88 | + |
| 89 | +Full suite runs happen during `verify+` phase, not here. |
| 90 | + |
| 91 | +## Skill Chain |
| 92 | + |
| 93 | +After completing all plan tasks with tdd+: |
| 94 | + |
| 95 | +- Invoke `/verify+` to run full suite and verify against plan acceptance criteria |
0 commit comments