@soleri/forge 5.5.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/facades/forge.facade.js +4 -3
- package/dist/facades/forge.facade.js.map +1 -1
- package/dist/scaffolder.js +122 -8
- package/dist/scaffolder.js.map +1 -1
- package/dist/skills/skills/brain-debrief.md +214 -0
- package/dist/skills/skills/brainstorming.md +180 -0
- package/dist/skills/skills/code-patrol.md +178 -0
- package/dist/skills/skills/context-resume.md +146 -0
- package/dist/skills/skills/executing-plans.md +216 -0
- package/dist/skills/skills/fix-and-learn.md +167 -0
- package/dist/skills/skills/health-check.md +231 -0
- package/dist/skills/skills/knowledge-harvest.md +185 -0
- package/dist/skills/skills/onboard-me.md +198 -0
- package/dist/skills/skills/retrospective.md +205 -0
- package/dist/skills/skills/second-opinion.md +149 -0
- package/dist/skills/skills/systematic-debugging.md +241 -0
- package/dist/skills/skills/test-driven-development.md +281 -0
- package/dist/skills/skills/vault-capture.md +170 -0
- package/dist/skills/skills/vault-navigator.md +140 -0
- package/dist/skills/skills/verification-before-completion.md +182 -0
- package/dist/skills/skills/writing-plans.md +215 -0
- package/dist/templates/entry-point.js +8 -0
- package/dist/templates/entry-point.js.map +1 -1
- package/dist/templates/test-facades.js +35 -6
- package/dist/templates/test-facades.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/scaffolder.test.ts +2 -2
- package/src/facades/forge.facade.ts +4 -3
- package/src/scaffolder.ts +120 -10
- package/src/skills/brain-debrief.md +47 -19
- package/src/skills/brainstorming.md +19 -9
- package/src/skills/code-patrol.md +21 -19
- package/src/skills/context-resume.md +14 -11
- package/src/skills/executing-plans.md +30 -15
- package/src/skills/fix-and-learn.md +17 -14
- package/src/skills/health-check.md +29 -23
- package/src/skills/knowledge-harvest.md +27 -20
- package/src/skills/onboard-me.md +16 -15
- package/src/skills/retrospective.md +34 -18
- package/src/skills/second-opinion.md +16 -9
- package/src/skills/systematic-debugging.md +40 -29
- package/src/skills/test-driven-development.md +45 -30
- package/src/skills/vault-capture.md +31 -15
- package/src/skills/vault-navigator.md +24 -13
- package/src/skills/verification-before-completion.md +38 -26
- package/src/skills/writing-plans.md +21 -13
- package/src/templates/entry-point.ts +8 -0
- package/src/templates/test-facades.ts +35 -6
|
@@ -20,52 +20,62 @@ Generate a retrospective from actual session data, vault captures, plan outcomes
|
|
|
20
20
|
### Step 1: Gather the Data
|
|
21
21
|
|
|
22
22
|
**Brain stats — the big picture:**
|
|
23
|
+
|
|
23
24
|
```
|
|
24
25
|
YOUR_AGENT_core op:brain_stats
|
|
25
26
|
```
|
|
26
27
|
|
|
27
28
|
**Recent brain stats — compare velocity:**
|
|
29
|
+
|
|
28
30
|
```
|
|
29
31
|
YOUR_AGENT_core op:brain_stats
|
|
30
32
|
params: { since: "<start of period>" }
|
|
31
33
|
```
|
|
32
34
|
|
|
33
35
|
**Pattern strengths — what's proven:**
|
|
36
|
+
|
|
34
37
|
```
|
|
35
38
|
YOUR_AGENT_core op:brain_strengths
|
|
36
39
|
```
|
|
37
40
|
|
|
38
41
|
**Recent vault captures — what was learned:**
|
|
42
|
+
|
|
39
43
|
```
|
|
40
44
|
YOUR_AGENT_core op:vault_recent
|
|
41
45
|
```
|
|
42
46
|
|
|
43
47
|
**Memory topics — where knowledge clusters:**
|
|
48
|
+
|
|
44
49
|
```
|
|
45
50
|
YOUR_AGENT_core op:memory_topics
|
|
46
51
|
```
|
|
47
52
|
|
|
48
53
|
**Memory stats — volume and health:**
|
|
54
|
+
|
|
49
55
|
```
|
|
50
56
|
YOUR_AGENT_core op:memory_stats
|
|
51
57
|
```
|
|
52
58
|
|
|
53
59
|
**Plan stats — execution track record:**
|
|
60
|
+
|
|
54
61
|
```
|
|
55
62
|
YOUR_AGENT_core op:plan_stats
|
|
56
63
|
```
|
|
57
64
|
|
|
58
65
|
**Loop history — iterative workflow outcomes:**
|
|
66
|
+
|
|
59
67
|
```
|
|
60
68
|
YOUR_AGENT_core op:loop_history
|
|
61
69
|
```
|
|
62
70
|
|
|
63
71
|
**Search insights — what people looked for but didn't find:**
|
|
72
|
+
|
|
64
73
|
```
|
|
65
74
|
YOUR_AGENT_core op:admin_search_insights
|
|
66
75
|
```
|
|
67
76
|
|
|
68
77
|
**Vault analytics — knowledge quality:**
|
|
78
|
+
|
|
69
79
|
```
|
|
70
80
|
YOUR_AGENT_core op:admin_vault_analytics
|
|
71
81
|
```
|
|
@@ -73,21 +83,25 @@ YOUR_AGENT_core op:admin_vault_analytics
|
|
|
73
83
|
### Step 2: Analyze Patterns
|
|
74
84
|
|
|
75
85
|
**Stale knowledge needing refresh:**
|
|
86
|
+
|
|
76
87
|
```
|
|
77
88
|
YOUR_AGENT_core op:vault_age_report
|
|
78
89
|
```
|
|
79
90
|
|
|
80
91
|
**Duplicates that crept in:**
|
|
92
|
+
|
|
81
93
|
```
|
|
82
94
|
YOUR_AGENT_core op:curator_detect_duplicates
|
|
83
95
|
```
|
|
84
96
|
|
|
85
97
|
**Contradictions in the knowledge base:**
|
|
98
|
+
|
|
86
99
|
```
|
|
87
100
|
YOUR_AGENT_core op:curator_contradictions
|
|
88
101
|
```
|
|
89
102
|
|
|
90
103
|
**Curator health audit — overall quality:**
|
|
104
|
+
|
|
91
105
|
```
|
|
92
106
|
YOUR_AGENT_core op:curator_health_audit
|
|
93
107
|
```
|
|
@@ -154,11 +168,13 @@ YOUR_AGENT_core op:capture_knowledge
|
|
|
154
168
|
If the retrospective revealed quality issues, offer to fix them:
|
|
155
169
|
|
|
156
170
|
**Consolidate vault (deduplicate, normalize, groom):**
|
|
171
|
+
|
|
157
172
|
```
|
|
158
173
|
YOUR_AGENT_core op:curator_consolidate
|
|
159
174
|
```
|
|
160
175
|
|
|
161
176
|
**Rebuild brain intelligence with fresh data:**
|
|
177
|
+
|
|
162
178
|
```
|
|
163
179
|
YOUR_AGENT_core op:brain_build_intelligence
|
|
164
180
|
```
|
|
@@ -169,21 +185,21 @@ This feels like magic because the user says "sprint retro" and gets a data-drive
|
|
|
169
185
|
|
|
170
186
|
## Agent Tools Reference
|
|
171
187
|
|
|
172
|
-
| Op
|
|
173
|
-
|
|
174
|
-
| `brain_stats`
|
|
175
|
-
| `brain_strengths`
|
|
176
|
-
| `vault_recent`
|
|
177
|
-
| `memory_topics`
|
|
178
|
-
| `memory_stats`
|
|
179
|
-
| `plan_stats`
|
|
180
|
-
| `loop_history`
|
|
181
|
-
| `admin_search_insights`
|
|
182
|
-
| `admin_vault_analytics`
|
|
183
|
-
| `vault_age_report`
|
|
184
|
-
| `curator_detect_duplicates` | Duplicate detection
|
|
185
|
-
| `curator_contradictions`
|
|
186
|
-
| `curator_health_audit`
|
|
187
|
-
| `capture_knowledge`
|
|
188
|
-
| `curator_consolidate`
|
|
189
|
-
| `brain_build_intelligence`
|
|
188
|
+
| Op | When to Use |
|
|
189
|
+
| --------------------------- | --------------------------- |
|
|
190
|
+
| `brain_stats` | Big picture metrics |
|
|
191
|
+
| `brain_strengths` | Proven patterns |
|
|
192
|
+
| `vault_recent` | What was captured recently |
|
|
193
|
+
| `memory_topics` | Knowledge clusters |
|
|
194
|
+
| `memory_stats` | Memory volume and health |
|
|
195
|
+
| `plan_stats` | Plan completion rates |
|
|
196
|
+
| `loop_history` | Iterative workflow outcomes |
|
|
197
|
+
| `admin_search_insights` | Search miss analysis |
|
|
198
|
+
| `admin_vault_analytics` | Knowledge quality metrics |
|
|
199
|
+
| `vault_age_report` | Stale entries |
|
|
200
|
+
| `curator_detect_duplicates` | Duplicate detection |
|
|
201
|
+
| `curator_contradictions` | Knowledge conflicts |
|
|
202
|
+
| `curator_health_audit` | Overall vault quality |
|
|
203
|
+
| `capture_knowledge` | Persist the retrospective |
|
|
204
|
+
| `curator_consolidate` | Post-retro cleanup |
|
|
205
|
+
| `brain_build_intelligence` | Rebuild intelligence |
|
|
@@ -29,17 +29,20 @@ YOUR_AGENT_core op:route_intent
|
|
|
29
29
|
### Step 2: Search All Knowledge Sources (in order)
|
|
30
30
|
|
|
31
31
|
**Vault — has this been decided before?**
|
|
32
|
+
|
|
32
33
|
```
|
|
33
34
|
YOUR_AGENT_core op:search_intelligent
|
|
34
35
|
params: { query: "<the decision or options being considered>" }
|
|
35
36
|
```
|
|
36
37
|
|
|
37
38
|
Look specifically for:
|
|
39
|
+
|
|
38
40
|
- Previous decisions on this topic (type: "decision")
|
|
39
41
|
- Patterns that favor one approach
|
|
40
42
|
- Anti-patterns that warn against an approach
|
|
41
43
|
|
|
42
44
|
**Brain — what's proven to work?**
|
|
45
|
+
|
|
43
46
|
```
|
|
44
47
|
YOUR_AGENT_core op:brain_strengths
|
|
45
48
|
```
|
|
@@ -50,12 +53,14 @@ YOUR_AGENT_core op:brain_recommend
|
|
|
50
53
|
```
|
|
51
54
|
|
|
52
55
|
**Cross-project — what did other projects choose?**
|
|
56
|
+
|
|
53
57
|
```
|
|
54
58
|
YOUR_AGENT_core op:memory_cross_project_search
|
|
55
59
|
params: { query: "<the decision topic>", crossProject: true }
|
|
56
60
|
```
|
|
57
61
|
|
|
58
62
|
**Memory — any relevant context from past sessions?**
|
|
63
|
+
|
|
59
64
|
```
|
|
60
65
|
YOUR_AGENT_core op:memory_search
|
|
61
66
|
params: { query: "<decision topic>" }
|
|
@@ -63,6 +68,7 @@ YOUR_AGENT_core op:memory_search
|
|
|
63
68
|
|
|
64
69
|
**Web — what does the broader community say?**
|
|
65
70
|
Search the web for:
|
|
71
|
+
|
|
66
72
|
- Comparison articles (X vs Y for [use case])
|
|
67
73
|
- Benchmarks and performance data
|
|
68
74
|
- Community consensus on best practices
|
|
@@ -120,6 +126,7 @@ This is critical — the next person who faces the same decision will find it in
|
|
|
120
126
|
## The Magic
|
|
121
127
|
|
|
122
128
|
This feels like magic because the user asks "should I use X?" and instead of a generic AI opinion, they get:
|
|
129
|
+
|
|
123
130
|
1. What their own project decided before (vault)
|
|
124
131
|
2. What's proven to work across projects (brain)
|
|
125
132
|
3. What other linked projects chose (cross-project)
|
|
@@ -131,12 +138,12 @@ It's like having a senior architect who remembers every decision ever made.
|
|
|
131
138
|
|
|
132
139
|
## Agent Tools Reference
|
|
133
140
|
|
|
134
|
-
| Op
|
|
135
|
-
|
|
136
|
-
| `route_intent`
|
|
137
|
-
| `search_intelligent`
|
|
138
|
-
| `brain_strengths`
|
|
139
|
-
| `brain_recommend`
|
|
140
|
-
| `memory_cross_project_search` | What other projects decided
|
|
141
|
-
| `memory_search`
|
|
142
|
-
| `capture_knowledge`
|
|
141
|
+
| Op | When to Use |
|
|
142
|
+
| ----------------------------- | ------------------------------------ |
|
|
143
|
+
| `route_intent` | Classify the decision type |
|
|
144
|
+
| `search_intelligent` | Find previous decisions and patterns |
|
|
145
|
+
| `brain_strengths` | Proven approaches |
|
|
146
|
+
| `brain_recommend` | Project-specific recommendations |
|
|
147
|
+
| `memory_cross_project_search` | What other projects decided |
|
|
148
|
+
| `memory_search` | Session context for this decision |
|
|
149
|
+
| `capture_knowledge` | Persist the final decision |
|
|
@@ -26,6 +26,7 @@ If you haven't completed Phase 1, you cannot propose fixes.
|
|
|
26
26
|
## When to Use
|
|
27
27
|
|
|
28
28
|
Use for ANY technical issue:
|
|
29
|
+
|
|
29
30
|
- Test failures
|
|
30
31
|
- Bugs in production
|
|
31
32
|
- Unexpected behavior
|
|
@@ -34,6 +35,7 @@ Use for ANY technical issue:
|
|
|
34
35
|
- Integration issues
|
|
35
36
|
|
|
36
37
|
**Use this ESPECIALLY when:**
|
|
38
|
+
|
|
37
39
|
- Under time pressure (emergencies make guessing tempting)
|
|
38
40
|
- "Just one quick fix" seems obvious
|
|
39
41
|
- You've already tried multiple fixes
|
|
@@ -45,6 +47,7 @@ Use for ANY technical issue:
|
|
|
45
47
|
**BEFORE touching any code**, search for existing solutions. Follow this order:
|
|
46
48
|
|
|
47
49
|
### Vault First
|
|
50
|
+
|
|
48
51
|
```
|
|
49
52
|
YOUR_AGENT_core op:search_intelligent
|
|
50
53
|
params: { query: "<description of the bug or error message>" }
|
|
@@ -66,7 +69,9 @@ YOUR_AGENT_core op:memory_search
|
|
|
66
69
|
```
|
|
67
70
|
|
|
68
71
|
### Web Search Second
|
|
72
|
+
|
|
69
73
|
If the vault has nothing, search the web before investigating from scratch:
|
|
74
|
+
|
|
70
75
|
- **Paste the exact error message** — someone likely hit this before
|
|
71
76
|
- **Check GitHub issues** on relevant libraries
|
|
72
77
|
- **Check Stack Overflow** for the error + framework/library combination
|
|
@@ -75,6 +80,7 @@ If the vault has nothing, search the web before investigating from scratch:
|
|
|
75
80
|
A 30-second search that finds "this is a known issue in v3.2, upgrade to v3.3" saves hours of root cause investigation.
|
|
76
81
|
|
|
77
82
|
### Then Investigate
|
|
83
|
+
|
|
78
84
|
Only if vault and web search produce no answer, proceed to Phase 1.
|
|
79
85
|
|
|
80
86
|
## Start a Debug Loop
|
|
@@ -101,6 +107,7 @@ You MUST complete each phase before proceeding to the next.
|
|
|
101
107
|
5. Trace Data Flow backward through call stack
|
|
102
108
|
|
|
103
109
|
Track each investigation step:
|
|
110
|
+
|
|
104
111
|
```
|
|
105
112
|
YOUR_AGENT_core op:loop_iterate
|
|
106
113
|
```
|
|
@@ -113,6 +120,7 @@ YOUR_AGENT_core op:loop_iterate
|
|
|
113
120
|
4. Understand Dependencies
|
|
114
121
|
|
|
115
122
|
Search vault for working patterns to compare against:
|
|
123
|
+
|
|
116
124
|
```
|
|
117
125
|
YOUR_AGENT_core op:search_intelligent
|
|
118
126
|
params: { query: "<working feature similar to broken one>" }
|
|
@@ -136,6 +144,7 @@ YOUR_AGENT_core op:search_intelligent
|
|
|
136
144
|
## Phase 5: Capture the Learning
|
|
137
145
|
|
|
138
146
|
Complete the debug loop:
|
|
147
|
+
|
|
139
148
|
```
|
|
140
149
|
YOUR_AGENT_core op:loop_complete
|
|
141
150
|
```
|
|
@@ -164,6 +173,7 @@ YOUR_AGENT_core op:capture_quick
|
|
|
164
173
|
```
|
|
165
174
|
|
|
166
175
|
Capture a session summary:
|
|
176
|
+
|
|
167
177
|
```
|
|
168
178
|
YOUR_AGENT_core op:session_capture
|
|
169
179
|
params: { summary: "<bug, root cause, fix, files modified>" }
|
|
@@ -187,44 +197,45 @@ This is what makes the agent smarter over time. Next time someone hits a similar
|
|
|
187
197
|
|
|
188
198
|
## Common Rationalizations
|
|
189
199
|
|
|
190
|
-
| Excuse
|
|
191
|
-
|
|
192
|
-
| "Issue is simple, don't need process"
|
|
193
|
-
| "Emergency, no time for process"
|
|
194
|
-
| "Just try this first, then investigate"
|
|
195
|
-
| "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it.
|
|
196
|
-
| "Multiple fixes at once saves time"
|
|
197
|
-
| "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely.
|
|
198
|
-
| "I see the problem, let me fix it"
|
|
199
|
-
| "One more fix attempt" (after 2+ failures)
|
|
200
|
-
| "Skip the vault, I know this one"
|
|
200
|
+
| Excuse | Reality |
|
|
201
|
+
| -------------------------------------------- | ----------------------------------------------------------------------- |
|
|
202
|
+
| "Issue is simple, don't need process" | Simple issues have root causes too. |
|
|
203
|
+
| "Emergency, no time for process" | Systematic is FASTER than guess-and-check thrashing. |
|
|
204
|
+
| "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
|
|
205
|
+
| "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. |
|
|
206
|
+
| "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
|
|
207
|
+
| "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. |
|
|
208
|
+
| "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
|
|
209
|
+
| "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question pattern, don't fix again. |
|
|
210
|
+
| "Skip the vault, I know this one" | The vault may know it better. 30 seconds to check saves hours. |
|
|
201
211
|
|
|
202
212
|
## Quick Reference
|
|
203
213
|
|
|
204
|
-
| Phase
|
|
205
|
-
|
|
206
|
-
| **0. Search First**
|
|
207
|
-
| **1. Root Cause**
|
|
208
|
-
| **2. Pattern**
|
|
209
|
-
| **3. Hypothesis**
|
|
210
|
-
| **4. Implementation** | Create test, fix, verify
|
|
211
|
-
| **5. Capture**
|
|
214
|
+
| Phase | Key Activities | Agent Tools |
|
|
215
|
+
| --------------------- | -------------------------------- | -------------------------------------------------------- |
|
|
216
|
+
| **0. Search First** | Vault search, web search, memory | `search_intelligent`, `brain_strengths`, `memory_search` |
|
|
217
|
+
| **1. Root Cause** | Read errors, reproduce, trace | `loop_iterate` |
|
|
218
|
+
| **2. Pattern** | Find working examples, compare | `search_intelligent` |
|
|
219
|
+
| **3. Hypothesis** | Form theory, test minimally | `loop_iterate` |
|
|
220
|
+
| **4. Implementation** | Create test, fix, verify | `loop_iterate` |
|
|
221
|
+
| **5. Capture** | Persist root cause, close loop | `capture_knowledge`, `loop_complete`, `session_capture` |
|
|
212
222
|
|
|
213
223
|
## Agent Tools Reference
|
|
214
224
|
|
|
215
|
-
| Op
|
|
216
|
-
|
|
225
|
+
| Op | When to Use |
|
|
226
|
+
| -------------------- | ---------------------------------------- |
|
|
217
227
|
| `search_intelligent` | Search vault for known bugs and patterns |
|
|
218
|
-
| `brain_strengths`
|
|
219
|
-
| `memory_search`
|
|
220
|
-
| `loop_start`
|
|
221
|
-
| `loop_iterate`
|
|
222
|
-
| `loop_complete`
|
|
223
|
-
| `capture_knowledge`
|
|
224
|
-
| `capture_quick`
|
|
225
|
-
| `session_capture`
|
|
228
|
+
| `brain_strengths` | Check proven debugging patterns |
|
|
229
|
+
| `memory_search` | Search across session memories |
|
|
230
|
+
| `loop_start` | Begin iterative debug cycle |
|
|
231
|
+
| `loop_iterate` | Track each investigation/fix attempt |
|
|
232
|
+
| `loop_complete` | Finish debug cycle |
|
|
233
|
+
| `capture_knowledge` | Full anti-pattern capture |
|
|
234
|
+
| `capture_quick` | Fast capture for simple fixes |
|
|
235
|
+
| `session_capture` | Persist session context |
|
|
226
236
|
|
|
227
237
|
**Related skills:**
|
|
238
|
+
|
|
228
239
|
- test-driven-development
|
|
229
240
|
- verification-before-completion
|
|
230
241
|
- fix-and-learn (combines debugging + capture in one workflow)
|
|
@@ -18,12 +18,14 @@ Write the test first. Watch it fail. Write minimal code to pass.
|
|
|
18
18
|
## When to Use
|
|
19
19
|
|
|
20
20
|
**Always:**
|
|
21
|
+
|
|
21
22
|
- New features
|
|
22
23
|
- Bug fixes
|
|
23
24
|
- Refactoring
|
|
24
25
|
- Behavior changes
|
|
25
26
|
|
|
26
27
|
**Exceptions (ask your human partner):**
|
|
28
|
+
|
|
27
29
|
- Throwaway prototypes
|
|
28
30
|
- Generated code
|
|
29
31
|
- Configuration files
|
|
@@ -35,6 +37,7 @@ Thinking "skip TDD just this once"? Stop. That's rationalization.
|
|
|
35
37
|
**Never start writing tests blind.** Follow this lookup order:
|
|
36
38
|
|
|
37
39
|
### 1. Vault First
|
|
40
|
+
|
|
38
41
|
Check for existing testing patterns in the knowledge base:
|
|
39
42
|
|
|
40
43
|
```
|
|
@@ -43,6 +46,7 @@ YOUR_AGENT_core op:search_intelligent
|
|
|
43
46
|
```
|
|
44
47
|
|
|
45
48
|
Look for:
|
|
49
|
+
|
|
46
50
|
- **Testing patterns** for similar features (how were they tested before?)
|
|
47
51
|
- **Anti-patterns** — common testing mistakes in this domain
|
|
48
52
|
- **Proven approaches** from brain strengths:
|
|
@@ -54,12 +58,15 @@ YOUR_AGENT_core op:brain_strengths
|
|
|
54
58
|
If the vault has testing guidance for this domain, follow it. Don't reinvent test strategies that have already been validated.
|
|
55
59
|
|
|
56
60
|
### 2. Web Search
|
|
61
|
+
|
|
57
62
|
If the vault has no relevant patterns, search the web for established testing approaches:
|
|
63
|
+
|
|
58
64
|
- Library-specific testing patterns (e.g., how to test React hooks, Express middleware)
|
|
59
65
|
- Best practices for the specific type of test (integration, e2e, unit)
|
|
60
66
|
- Known gotchas in the testing framework being used
|
|
61
67
|
|
|
62
68
|
### 3. Then Write the Test
|
|
69
|
+
|
|
63
70
|
Only after consulting vault and web, proceed to write the failing test. You'll write better tests when informed by existing knowledge.
|
|
64
71
|
|
|
65
72
|
## Start a TDD Loop
|
|
@@ -80,6 +87,7 @@ NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
|
|
|
80
87
|
Write code before the test? Delete it. Start over.
|
|
81
88
|
|
|
82
89
|
**No exceptions:**
|
|
90
|
+
|
|
83
91
|
- Don't keep it as "reference"
|
|
84
92
|
- Don't "adapt" it while writing tests
|
|
85
93
|
- Don't look at it
|
|
@@ -97,6 +105,7 @@ Good: clear name, tests real behavior, one thing
|
|
|
97
105
|
Bad: vague name, tests mock not code
|
|
98
106
|
|
|
99
107
|
**Requirements:**
|
|
108
|
+
|
|
100
109
|
- One behavior
|
|
101
110
|
- Clear name
|
|
102
111
|
- Real code (no mocks unless unavoidable)
|
|
@@ -108,6 +117,7 @@ Bad: vague name, tests mock not code
|
|
|
108
117
|
Run: `npm test path/to/test.test.ts`
|
|
109
118
|
|
|
110
119
|
Confirm:
|
|
120
|
+
|
|
111
121
|
- Test fails (not errors)
|
|
112
122
|
- Failure message is expected
|
|
113
123
|
- Fails because feature missing (not typos)
|
|
@@ -116,6 +126,7 @@ Confirm:
|
|
|
116
126
|
**Test errors?** Fix error, re-run until it fails correctly.
|
|
117
127
|
|
|
118
128
|
Track the iteration:
|
|
129
|
+
|
|
119
130
|
```
|
|
120
131
|
YOUR_AGENT_core op:loop_iterate
|
|
121
132
|
```
|
|
@@ -131,6 +142,7 @@ Write simplest code to pass the test. Don't add features, refactor other code, o
|
|
|
131
142
|
Run: `npm test path/to/test.test.ts`
|
|
132
143
|
|
|
133
144
|
Confirm:
|
|
145
|
+
|
|
134
146
|
- Test passes
|
|
135
147
|
- Other tests still pass
|
|
136
148
|
- Output pristine (no errors, warnings)
|
|
@@ -139,6 +151,7 @@ Confirm:
|
|
|
139
151
|
**Other tests fail?** Fix now.
|
|
140
152
|
|
|
141
153
|
Track the iteration:
|
|
154
|
+
|
|
142
155
|
```
|
|
143
156
|
YOUR_AGENT_core op:loop_iterate
|
|
144
157
|
```
|
|
@@ -146,6 +159,7 @@ YOUR_AGENT_core op:loop_iterate
|
|
|
146
159
|
### REFACTOR - Clean Up
|
|
147
160
|
|
|
148
161
|
After green only:
|
|
162
|
+
|
|
149
163
|
- Remove duplication
|
|
150
164
|
- Improve names
|
|
151
165
|
- Extract helpers
|
|
@@ -158,11 +172,11 @@ Next failing test for next feature.
|
|
|
158
172
|
|
|
159
173
|
## Good Tests
|
|
160
174
|
|
|
161
|
-
| Quality
|
|
162
|
-
|
|
163
|
-
| **Minimal**
|
|
164
|
-
| **Clear**
|
|
165
|
-
| **Shows intent** | Demonstrates desired API
|
|
175
|
+
| Quality | Good | Bad |
|
|
176
|
+
| ---------------- | ----------------------------------- | --------------------------------------------------- |
|
|
177
|
+
| **Minimal** | One thing. "and" in name? Split it. | `test('validates email and domain and whitespace')` |
|
|
178
|
+
| **Clear** | Name describes behavior | `test('test1')` |
|
|
179
|
+
| **Shows intent** | Demonstrates desired API | Obscures what code should do |
|
|
166
180
|
|
|
167
181
|
## Why Order Matters
|
|
168
182
|
|
|
@@ -170,19 +184,19 @@ Tests written after code pass immediately — proving nothing. Test-first forces
|
|
|
170
184
|
|
|
171
185
|
## Common Rationalizations
|
|
172
186
|
|
|
173
|
-
| Excuse
|
|
174
|
-
|
|
175
|
-
| "Too simple to test"
|
|
176
|
-
| "I'll test after"
|
|
177
|
-
| "Tests after achieve same goals"
|
|
178
|
-
| "Already manually tested"
|
|
179
|
-
| "Deleting X hours is wasteful"
|
|
180
|
-
| "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete.
|
|
181
|
-
| "Need to explore first"
|
|
182
|
-
| "Test hard = design unclear"
|
|
183
|
-
| "TDD will slow me down"
|
|
184
|
-
| "Manual test faster"
|
|
185
|
-
| "Existing code has no tests"
|
|
187
|
+
| Excuse | Reality |
|
|
188
|
+
| -------------------------------------- | ----------------------------------------------------------------------- |
|
|
189
|
+
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
|
|
190
|
+
| "I'll test after" | Tests passing immediately prove nothing. |
|
|
191
|
+
| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
|
|
192
|
+
| "Already manually tested" | Ad-hoc ≠ systematic. No record, can't re-run. |
|
|
193
|
+
| "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is technical debt. |
|
|
194
|
+
| "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
|
|
195
|
+
| "Need to explore first" | Fine. Throw away exploration, start with TDD. |
|
|
196
|
+
| "Test hard = design unclear" | Listen to test. Hard to test = hard to use. |
|
|
197
|
+
| "TDD will slow me down" | TDD faster than debugging. Pragmatic = test-first. |
|
|
198
|
+
| "Manual test faster" | Manual doesn't prove edge cases. You'll re-test every change. |
|
|
199
|
+
| "Existing code has no tests" | You're improving it. Add tests for existing code. |
|
|
186
200
|
|
|
187
201
|
## Red Flags - STOP and Start Over
|
|
188
202
|
|
|
@@ -220,6 +234,7 @@ Can't check all boxes? You skipped TDD. Start over.
|
|
|
220
234
|
## After TDD — Capture and Complete
|
|
221
235
|
|
|
222
236
|
Complete the loop:
|
|
237
|
+
|
|
223
238
|
```
|
|
224
239
|
YOUR_AGENT_core op:loop_complete
|
|
225
240
|
```
|
|
@@ -238,12 +253,12 @@ This compounds across sessions — next time someone works on similar code, the
|
|
|
238
253
|
|
|
239
254
|
## When Stuck
|
|
240
255
|
|
|
241
|
-
| Problem
|
|
242
|
-
|
|
256
|
+
| Problem | Solution |
|
|
257
|
+
| ---------------------- | -------------------------------------------------------------------- |
|
|
243
258
|
| Don't know how to test | Write wished-for API. Write assertion first. Ask your human partner. |
|
|
244
|
-
| Test too complicated
|
|
245
|
-
| Must mock everything
|
|
246
|
-
| Test setup huge
|
|
259
|
+
| Test too complicated | Design too complicated. Simplify interface. |
|
|
260
|
+
| Must mock everything | Code too coupled. Use dependency injection. |
|
|
261
|
+
| Test setup huge | Extract helpers. Still complex? Simplify design. |
|
|
247
262
|
|
|
248
263
|
## Final Rule
|
|
249
264
|
|
|
@@ -256,11 +271,11 @@ No exceptions without your human partner's permission.
|
|
|
256
271
|
|
|
257
272
|
## Agent Tools Reference
|
|
258
273
|
|
|
259
|
-
| Op
|
|
260
|
-
|
|
274
|
+
| Op | When to Use |
|
|
275
|
+
| -------------------- | ------------------------------------- |
|
|
261
276
|
| `search_intelligent` | Find testing patterns before starting |
|
|
262
|
-
| `brain_strengths`
|
|
263
|
-
| `loop_start`
|
|
264
|
-
| `loop_iterate`
|
|
265
|
-
| `loop_complete`
|
|
266
|
-
| `capture_quick`
|
|
277
|
+
| `brain_strengths` | Check proven testing approaches |
|
|
278
|
+
| `loop_start` | Begin TDD validation loop |
|
|
279
|
+
| `loop_iterate` | Track each red-green cycle |
|
|
280
|
+
| `loop_complete` | Finish TDD loop |
|
|
281
|
+
| `capture_quick` | Capture new testing patterns |
|