@soleri/forge 8.1.0 → 9.0.1
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/agent-schema.d.ts +16 -18
- package/dist/agent-schema.js +6 -6
- package/dist/agent-schema.js.map +1 -1
- package/dist/scaffold-filetree.js +19 -3
- package/dist/scaffold-filetree.js.map +1 -1
- package/dist/scaffolder.js +0 -4
- package/dist/scaffolder.js.map +1 -1
- package/dist/skills/brain-debrief/SKILL.md +66 -0
- package/dist/skills/brainstorming/SKILL.md +85 -0
- package/dist/skills/code-patrol/SKILL.md +86 -0
- package/dist/skills/context-resume/SKILL.md +92 -0
- package/dist/skills/executing-plans/SKILL.md +87 -0
- package/dist/skills/fix-and-learn/SKILL.md +98 -0
- package/dist/skills/health-check/SKILL.md +131 -0
- package/dist/skills/knowledge-harvest/SKILL.md +93 -0
- package/dist/skills/onboard-me/SKILL.md +118 -0
- package/dist/skills/retrospective/SKILL.md +95 -0
- package/dist/skills/second-opinion/SKILL.md +97 -0
- package/dist/skills/systematic-debugging/SKILL.md +99 -0
- package/dist/skills/test-driven-development/SKILL.md +91 -0
- package/dist/skills/vault-capture/SKILL.md +82 -0
- package/dist/skills/vault-navigator/SKILL.md +80 -0
- package/dist/skills/verification-before-completion/SKILL.md +82 -0
- package/dist/skills/writing-plans/SKILL.md +105 -0
- package/dist/templates/agents-md.js +0 -1
- package/dist/templates/agents-md.js.map +1 -1
- package/dist/templates/claude-md-template.js +2 -2
- package/dist/templates/claude-md-template.js.map +1 -1
- package/dist/templates/entry-point.js +1 -1
- package/dist/templates/entry-point.js.map +1 -1
- package/dist/templates/shared-rules.js +19 -0
- package/dist/templates/shared-rules.js.map +1 -1
- package/dist/templates/test-facades.js +0 -11
- package/dist/templates/test-facades.js.map +1 -1
- package/dist/types.d.ts +20 -20
- package/dist/types.js +6 -6
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/scaffold-filetree.test.ts +0 -2
- package/src/agent-schema.ts +6 -6
- package/src/scaffold-filetree.ts +21 -2
- package/src/scaffolder.ts +0 -4
- package/src/skills/brain-debrief/SKILL.md +66 -0
- package/src/skills/brainstorming/SKILL.md +85 -0
- package/src/skills/code-patrol/SKILL.md +86 -0
- package/src/skills/context-resume/SKILL.md +92 -0
- package/src/skills/executing-plans/SKILL.md +87 -0
- package/src/skills/fix-and-learn/SKILL.md +98 -0
- package/src/skills/health-check/SKILL.md +131 -0
- package/src/skills/knowledge-harvest/SKILL.md +93 -0
- package/src/skills/onboard-me/SKILL.md +118 -0
- package/src/skills/retrospective/SKILL.md +95 -0
- package/src/skills/second-opinion/SKILL.md +97 -0
- package/src/skills/systematic-debugging/SKILL.md +99 -0
- package/src/skills/test-driven-development/SKILL.md +91 -0
- package/src/skills/vault-capture/SKILL.md +82 -0
- package/src/skills/vault-navigator/SKILL.md +80 -0
- package/src/skills/verification-before-completion/SKILL.md +82 -0
- package/src/skills/writing-plans/SKILL.md +105 -0
- package/src/templates/agents-md.ts +0 -1
- package/src/templates/claude-md-template.ts +1 -2
- package/src/templates/entry-point.ts +1 -1
- package/src/templates/shared-rules.ts +20 -0
- package/src/templates/test-facades.ts +0 -11
- package/src/types.ts +6 -6
- package/dist/skills/agent-dev.md +0 -122
- package/dist/skills/agent-guide.md +0 -110
- package/dist/skills/agent-persona.md +0 -66
- package/dist/skills/brain-debrief.md +0 -214
- package/dist/skills/brainstorming.md +0 -180
- package/dist/skills/code-patrol.md +0 -178
- package/dist/skills/context-resume.md +0 -146
- package/dist/skills/deliver-and-ship.md +0 -123
- package/dist/skills/env-setup.md +0 -151
- package/dist/skills/executing-plans.md +0 -216
- package/dist/skills/fix-and-learn.md +0 -167
- package/dist/skills/health-check.md +0 -231
- package/dist/skills/knowledge-harvest.md +0 -185
- package/dist/skills/onboard-me.md +0 -198
- package/dist/skills/retrospective.md +0 -205
- package/dist/skills/second-opinion.md +0 -149
- package/dist/skills/systematic-debugging.md +0 -241
- package/dist/skills/test-driven-development.md +0 -281
- package/dist/skills/vault-capture.md +0 -170
- package/dist/skills/vault-curate.md +0 -107
- package/dist/skills/vault-navigator.md +0 -140
- package/dist/skills/verification-before-completion.md +0 -182
- package/dist/skills/writing-plans.md +0 -215
- package/src/skills/agent-dev.md +0 -122
- package/src/skills/agent-guide.md +0 -110
- package/src/skills/agent-persona.md +0 -66
- package/src/skills/brain-debrief.md +0 -214
- package/src/skills/brainstorming.md +0 -180
- package/src/skills/code-patrol.md +0 -178
- package/src/skills/context-resume.md +0 -146
- package/src/skills/deliver-and-ship.md +0 -123
- package/src/skills/env-setup.md +0 -151
- package/src/skills/executing-plans.md +0 -216
- package/src/skills/fix-and-learn.md +0 -167
- package/src/skills/health-check.md +0 -231
- package/src/skills/knowledge-harvest.md +0 -185
- package/src/skills/onboard-me.md +0 -198
- package/src/skills/retrospective.md +0 -205
- package/src/skills/second-opinion.md +0 -149
- package/src/skills/systematic-debugging.md +0 -241
- package/src/skills/test-driven-development.md +0 -281
- package/src/skills/vault-capture.md +0 -170
- package/src/skills/vault-curate.md +0 -107
- package/src/skills/vault-navigator.md +0 -140
- package/src/skills/verification-before-completion.md +0 -182
- package/src/skills/writing-plans.md +0 -215
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: second-opinion
|
|
3
|
-
description: Use when the user asks "should I", "what do you think about", "which approach", "compare options", "what would you recommend", "pros and cons", "trade-offs", or faces any technical decision and wants an informed recommendation backed by vault knowledge, brain patterns, and web research.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Second Opinion — Decision Support From All Sources
|
|
7
|
-
|
|
8
|
-
Before making any technical decision, get an informed recommendation that synthesizes vault knowledge, brain patterns, cross-project experience, and web research. Never decide in a vacuum.
|
|
9
|
-
|
|
10
|
-
## When to Use
|
|
11
|
-
|
|
12
|
-
- "Should I use Redis or Memcached?"
|
|
13
|
-
- "What's the best way to handle auth?"
|
|
14
|
-
- "Which testing framework?"
|
|
15
|
-
- "Microservices or monolith?"
|
|
16
|
-
- Any fork-in-the-road technical decision
|
|
17
|
-
|
|
18
|
-
## The Magic: Multi-Source Decision Intelligence
|
|
19
|
-
|
|
20
|
-
### Step 1: Understand the Decision
|
|
21
|
-
|
|
22
|
-
Classify the intent to understand what kind of decision this is:
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
YOUR_AGENT_core op:route_intent
|
|
26
|
-
params: { prompt: "<user's question>" }
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### Step 2: Search All Knowledge Sources (in order)
|
|
30
|
-
|
|
31
|
-
**Vault — has this been decided before?**
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
YOUR_AGENT_core op:search_intelligent
|
|
35
|
-
params: { query: "<the decision or options being considered>" }
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Look specifically for:
|
|
39
|
-
|
|
40
|
-
- Previous decisions on this topic (type: "decision")
|
|
41
|
-
- Patterns that favor one approach
|
|
42
|
-
- Anti-patterns that warn against an approach
|
|
43
|
-
|
|
44
|
-
**Brain — what's proven to work?**
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
YOUR_AGENT_core op:brain_strengths
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
YOUR_AGENT_core op:brain_recommend
|
|
52
|
-
params: { projectName: "<current project>" }
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
**Cross-project — what did other projects choose?**
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
YOUR_AGENT_core op:memory_cross_project_search
|
|
59
|
-
params: { query: "<the decision topic>", crossProject: true }
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
**Memory — any relevant context from past sessions?**
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
YOUR_AGENT_core op:memory_search
|
|
66
|
-
params: { query: "<decision topic>" }
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**Web — what does the broader community say?**
|
|
70
|
-
Search the web for:
|
|
71
|
-
|
|
72
|
-
- Comparison articles (X vs Y for [use case])
|
|
73
|
-
- Benchmarks and performance data
|
|
74
|
-
- Community consensus on best practices
|
|
75
|
-
- Known limitations and gotchas
|
|
76
|
-
|
|
77
|
-
### Step 3: Synthesize and Present
|
|
78
|
-
|
|
79
|
-
Format the recommendation as a decision brief:
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
## Decision: [Question]
|
|
83
|
-
|
|
84
|
-
### What the Vault Says
|
|
85
|
-
[Existing decisions, patterns, and anti-patterns from vault]
|
|
86
|
-
|
|
87
|
-
### What the Brain Recommends
|
|
88
|
-
[Proven patterns, cross-project insights]
|
|
89
|
-
|
|
90
|
-
### What the Web Says
|
|
91
|
-
[Community consensus, benchmarks, comparison data]
|
|
92
|
-
|
|
93
|
-
### Options Analysis
|
|
94
|
-
|
|
95
|
-
| Criteria | Option A | Option B | Option C |
|
|
96
|
-
|----------|----------|----------|----------|
|
|
97
|
-
| [criteria 1] | ... | ... | ... |
|
|
98
|
-
| [criteria 2] | ... | ... | ... |
|
|
99
|
-
| Vault support | [existing patterns?] | [existing patterns?] | — |
|
|
100
|
-
| Brain confidence | [strength score] | [strength score] | — |
|
|
101
|
-
|
|
102
|
-
### Recommendation
|
|
103
|
-
[Clear recommendation with reasoning]
|
|
104
|
-
|
|
105
|
-
### Risks
|
|
106
|
-
[What could go wrong with the recommended approach]
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Step 4: Capture the Decision
|
|
110
|
-
|
|
111
|
-
Once the user decides, capture it to the vault for future reference:
|
|
112
|
-
|
|
113
|
-
```
|
|
114
|
-
YOUR_AGENT_core op:capture_knowledge
|
|
115
|
-
params: {
|
|
116
|
-
title: "<decision title>",
|
|
117
|
-
description: "<chosen option, rationale, rejected alternatives and why>",
|
|
118
|
-
type: "decision",
|
|
119
|
-
category: "<relevant domain>",
|
|
120
|
-
tags: ["<option-a>", "<option-b>", "decision", "<domain>"]
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
This is critical — the next person who faces the same decision will find it in the vault.
|
|
125
|
-
|
|
126
|
-
## The Magic
|
|
127
|
-
|
|
128
|
-
This feels like magic because the user asks "should I use X?" and instead of a generic AI opinion, they get:
|
|
129
|
-
|
|
130
|
-
1. What their own project decided before (vault)
|
|
131
|
-
2. What's proven to work across projects (brain)
|
|
132
|
-
3. What other linked projects chose (cross-project)
|
|
133
|
-
4. What the broader community recommends (web)
|
|
134
|
-
5. A synthesized recommendation with trade-offs
|
|
135
|
-
6. The decision captured for the next person who asks
|
|
136
|
-
|
|
137
|
-
It's like having a senior architect who remembers every decision ever made.
|
|
138
|
-
|
|
139
|
-
## Agent Tools Reference
|
|
140
|
-
|
|
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 |
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: systematic-debugging
|
|
3
|
-
description: Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
<!-- Adapted from superpowers (MIT License) -->
|
|
7
|
-
|
|
8
|
-
# Systematic Debugging
|
|
9
|
-
|
|
10
|
-
## Overview
|
|
11
|
-
|
|
12
|
-
Random fixes waste time and create new bugs. Quick patches mask underlying issues.
|
|
13
|
-
|
|
14
|
-
**Core principle:** ALWAYS find root cause before attempting fixes. Symptom fixes are failure.
|
|
15
|
-
|
|
16
|
-
**Violating the letter of this process is violating the spirit of debugging.**
|
|
17
|
-
|
|
18
|
-
## The Iron Law
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
If you haven't completed Phase 1, you cannot propose fixes.
|
|
25
|
-
|
|
26
|
-
## When to Use
|
|
27
|
-
|
|
28
|
-
Use for ANY technical issue:
|
|
29
|
-
|
|
30
|
-
- Test failures
|
|
31
|
-
- Bugs in production
|
|
32
|
-
- Unexpected behavior
|
|
33
|
-
- Performance problems
|
|
34
|
-
- Build failures
|
|
35
|
-
- Integration issues
|
|
36
|
-
|
|
37
|
-
**Use this ESPECIALLY when:**
|
|
38
|
-
|
|
39
|
-
- Under time pressure (emergencies make guessing tempting)
|
|
40
|
-
- "Just one quick fix" seems obvious
|
|
41
|
-
- You've already tried multiple fixes
|
|
42
|
-
- Previous fix didn't work
|
|
43
|
-
- You don't fully understand the issue
|
|
44
|
-
|
|
45
|
-
## Phase 0: Search Before Investigating
|
|
46
|
-
|
|
47
|
-
**BEFORE touching any code**, search for existing solutions. Follow this order:
|
|
48
|
-
|
|
49
|
-
### Vault First
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
YOUR_AGENT_core op:search_intelligent
|
|
53
|
-
params: { query: "<description of the bug or error message>" }
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
If the vault has a matching anti-pattern or previous fix, it likely contains the root cause and solution — apply it directly. This can save hours of investigation.
|
|
57
|
-
|
|
58
|
-
Also check brain strengths for relevant debugging patterns:
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
YOUR_AGENT_core op:brain_strengths
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Check memory for similar bugs across sessions:
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
YOUR_AGENT_core op:memory_search
|
|
68
|
-
params: { query: "<error or symptom>" }
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Web Search Second
|
|
72
|
-
|
|
73
|
-
If the vault has nothing, search the web before investigating from scratch:
|
|
74
|
-
|
|
75
|
-
- **Paste the exact error message** — someone likely hit this before
|
|
76
|
-
- **Check GitHub issues** on relevant libraries
|
|
77
|
-
- **Check Stack Overflow** for the error + framework/library combination
|
|
78
|
-
- **Check official docs** — is this a known limitation or misconfiguration?
|
|
79
|
-
|
|
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.
|
|
81
|
-
|
|
82
|
-
### Then Investigate
|
|
83
|
-
|
|
84
|
-
Only if vault and web search produce no answer, proceed to Phase 1.
|
|
85
|
-
|
|
86
|
-
## Start a Debug Loop
|
|
87
|
-
|
|
88
|
-
For complex bugs, start a validation loop to track investigation iterations:
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
YOUR_AGENT_core op:loop_start
|
|
92
|
-
params: { prompt: "Debug: <bug description>", mode: "custom" }
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## The Four Phases
|
|
96
|
-
|
|
97
|
-
You MUST complete each phase before proceeding to the next.
|
|
98
|
-
|
|
99
|
-
### Phase 1: Root Cause Investigation
|
|
100
|
-
|
|
101
|
-
**BEFORE attempting ANY fix:**
|
|
102
|
-
|
|
103
|
-
1. Read Error Messages Carefully
|
|
104
|
-
2. Reproduce Consistently
|
|
105
|
-
3. Check Recent Changes
|
|
106
|
-
4. Gather Evidence in Multi-Component Systems (add diagnostic instrumentation at each component boundary)
|
|
107
|
-
5. Trace Data Flow backward through call stack
|
|
108
|
-
|
|
109
|
-
Track each investigation step:
|
|
110
|
-
|
|
111
|
-
```
|
|
112
|
-
YOUR_AGENT_core op:loop_iterate
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Phase 2: Pattern Analysis
|
|
116
|
-
|
|
117
|
-
1. Find Working Examples
|
|
118
|
-
2. Compare Against References (read completely, don't skim)
|
|
119
|
-
3. Identify Differences
|
|
120
|
-
4. Understand Dependencies
|
|
121
|
-
|
|
122
|
-
Search vault for working patterns to compare against:
|
|
123
|
-
|
|
124
|
-
```
|
|
125
|
-
YOUR_AGENT_core op:search_intelligent
|
|
126
|
-
params: { query: "<working feature similar to broken one>" }
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### Phase 3: Hypothesis and Testing
|
|
130
|
-
|
|
131
|
-
1. Form Single Hypothesis ("I think X is the root cause because Y")
|
|
132
|
-
2. Test Minimally (one variable at a time)
|
|
133
|
-
3. Verify Before Continuing
|
|
134
|
-
4. When You Don't Know — say so, ask for help
|
|
135
|
-
|
|
136
|
-
### Phase 4: Implementation
|
|
137
|
-
|
|
138
|
-
1. Create Failing Test Case (use test-driven-development skill)
|
|
139
|
-
2. Implement Single Fix (root cause only, one change at a time)
|
|
140
|
-
3. Verify Fix
|
|
141
|
-
4. If Fix Doesn't Work: count attempts. If < 3, return to Phase 1. If >= 3, STOP and question architecture.
|
|
142
|
-
5. If 3+ Fixes Failed: Question Architecture — discuss with human partner before attempting more fixes.
|
|
143
|
-
|
|
144
|
-
## Phase 5: Capture the Learning
|
|
145
|
-
|
|
146
|
-
Complete the debug loop:
|
|
147
|
-
|
|
148
|
-
```
|
|
149
|
-
YOUR_AGENT_core op:loop_complete
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
**MANDATORY after every resolved bug.** A fix without a capture is an incomplete fix.
|
|
153
|
-
|
|
154
|
-
```
|
|
155
|
-
YOUR_AGENT_core op:capture_knowledge
|
|
156
|
-
params: {
|
|
157
|
-
title: "<short bug description>",
|
|
158
|
-
description: "<root cause, solution, and what made it hard to find>",
|
|
159
|
-
type: "anti-pattern",
|
|
160
|
-
category: "<relevant domain>",
|
|
161
|
-
tags: ["<relevant>", "<tags>"]
|
|
162
|
-
}
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
For quick captures when the fix is straightforward:
|
|
166
|
-
|
|
167
|
-
```
|
|
168
|
-
YOUR_AGENT_core op:capture_quick
|
|
169
|
-
params: {
|
|
170
|
-
title: "<bug description>",
|
|
171
|
-
description: "<root cause and fix>"
|
|
172
|
-
}
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
Capture a session summary:
|
|
176
|
-
|
|
177
|
-
```
|
|
178
|
-
YOUR_AGENT_core op:session_capture
|
|
179
|
-
params: { summary: "<bug, root cause, fix, files modified>" }
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
This is what makes the agent smarter over time. Next time someone hits a similar bug, Phase 0 vault search will surface your solution immediately.
|
|
183
|
-
|
|
184
|
-
## Red Flags - STOP and Follow Process
|
|
185
|
-
|
|
186
|
-
- "Quick fix for now, investigate later"
|
|
187
|
-
- "Just try changing X and see if it works"
|
|
188
|
-
- "Add multiple changes, run tests"
|
|
189
|
-
- "Skip the test, I'll manually verify"
|
|
190
|
-
- "It's probably X, let me fix that"
|
|
191
|
-
- "I don't fully understand but this might work"
|
|
192
|
-
- Proposing solutions before tracing data flow
|
|
193
|
-
- "One more fix attempt" (when already tried 2+)
|
|
194
|
-
- Each fix reveals new problem in different place
|
|
195
|
-
|
|
196
|
-
**ALL of these mean: STOP. Return to Phase 1.**
|
|
197
|
-
|
|
198
|
-
## Common Rationalizations
|
|
199
|
-
|
|
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. |
|
|
211
|
-
|
|
212
|
-
## Quick Reference
|
|
213
|
-
|
|
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` |
|
|
222
|
-
|
|
223
|
-
## Agent Tools Reference
|
|
224
|
-
|
|
225
|
-
| Op | When to Use |
|
|
226
|
-
| -------------------- | ---------------------------------------- |
|
|
227
|
-
| `search_intelligent` | Search vault for known bugs and patterns |
|
|
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 |
|
|
236
|
-
|
|
237
|
-
**Related skills:**
|
|
238
|
-
|
|
239
|
-
- test-driven-development
|
|
240
|
-
- verification-before-completion
|
|
241
|
-
- fix-and-learn (combines debugging + capture in one workflow)
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: test-driven-development
|
|
3
|
-
description: Use when implementing any feature or bugfix, before writing implementation code
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
<!-- Adapted from superpowers (MIT License) -->
|
|
7
|
-
|
|
8
|
-
# Test-Driven Development (TDD)
|
|
9
|
-
|
|
10
|
-
## Overview
|
|
11
|
-
|
|
12
|
-
Write the test first. Watch it fail. Write minimal code to pass.
|
|
13
|
-
|
|
14
|
-
**Core principle:** If you didn't watch the test fail, you don't know if it tests the right thing.
|
|
15
|
-
|
|
16
|
-
**Violating the letter of the rules is violating the spirit of the rules.**
|
|
17
|
-
|
|
18
|
-
## When to Use
|
|
19
|
-
|
|
20
|
-
**Always:**
|
|
21
|
-
|
|
22
|
-
- New features
|
|
23
|
-
- Bug fixes
|
|
24
|
-
- Refactoring
|
|
25
|
-
- Behavior changes
|
|
26
|
-
|
|
27
|
-
**Exceptions (ask your human partner):**
|
|
28
|
-
|
|
29
|
-
- Throwaway prototypes
|
|
30
|
-
- Generated code
|
|
31
|
-
- Configuration files
|
|
32
|
-
|
|
33
|
-
Thinking "skip TDD just this once"? Stop. That's rationalization.
|
|
34
|
-
|
|
35
|
-
## Before You Start — Search First, Code Second
|
|
36
|
-
|
|
37
|
-
**Never start writing tests blind.** Follow this lookup order:
|
|
38
|
-
|
|
39
|
-
### 1. Vault First
|
|
40
|
-
|
|
41
|
-
Check for existing testing patterns in the knowledge base:
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
YOUR_AGENT_core op:search_intelligent
|
|
45
|
-
params: { query: "<what you're about to test>" }
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Look for:
|
|
49
|
-
|
|
50
|
-
- **Testing patterns** for similar features (how were they tested before?)
|
|
51
|
-
- **Anti-patterns** — common testing mistakes in this domain
|
|
52
|
-
- **Proven approaches** from brain strengths:
|
|
53
|
-
|
|
54
|
-
```
|
|
55
|
-
YOUR_AGENT_core op:brain_strengths
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
If the vault has testing guidance for this domain, follow it. Don't reinvent test strategies that have already been validated.
|
|
59
|
-
|
|
60
|
-
### 2. Web Search
|
|
61
|
-
|
|
62
|
-
If the vault has no relevant patterns, search the web for established testing approaches:
|
|
63
|
-
|
|
64
|
-
- Library-specific testing patterns (e.g., how to test React hooks, Express middleware)
|
|
65
|
-
- Best practices for the specific type of test (integration, e2e, unit)
|
|
66
|
-
- Known gotchas in the testing framework being used
|
|
67
|
-
|
|
68
|
-
### 3. Then Write the Test
|
|
69
|
-
|
|
70
|
-
Only after consulting vault and web, proceed to write the failing test. You'll write better tests when informed by existing knowledge.
|
|
71
|
-
|
|
72
|
-
## Start a TDD Loop
|
|
73
|
-
|
|
74
|
-
For multi-test TDD cycles, start a validation loop to track iterations:
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
YOUR_AGENT_core op:loop_start
|
|
78
|
-
params: { prompt: "TDD: <feature being implemented>", mode: "custom" }
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## The Iron Law
|
|
82
|
-
|
|
83
|
-
```
|
|
84
|
-
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Write code before the test? Delete it. Start over.
|
|
88
|
-
|
|
89
|
-
**No exceptions:**
|
|
90
|
-
|
|
91
|
-
- Don't keep it as "reference"
|
|
92
|
-
- Don't "adapt" it while writing tests
|
|
93
|
-
- Don't look at it
|
|
94
|
-
- Delete means delete
|
|
95
|
-
|
|
96
|
-
Implement fresh from tests. Period.
|
|
97
|
-
|
|
98
|
-
## Red-Green-Refactor
|
|
99
|
-
|
|
100
|
-
### RED - Write Failing Test
|
|
101
|
-
|
|
102
|
-
Write one minimal test showing what should happen.
|
|
103
|
-
|
|
104
|
-
Good: clear name, tests real behavior, one thing
|
|
105
|
-
Bad: vague name, tests mock not code
|
|
106
|
-
|
|
107
|
-
**Requirements:**
|
|
108
|
-
|
|
109
|
-
- One behavior
|
|
110
|
-
- Clear name
|
|
111
|
-
- Real code (no mocks unless unavoidable)
|
|
112
|
-
|
|
113
|
-
### Verify RED - Watch It Fail
|
|
114
|
-
|
|
115
|
-
**MANDATORY. Never skip.**
|
|
116
|
-
|
|
117
|
-
Run: `npm test path/to/test.test.ts`
|
|
118
|
-
|
|
119
|
-
Confirm:
|
|
120
|
-
|
|
121
|
-
- Test fails (not errors)
|
|
122
|
-
- Failure message is expected
|
|
123
|
-
- Fails because feature missing (not typos)
|
|
124
|
-
|
|
125
|
-
**Test passes?** You're testing existing behavior. Fix test.
|
|
126
|
-
**Test errors?** Fix error, re-run until it fails correctly.
|
|
127
|
-
|
|
128
|
-
Track the iteration:
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
YOUR_AGENT_core op:loop_iterate
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### GREEN - Minimal Code
|
|
135
|
-
|
|
136
|
-
Write simplest code to pass the test. Don't add features, refactor other code, or "improve" beyond the test.
|
|
137
|
-
|
|
138
|
-
### Verify GREEN - Watch It Pass
|
|
139
|
-
|
|
140
|
-
**MANDATORY.**
|
|
141
|
-
|
|
142
|
-
Run: `npm test path/to/test.test.ts`
|
|
143
|
-
|
|
144
|
-
Confirm:
|
|
145
|
-
|
|
146
|
-
- Test passes
|
|
147
|
-
- Other tests still pass
|
|
148
|
-
- Output pristine (no errors, warnings)
|
|
149
|
-
|
|
150
|
-
**Test fails?** Fix code, not test.
|
|
151
|
-
**Other tests fail?** Fix now.
|
|
152
|
-
|
|
153
|
-
Track the iteration:
|
|
154
|
-
|
|
155
|
-
```
|
|
156
|
-
YOUR_AGENT_core op:loop_iterate
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### REFACTOR - Clean Up
|
|
160
|
-
|
|
161
|
-
After green only:
|
|
162
|
-
|
|
163
|
-
- Remove duplication
|
|
164
|
-
- Improve names
|
|
165
|
-
- Extract helpers
|
|
166
|
-
|
|
167
|
-
Keep tests green. Don't add behavior.
|
|
168
|
-
|
|
169
|
-
### Repeat
|
|
170
|
-
|
|
171
|
-
Next failing test for next feature.
|
|
172
|
-
|
|
173
|
-
## Good Tests
|
|
174
|
-
|
|
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 |
|
|
180
|
-
|
|
181
|
-
## Why Order Matters
|
|
182
|
-
|
|
183
|
-
Tests written after code pass immediately — proving nothing. Test-first forces you to watch the test fail, proving it actually tests something.
|
|
184
|
-
|
|
185
|
-
## Common Rationalizations
|
|
186
|
-
|
|
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. |
|
|
200
|
-
|
|
201
|
-
## Red Flags - STOP and Start Over
|
|
202
|
-
|
|
203
|
-
- Code before test
|
|
204
|
-
- Test after implementation
|
|
205
|
-
- Test passes immediately
|
|
206
|
-
- Can't explain why test failed
|
|
207
|
-
- Tests added "later"
|
|
208
|
-
- Rationalizing "just this once"
|
|
209
|
-
- "I already manually tested it"
|
|
210
|
-
- "Tests after achieve the same purpose"
|
|
211
|
-
- "It's about spirit not ritual"
|
|
212
|
-
- "Keep as reference" or "adapt existing code"
|
|
213
|
-
- "Already spent X hours, deleting is wasteful"
|
|
214
|
-
- "TDD is dogmatic, I'm being pragmatic"
|
|
215
|
-
- "This is different because..."
|
|
216
|
-
|
|
217
|
-
**All of these mean: Delete code. Start over with TDD.**
|
|
218
|
-
|
|
219
|
-
## Verification Checklist
|
|
220
|
-
|
|
221
|
-
Before marking work complete:
|
|
222
|
-
|
|
223
|
-
- [ ] Every new function/method has a test
|
|
224
|
-
- [ ] Watched each test fail before implementing
|
|
225
|
-
- [ ] Each test failed for expected reason (feature missing, not typo)
|
|
226
|
-
- [ ] Wrote minimal code to pass each test
|
|
227
|
-
- [ ] All tests pass
|
|
228
|
-
- [ ] Output pristine (no errors, warnings)
|
|
229
|
-
- [ ] Tests use real code (mocks only if unavoidable)
|
|
230
|
-
- [ ] Edge cases and errors covered
|
|
231
|
-
|
|
232
|
-
Can't check all boxes? You skipped TDD. Start over.
|
|
233
|
-
|
|
234
|
-
## After TDD — Capture and Complete
|
|
235
|
-
|
|
236
|
-
Complete the loop:
|
|
237
|
-
|
|
238
|
-
```
|
|
239
|
-
YOUR_AGENT_core op:loop_complete
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
If you discovered a new testing pattern, edge case, or anti-pattern during the TDD cycle, capture it:
|
|
243
|
-
|
|
244
|
-
```
|
|
245
|
-
YOUR_AGENT_core op:capture_quick
|
|
246
|
-
params: {
|
|
247
|
-
title: "<testing pattern or anti-pattern>",
|
|
248
|
-
description: "<what you learned, when it applies, why it matters>"
|
|
249
|
-
}
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
This compounds across sessions — next time someone works on similar code, the vault will surface your testing insight.
|
|
253
|
-
|
|
254
|
-
## When Stuck
|
|
255
|
-
|
|
256
|
-
| Problem | Solution |
|
|
257
|
-
| ---------------------- | -------------------------------------------------------------------- |
|
|
258
|
-
| Don't know how to test | Write wished-for API. Write assertion first. Ask your human partner. |
|
|
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. |
|
|
262
|
-
|
|
263
|
-
## Final Rule
|
|
264
|
-
|
|
265
|
-
```
|
|
266
|
-
Production code → test exists and failed first
|
|
267
|
-
Otherwise → not TDD
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
No exceptions without your human partner's permission.
|
|
271
|
-
|
|
272
|
-
## Agent Tools Reference
|
|
273
|
-
|
|
274
|
-
| Op | When to Use |
|
|
275
|
-
| -------------------- | ------------------------------------- |
|
|
276
|
-
| `search_intelligent` | Find testing patterns before starting |
|
|
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 |
|