|
| 1 | +name: tdd |
| 2 | +version: 1 |
| 3 | +description: Test-driven development workflow - proposal → tests → implementation → docs |
| 4 | +artifacts: |
| 5 | + - id: proposal |
| 6 | + generates: proposal.md |
| 7 | + description: Initial proposal outlining the bug or feature |
| 8 | + template: proposal.md |
| 9 | + instruction: | |
| 10 | + Create the proposal document that establishes WHY this change is needed. |
| 11 | +
|
| 12 | + For bugs, focus on: |
| 13 | + - **Why**: What's broken? What's the observed vs. expected behavior? |
| 14 | + - **What Changes**: What will be fixed? Be specific about behavior changes. |
| 15 | + - **Impact**: Affected code, APIs, users, or systems. |
| 16 | + - **Root Cause** (if known): Technical reason for the bug. |
| 17 | +
|
| 18 | + For features, focus on: |
| 19 | + - **Why**: What problem does this solve? Why now? |
| 20 | + - **What Changes**: What new capability will exist? |
| 21 | + - **Impact**: Affected code, APIs, dependencies, or systems. |
| 22 | +
|
| 23 | + Keep it concise (1 page max). This is test-first, so focus on |
| 24 | + observable behavior that tests will verify. |
| 25 | + requires: [] |
| 26 | + |
| 27 | + - id: tests |
| 28 | + generates: tests.md |
| 29 | + description: Test specifications written before implementation |
| 30 | + template: tests.md |
| 31 | + instruction: | |
| 32 | + Define the tests that will verify the fix or feature BEFORE implementing. |
| 33 | +
|
| 34 | + Structure: |
| 35 | + - **Test Cases**: List each test case with: |
| 36 | + - Name/Description |
| 37 | + - Setup/Given conditions |
| 38 | + - Action/When trigger |
| 39 | + - Expected/Then outcome |
| 40 | + - Test type (unit/integration/e2e) |
| 41 | + - Status (pending/failing/passing) |
| 42 | +
|
| 43 | + Write tests at appropriate levels: |
| 44 | + - Unit tests for isolated logic |
| 45 | + - Integration tests for component interactions |
| 46 | + - E2E tests for user-facing behavior |
| 47 | +
|
| 48 | + Each test should be implementable and should FAIL initially. |
| 49 | + Tests define the contract - implementation must make them pass. |
| 50 | +
|
| 51 | + Use checkboxes to track test status: |
| 52 | + - [ ] Test name - pending (not written yet) |
| 53 | + - [x] Test name - written and status noted |
| 54 | + requires: |
| 55 | + - proposal |
| 56 | + |
| 57 | + - id: implementation |
| 58 | + generates: implementation.md |
| 59 | + description: Implementation plan and code changes |
| 60 | + template: implementation.md |
| 61 | + instruction: | |
| 62 | + Document the implementation approach and track code changes. |
| 63 | +
|
| 64 | + Sections: |
| 65 | + - **Approach**: High-level technical strategy |
| 66 | + - **Changes**: File-by-file breakdown of modifications |
| 67 | + - **Decisions**: Key technical choices and rationale |
| 68 | + - **Test Status**: Track which tests pass/fail as you implement |
| 69 | +
|
| 70 | + Implementation follows TDD cycle: |
| 71 | + 1. Write failing test |
| 72 | + 2. Write minimal code to pass |
| 73 | + 3. Refactor while keeping tests green |
| 74 | + 4. Repeat |
| 75 | +
|
| 76 | + Implementation is DONE when all tests pass. |
| 77 | + Do not add features beyond what tests require. |
| 78 | + requires: |
| 79 | + - tests |
| 80 | + |
| 81 | + - id: docs |
| 82 | + generates: docs.md |
| 83 | + description: Documentation updates for the change |
| 84 | + template: docs.md |
| 85 | + instruction: | |
| 86 | + Update relevant documentation after implementation is complete. |
| 87 | +
|
| 88 | + Include: |
| 89 | + - **API Changes**: Updated signatures, parameters, return values |
| 90 | + - **Behavior Changes**: How user-facing behavior differs |
| 91 | + - **Migration**: If breaking, how to migrate existing code |
| 92 | + - **Examples**: Updated code examples reflecting new behavior |
| 93 | +
|
| 94 | + Only document what changed - don't rewrite existing docs. |
| 95 | + Mark as "No documentation changes" if none are needed. |
| 96 | + requires: |
| 97 | + - implementation |
| 98 | + |
| 99 | +apply: |
| 100 | + requires: [tests, implementation] |
| 101 | + tracks: tests.md |
| 102 | + instruction: | |
| 103 | + Follow TDD workflow: |
| 104 | + 1. Review tests.md to understand what needs to pass |
| 105 | + 2. Write failing tests first (mark status in tests.md) |
| 106 | + 3. Implement minimal code to make tests pass |
| 107 | + 4. Refactor while keeping tests green |
| 108 | + 5. Update test status as tests pass |
| 109 | +
|
| 110 | + Mark test checkboxes as complete when tests are written and passing. |
| 111 | + Pause if blocked or need clarification. |
0 commit comments