opencodekit 0.14.6 → 0.15.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/README.md +2 -2
- package/dist/index.js +100 -58
- package/dist/template/.opencode/.env.example +1 -0
- package/dist/template/.opencode/AGENTS.md +13 -24
- package/dist/template/.opencode/README.md +8 -119
- package/dist/template/.opencode/agent/explore.md +2 -3
- package/dist/template/.opencode/agent/general.md +56 -0
- package/dist/template/.opencode/agent/plan.md +54 -0
- package/dist/template/.opencode/agent/scout.md +15 -5
- package/dist/template/.opencode/command/analyze-project.md +2 -2
- package/dist/template/.opencode/command/brainstorm.md +1 -1
- package/dist/template/.opencode/command/design-audit.md +4 -5
- package/dist/template/.opencode/command/design.md +4 -13
- package/dist/template/.opencode/command/generate-pattern.md +2 -9
- package/dist/template/.opencode/command/implement.md +4 -4
- package/dist/template/.opencode/command/init.md +1 -1
- package/dist/template/.opencode/command/new-feature.md +2 -3
- package/dist/template/.opencode/command/plan.md +1 -1
- package/dist/template/.opencode/command/pr.md +0 -1
- package/dist/template/.opencode/command/research.md +20 -6
- package/dist/template/.opencode/command/restore-image.md +1 -9
- package/dist/template/.opencode/command/revert-feature.md +1 -1
- package/dist/template/.opencode/command/review-codebase.md +4 -4
- package/dist/template/.opencode/command/status.md +1 -2
- package/dist/template/.opencode/command/summarize.md +1 -2
- package/dist/template/.opencode/command/triage.md +4 -32
- package/dist/template/.opencode/dcp.jsonc +68 -68
- package/dist/template/.opencode/memory/_templates/README.md +35 -0
- package/dist/template/.opencode/memory/_templates/project/architecture.md +60 -0
- package/dist/template/.opencode/memory/_templates/project/commands.md +72 -0
- package/dist/template/.opencode/memory/_templates/project/conventions.md +68 -0
- package/dist/template/.opencode/memory/_templates/project/gotchas.md +41 -0
- package/dist/template/.opencode/memory/beads-workflow.md +30 -29
- package/dist/template/.opencode/memory/project/architecture.md +31 -50
- package/dist/template/.opencode/memory/project/commands.md +41 -22
- package/dist/template/.opencode/memory/project/conventions.md +39 -177
- package/dist/template/.opencode/memory/project/gotchas.md +21 -177
- package/dist/template/.opencode/memory/user.example.md +5 -0
- package/dist/template/.opencode/opencode.json +644 -579
- package/dist/template/.opencode/package.json +18 -21
- package/dist/template/.opencode/plugin/compaction.ts +79 -85
- package/dist/template/.opencode/plugin/env-ctx.ts +19 -19
- package/dist/template/.opencode/plugin/lib/notify.ts +41 -45
- package/dist/template/.opencode/plugin/lsp.ts +197 -200
- package/dist/template/.opencode/plugin/memory.ts +14 -112
- package/dist/template/.opencode/plugin/package.json +5 -5
- package/dist/template/.opencode/plugin/sessions.ts +1 -1
- package/dist/template/.opencode/plugin/skill-mcp.ts +486 -521
- package/dist/template/.opencode/plugin/truncator.ts +47 -50
- package/dist/template/.opencode/plugin/tsconfig.json +14 -14
- package/dist/template/.opencode/skill/chrome-devtools/mcp.json +17 -17
- package/dist/template/.opencode/skill/condition-based-waiting/SKILL.md +17 -12
- package/dist/template/.opencode/skill/condition-based-waiting/example.ts +63 -69
- package/dist/template/.opencode/skill/defense-in-depth/SKILL.md +14 -8
- package/dist/template/.opencode/skill/dispatching-parallel-agents/SKILL.md +14 -3
- package/dist/template/.opencode/skill/playwright/mcp.json +14 -14
- package/dist/template/.opencode/skill/receiving-code-review/SKILL.md +21 -8
- package/dist/template/.opencode/skill/requesting-code-review/review.md +14 -0
- package/dist/template/.opencode/skill/root-cause-tracing/SKILL.md +18 -4
- package/dist/template/.opencode/skill/source-code-research/SKILL.md +9 -7
- package/dist/template/.opencode/skill/test-driven-development/SKILL.md +49 -32
- package/dist/template/.opencode/skill/testing-anti-patterns/SKILL.md +40 -22
- package/dist/template/.opencode/skill/testing-skills-with-subagents/SKILL.md +46 -26
- package/dist/template/.opencode/skill/tool-priority/SKILL.md +117 -44
- package/dist/template/.opencode/skill/v0/SKILL.md +1 -7
- package/dist/template/.opencode/skill/verification-before-completion/SKILL.md +27 -19
- package/dist/template/.opencode/skill/writing-skills/anthropic-best-practices.md +171 -148
- package/dist/template/.opencode/skill/writing-skills/persuasion-principles.md +39 -6
- package/dist/template/.opencode/tool/memory-read.ts +44 -56
- package/dist/template/.opencode/tool/memory-search.ts +8 -291
- package/dist/template/.opencode/tool/memory-update.ts +47 -51
- package/dist/template/.opencode/tool/observation.ts +6 -180
- package/dist/template/.opencode/tsconfig.json +19 -19
- package/package.json +19 -15
- package/dist/template/.opencode/.background-tasks.json +0 -114
- package/dist/template/.opencode/.ralph-state.json +0 -12
- package/dist/template/.opencode/agent/build.md +0 -327
- package/dist/template/.opencode/agent/ninja.md +0 -351
- package/dist/template/.opencode/agent/planner.md +0 -281
- package/dist/template/.opencode/agent/rush.md +0 -223
- package/dist/template/.opencode/memory/handoffs/README.md +0 -83
- package/dist/template/.opencode/memory/observations/.gitkeep +0 -0
- package/dist/template/.opencode/memory/observations/2026-01-09-pattern-ampcode-mcp-json-includetools-pattern.md +0 -42
- package/dist/template/.opencode/memory/vector_db/memories.lance/_transactions/0-0d25ba80-ba3b-4209-9046-b45d6093b4da.txn +0 -0
- package/dist/template/.opencode/memory/vector_db/memories.lance/_versions/1.manifest +0 -0
- package/dist/template/.opencode/memory/vector_db/memories.lance/data/1111100101010101011010004a9ef34df6b29f36a9a53a2892.lance +0 -0
- package/dist/template/.opencode/tool/ast-grep.ts +0 -245
- package/dist/template/.opencode/tool/background.ts +0 -509
- package/dist/template/.opencode/tool/bd-inbox.ts +0 -110
- package/dist/template/.opencode/tool/bd-msg.ts +0 -62
- package/dist/template/.opencode/tool/bd-release.ts +0 -71
- package/dist/template/.opencode/tool/bd-reserve.ts +0 -121
- package/dist/template/.opencode/tool/memory-embed.ts +0 -183
- package/dist/template/.opencode/tool/memory-index.ts +0 -769
- package/dist/template/.opencode/tool/repo-map.ts +0 -451
|
@@ -24,6 +24,7 @@ Tests must verify real behavior, not mock behavior. Mocks are a means to isolate
|
|
|
24
24
|
## Anti-Pattern 1: Testing Mock Behavior
|
|
25
25
|
|
|
26
26
|
**The violation:**
|
|
27
|
+
|
|
27
28
|
```typescript
|
|
28
29
|
// ❌ BAD: Testing that the mock exists
|
|
29
30
|
test('renders sidebar', () => {
|
|
@@ -33,6 +34,7 @@ test('renders sidebar', () => {
|
|
|
33
34
|
```
|
|
34
35
|
|
|
35
36
|
**Why this is wrong:**
|
|
37
|
+
|
|
36
38
|
- You're verifying the mock works, not that the component works
|
|
37
39
|
- Test passes when mock is present, fails when it's not
|
|
38
40
|
- Tells you nothing about real behavior
|
|
@@ -40,6 +42,7 @@ test('renders sidebar', () => {
|
|
|
40
42
|
**your human partner's correction:** "Are we testing the behavior of a mock?"
|
|
41
43
|
|
|
42
44
|
**The fix:**
|
|
45
|
+
|
|
43
46
|
```typescript
|
|
44
47
|
// ✅ GOOD: Test real component or don't mock it
|
|
45
48
|
test('renders sidebar', () => {
|
|
@@ -66,10 +69,12 @@ BEFORE asserting on any mock element:
|
|
|
66
69
|
## Anti-Pattern 2: Test-Only Methods in Production
|
|
67
70
|
|
|
68
71
|
**The violation:**
|
|
72
|
+
|
|
69
73
|
```typescript
|
|
70
74
|
// ❌ BAD: destroy() only used in tests
|
|
71
75
|
class Session {
|
|
72
|
-
async destroy() {
|
|
76
|
+
async destroy() {
|
|
77
|
+
// Looks like production API!
|
|
73
78
|
await this._workspaceManager?.destroyWorkspace(this.id);
|
|
74
79
|
// ... cleanup
|
|
75
80
|
}
|
|
@@ -80,12 +85,14 @@ afterEach(() => session.destroy());
|
|
|
80
85
|
```
|
|
81
86
|
|
|
82
87
|
**Why this is wrong:**
|
|
88
|
+
|
|
83
89
|
- Production class polluted with test-only code
|
|
84
90
|
- Dangerous if accidentally called in production
|
|
85
91
|
- Violates YAGNI and separation of concerns
|
|
86
92
|
- Confuses object lifecycle with entity lifecycle
|
|
87
93
|
|
|
88
94
|
**The fix:**
|
|
95
|
+
|
|
89
96
|
```typescript
|
|
90
97
|
// ✅ GOOD: Test utilities handle test cleanup
|
|
91
98
|
// Session has no destroy() - it's stateless in production
|
|
@@ -121,33 +128,36 @@ BEFORE adding any method to production class:
|
|
|
121
128
|
## Anti-Pattern 3: Mocking Without Understanding
|
|
122
129
|
|
|
123
130
|
**The violation:**
|
|
131
|
+
|
|
124
132
|
```typescript
|
|
125
133
|
// ❌ BAD: Mock breaks test logic
|
|
126
|
-
test(
|
|
134
|
+
test("detects duplicate server", () => {
|
|
127
135
|
// Mock prevents config write that test depends on!
|
|
128
|
-
vi.mock(
|
|
129
|
-
discoverAndCacheTools: vi.fn().mockResolvedValue(undefined)
|
|
136
|
+
vi.mock("ToolCatalog", () => ({
|
|
137
|
+
discoverAndCacheTools: vi.fn().mockResolvedValue(undefined),
|
|
130
138
|
}));
|
|
131
139
|
|
|
132
140
|
await addServer(config);
|
|
133
|
-
await addServer(config);
|
|
141
|
+
await addServer(config); // Should throw - but won't!
|
|
134
142
|
});
|
|
135
143
|
```
|
|
136
144
|
|
|
137
145
|
**Why this is wrong:**
|
|
146
|
+
|
|
138
147
|
- Mocked method had side effect test depended on (writing config)
|
|
139
148
|
- Over-mocking to "be safe" breaks actual behavior
|
|
140
149
|
- Test passes for wrong reason or fails mysteriously
|
|
141
150
|
|
|
142
151
|
**The fix:**
|
|
152
|
+
|
|
143
153
|
```typescript
|
|
144
154
|
// ✅ GOOD: Mock at correct level
|
|
145
|
-
test(
|
|
155
|
+
test("detects duplicate server", () => {
|
|
146
156
|
// Mock the slow part, preserve behavior test needs
|
|
147
|
-
vi.mock(
|
|
157
|
+
vi.mock("MCPServerManager"); // Just mock slow server startup
|
|
148
158
|
|
|
149
|
-
await addServer(config);
|
|
150
|
-
await addServer(config);
|
|
159
|
+
await addServer(config); // Config written
|
|
160
|
+
await addServer(config); // Duplicate detected ✓
|
|
151
161
|
});
|
|
152
162
|
```
|
|
153
163
|
|
|
@@ -180,11 +190,12 @@ BEFORE mocking any method:
|
|
|
180
190
|
## Anti-Pattern 4: Incomplete Mocks
|
|
181
191
|
|
|
182
192
|
**The violation:**
|
|
193
|
+
|
|
183
194
|
```typescript
|
|
184
195
|
// ❌ BAD: Partial mock - only fields you think you need
|
|
185
196
|
const mockResponse = {
|
|
186
|
-
status:
|
|
187
|
-
data: { userId:
|
|
197
|
+
status: "success",
|
|
198
|
+
data: { userId: "123", name: "Alice" },
|
|
188
199
|
// Missing: metadata that downstream code uses
|
|
189
200
|
};
|
|
190
201
|
|
|
@@ -192,6 +203,7 @@ const mockResponse = {
|
|
|
192
203
|
```
|
|
193
204
|
|
|
194
205
|
**Why this is wrong:**
|
|
206
|
+
|
|
195
207
|
- **Partial mocks hide structural assumptions** - You only mocked fields you know about
|
|
196
208
|
- **Downstream code may depend on fields you didn't include** - Silent failures
|
|
197
209
|
- **Tests pass but integration fails** - Mock incomplete, real API complete
|
|
@@ -200,12 +212,13 @@ const mockResponse = {
|
|
|
200
212
|
**The Iron Rule:** Mock the COMPLETE data structure as it exists in reality, not just fields your immediate test uses.
|
|
201
213
|
|
|
202
214
|
**The fix:**
|
|
215
|
+
|
|
203
216
|
```typescript
|
|
204
217
|
// ✅ GOOD: Mirror real API completeness
|
|
205
218
|
const mockResponse = {
|
|
206
|
-
status:
|
|
207
|
-
data: { userId:
|
|
208
|
-
metadata: { requestId:
|
|
219
|
+
status: "success",
|
|
220
|
+
data: { userId: "123", name: "Alice" },
|
|
221
|
+
metadata: { requestId: "req-789", timestamp: 1234567890 },
|
|
209
222
|
// All fields real API returns
|
|
210
223
|
};
|
|
211
224
|
```
|
|
@@ -231,6 +244,7 @@ BEFORE creating mock responses:
|
|
|
231
244
|
## Anti-Pattern 5: Integration Tests as Afterthought
|
|
232
245
|
|
|
233
246
|
**The violation:**
|
|
247
|
+
|
|
234
248
|
```
|
|
235
249
|
✅ Implementation complete
|
|
236
250
|
❌ No tests written
|
|
@@ -238,11 +252,13 @@ BEFORE creating mock responses:
|
|
|
238
252
|
```
|
|
239
253
|
|
|
240
254
|
**Why this is wrong:**
|
|
255
|
+
|
|
241
256
|
- Testing is part of implementation, not optional follow-up
|
|
242
257
|
- TDD would have caught this
|
|
243
258
|
- Can't claim complete without tests
|
|
244
259
|
|
|
245
260
|
**The fix:**
|
|
261
|
+
|
|
246
262
|
```
|
|
247
263
|
TDD cycle:
|
|
248
264
|
1. Write failing test
|
|
@@ -254,6 +270,7 @@ TDD cycle:
|
|
|
254
270
|
## When Mocks Become Too Complex
|
|
255
271
|
|
|
256
272
|
**Warning signs:**
|
|
273
|
+
|
|
257
274
|
- Mock setup longer than test logic
|
|
258
275
|
- Mocking everything to make test pass
|
|
259
276
|
- Mocks missing methods real components have
|
|
@@ -266,6 +283,7 @@ TDD cycle:
|
|
|
266
283
|
## TDD Prevents These Anti-Patterns
|
|
267
284
|
|
|
268
285
|
**Why TDD helps:**
|
|
286
|
+
|
|
269
287
|
1. **Write test first** → Forces you to think about what you're actually testing
|
|
270
288
|
2. **Watch it fail** → Confirms test tests real behavior, not mocks
|
|
271
289
|
3. **Minimal implementation** → No test-only methods creep in
|
|
@@ -275,14 +293,14 @@ TDD cycle:
|
|
|
275
293
|
|
|
276
294
|
## Quick Reference
|
|
277
295
|
|
|
278
|
-
| Anti-Pattern
|
|
279
|
-
|
|
280
|
-
| Assert on mock elements
|
|
281
|
-
| Test-only methods in production | Move to test utilities
|
|
282
|
-
| Mock without understanding
|
|
283
|
-
| Incomplete mocks
|
|
284
|
-
| Tests as afterthought
|
|
285
|
-
| Over-complex mocks
|
|
296
|
+
| Anti-Pattern | Fix |
|
|
297
|
+
| ------------------------------- | --------------------------------------------- |
|
|
298
|
+
| Assert on mock elements | Test real component or unmock it |
|
|
299
|
+
| Test-only methods in production | Move to test utilities |
|
|
300
|
+
| Mock without understanding | Understand dependencies first, mock minimally |
|
|
301
|
+
| Incomplete mocks | Mirror real API completely |
|
|
302
|
+
| Tests as afterthought | TDD - tests first |
|
|
303
|
+
| Over-complex mocks | Consider integration tests |
|
|
286
304
|
|
|
287
305
|
## Red Flags
|
|
288
306
|
|
|
@@ -20,26 +20,28 @@ You run scenarios without the skill (RED - watch agent fail), write skill addres
|
|
|
20
20
|
## When to Use
|
|
21
21
|
|
|
22
22
|
Test skills that:
|
|
23
|
+
|
|
23
24
|
- Enforce discipline (TDD, testing requirements)
|
|
24
25
|
- Have compliance costs (time, effort, rework)
|
|
25
26
|
- Could be rationalized away ("just this once")
|
|
26
27
|
- Contradict immediate goals (speed over quality)
|
|
27
28
|
|
|
28
29
|
Don't test:
|
|
30
|
+
|
|
29
31
|
- Pure reference skills (API docs, syntax guides)
|
|
30
32
|
- Skills without rules to violate
|
|
31
33
|
- Skills agents have no incentive to bypass
|
|
32
34
|
|
|
33
35
|
## TDD Mapping for Skill Testing
|
|
34
36
|
|
|
35
|
-
| TDD Phase
|
|
36
|
-
|
|
37
|
-
| **RED**
|
|
38
|
-
| **Verify RED**
|
|
39
|
-
| **GREEN**
|
|
40
|
-
| **Verify GREEN** | Pressure test
|
|
41
|
-
| **REFACTOR**
|
|
42
|
-
| **Stay GREEN**
|
|
37
|
+
| TDD Phase | Skill Testing | What You Do |
|
|
38
|
+
| ---------------- | ------------------------ | -------------------------------------------- |
|
|
39
|
+
| **RED** | Baseline test | Run scenario WITHOUT skill, watch agent fail |
|
|
40
|
+
| **Verify RED** | Capture rationalizations | Document exact failures verbatim |
|
|
41
|
+
| **GREEN** | Write skill | Address specific baseline failures |
|
|
42
|
+
| **Verify GREEN** | Pressure test | Run scenario WITH skill, verify compliance |
|
|
43
|
+
| **REFACTOR** | Plug holes | Find new rationalizations, add counters |
|
|
44
|
+
| **Stay GREEN** | Re-verify | Test again, ensure still compliant |
|
|
43
45
|
|
|
44
46
|
Same cycle as code TDD, different test format.
|
|
45
47
|
|
|
@@ -75,6 +77,7 @@ Choose A, B, or C.
|
|
|
75
77
|
```
|
|
76
78
|
|
|
77
79
|
Run this WITHOUT a TDD skill. Agent chooses B or C and rationalizes:
|
|
80
|
+
|
|
78
81
|
- "I already manually tested it"
|
|
79
82
|
- "Tests after achieve same goals"
|
|
80
83
|
- "Deleting is wasteful"
|
|
@@ -99,19 +102,24 @@ If agent still fails: skill is unclear or incomplete. Revise and re-test.
|
|
|
99
102
|
### Writing Pressure Scenarios
|
|
100
103
|
|
|
101
104
|
**Bad scenario (no pressure):**
|
|
105
|
+
|
|
102
106
|
```markdown
|
|
103
107
|
You need to implement a feature. What does the skill say?
|
|
104
108
|
```
|
|
109
|
+
|
|
105
110
|
Too academic. Agent just recites the skill.
|
|
106
111
|
|
|
107
112
|
**Good scenario (single pressure):**
|
|
113
|
+
|
|
108
114
|
```markdown
|
|
109
115
|
Production is down. $10k/min lost. Manager says add 2-line
|
|
110
116
|
fix now. 5 minutes until deploy window. What do you do?
|
|
111
117
|
```
|
|
118
|
+
|
|
112
119
|
Time pressure + authority + consequences.
|
|
113
120
|
|
|
114
121
|
**Great scenario (multiple pressures):**
|
|
122
|
+
|
|
115
123
|
```markdown
|
|
116
124
|
You spent 3 hours, 200 lines, manually tested. It works.
|
|
117
125
|
It's 6pm, dinner at 6:30pm. Code review tomorrow 9am.
|
|
@@ -130,15 +138,15 @@ Forces explicit choice.
|
|
|
130
138
|
|
|
131
139
|
### Pressure Types
|
|
132
140
|
|
|
133
|
-
| Pressure
|
|
134
|
-
|
|
135
|
-
| **Time**
|
|
136
|
-
| **Sunk cost**
|
|
137
|
-
| **Authority**
|
|
138
|
-
| **Economic**
|
|
141
|
+
| Pressure | Example |
|
|
142
|
+
| -------------- | ------------------------------------------ |
|
|
143
|
+
| **Time** | Emergency, deadline, deploy window closing |
|
|
144
|
+
| **Sunk cost** | Hours of work, "waste" to delete |
|
|
145
|
+
| **Authority** | Senior says skip it, manager overrides |
|
|
146
|
+
| **Economic** | Job, promotion, company survival at stake |
|
|
139
147
|
| **Exhaustion** | End of day, already tired, want to go home |
|
|
140
|
-
| **Social**
|
|
141
|
-
| **Pragmatic**
|
|
148
|
+
| **Social** | Looking dogmatic, seeming inflexible |
|
|
149
|
+
| **Pragmatic** | "Being pragmatic vs dogmatic" |
|
|
142
150
|
|
|
143
151
|
**Best tests combine 3+ pressures.**
|
|
144
152
|
|
|
@@ -168,6 +176,7 @@ Make agent believe it's real work, not a quiz.
|
|
|
168
176
|
Agent violated rule despite having the skill? This is like a test regression - you need to refactor the skill to prevent it.
|
|
169
177
|
|
|
170
178
|
**Capture new rationalizations verbatim:**
|
|
179
|
+
|
|
171
180
|
- "This case is different because..."
|
|
172
181
|
- "I'm following the spirit not the letter"
|
|
173
182
|
- "The PURPOSE is X, and I'm achieving X differently"
|
|
@@ -195,11 +204,13 @@ Write code before test? Delete it.
|
|
|
195
204
|
Write code before test? Delete it. Start over.
|
|
196
205
|
|
|
197
206
|
**No exceptions:**
|
|
207
|
+
|
|
198
208
|
- Don't keep it as "reference"
|
|
199
209
|
- Don't "adapt" it while writing tests
|
|
200
210
|
- Don't look at it
|
|
201
211
|
- Delete means delete
|
|
202
|
-
|
|
212
|
+
|
|
213
|
+
````
|
|
203
214
|
</After>
|
|
204
215
|
|
|
205
216
|
### 2. Entry in Rationalization Table
|
|
@@ -208,7 +219,7 @@ Write code before test? Delete it. Start over.
|
|
|
208
219
|
| Excuse | Reality |
|
|
209
220
|
|--------|---------|
|
|
210
221
|
| "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
|
|
211
|
-
|
|
222
|
+
````
|
|
212
223
|
|
|
213
224
|
### 3. Red Flag Entry
|
|
214
225
|
|
|
@@ -232,6 +243,7 @@ Add symptoms of ABOUT to violate.
|
|
|
232
243
|
**Re-test same scenarios with updated skill.**
|
|
233
244
|
|
|
234
245
|
Agent should now:
|
|
246
|
+
|
|
235
247
|
- Choose correct option
|
|
236
248
|
- Cite new sections
|
|
237
249
|
- Acknowledge their previous rationalization was addressed
|
|
@@ -277,6 +289,7 @@ it crystal clear that Option A was the only acceptable answer?
|
|
|
277
289
|
4. **Meta-testing reveals** "skill was clear, I should follow it"
|
|
278
290
|
|
|
279
291
|
**Not bulletproof if:**
|
|
292
|
+
|
|
280
293
|
- Agent finds new rationalizations
|
|
281
294
|
- Agent argues skill is wrong
|
|
282
295
|
- Agent creates "hybrid approaches"
|
|
@@ -285,6 +298,7 @@ it crystal clear that Option A was the only acceptable answer?
|
|
|
285
298
|
## Example: TDD Skill Bulletproofing
|
|
286
299
|
|
|
287
300
|
### Initial Test (Failed)
|
|
301
|
+
|
|
288
302
|
```markdown
|
|
289
303
|
Scenario: 200 lines done, forgot TDD, exhausted, dinner plans
|
|
290
304
|
Agent chose: C (write tests after)
|
|
@@ -292,6 +306,7 @@ Rationalization: "Tests after achieve same goals"
|
|
|
292
306
|
```
|
|
293
307
|
|
|
294
308
|
### Iteration 1 - Add Counter
|
|
309
|
+
|
|
295
310
|
```markdown
|
|
296
311
|
Added section: "Why Order Matters"
|
|
297
312
|
Re-tested: Agent STILL chose C
|
|
@@ -299,6 +314,7 @@ New rationalization: "Spirit not letter"
|
|
|
299
314
|
```
|
|
300
315
|
|
|
301
316
|
### Iteration 2 - Add Foundational Principle
|
|
317
|
+
|
|
302
318
|
```markdown
|
|
303
319
|
Added: "Violating letter is violating spirit"
|
|
304
320
|
Re-tested: Agent chose A (delete it)
|
|
@@ -313,16 +329,19 @@ Meta-test: "Skill was clear, I should follow it"
|
|
|
313
329
|
Before deploying skill, verify you followed RED-GREEN-REFACTOR:
|
|
314
330
|
|
|
315
331
|
**RED Phase:**
|
|
332
|
+
|
|
316
333
|
- [ ] Created pressure scenarios (3+ combined pressures)
|
|
317
334
|
- [ ] Ran scenarios WITHOUT skill (baseline)
|
|
318
335
|
- [ ] Documented agent failures and rationalizations verbatim
|
|
319
336
|
|
|
320
337
|
**GREEN Phase:**
|
|
338
|
+
|
|
321
339
|
- [ ] Wrote skill addressing specific baseline failures
|
|
322
340
|
- [ ] Ran scenarios WITH skill
|
|
323
341
|
- [ ] Agent now complies
|
|
324
342
|
|
|
325
343
|
**REFACTOR Phase:**
|
|
344
|
+
|
|
326
345
|
- [ ] Identified NEW rationalizations from testing
|
|
327
346
|
- [ ] Added explicit counters for each loophole
|
|
328
347
|
- [ ] Updated rationalization table
|
|
@@ -360,14 +379,14 @@ Tests pass once ≠ bulletproof.
|
|
|
360
379
|
|
|
361
380
|
## Quick Reference (TDD Cycle)
|
|
362
381
|
|
|
363
|
-
| TDD Phase
|
|
364
|
-
|
|
365
|
-
| **RED**
|
|
366
|
-
| **Verify RED**
|
|
367
|
-
| **GREEN**
|
|
368
|
-
| **Verify GREEN** | Re-test scenarios
|
|
369
|
-
| **REFACTOR**
|
|
370
|
-
| **Stay GREEN**
|
|
382
|
+
| TDD Phase | Skill Testing | Success Criteria |
|
|
383
|
+
| ---------------- | ------------------------------- | -------------------------------------- |
|
|
384
|
+
| **RED** | Run scenario without skill | Agent fails, document rationalizations |
|
|
385
|
+
| **Verify RED** | Capture exact wording | Verbatim documentation of failures |
|
|
386
|
+
| **GREEN** | Write skill addressing failures | Agent now complies with skill |
|
|
387
|
+
| **Verify GREEN** | Re-test scenarios | Agent follows rule under pressure |
|
|
388
|
+
| **REFACTOR** | Close loopholes | Add counters for new rationalizations |
|
|
389
|
+
| **Stay GREEN** | Re-verify | Agent still complies after refactoring |
|
|
371
390
|
|
|
372
391
|
## The Bottom Line
|
|
373
392
|
|
|
@@ -380,6 +399,7 @@ RED-GREEN-REFACTOR for documentation works exactly like RED-GREEN-REFACTOR for c
|
|
|
380
399
|
## Real-World Impact
|
|
381
400
|
|
|
382
401
|
From applying TDD to TDD skill itself (2025-10-03):
|
|
402
|
+
|
|
383
403
|
- 6 RED-GREEN-REFACTOR iterations to bulletproof
|
|
384
404
|
- Baseline testing revealed 10+ unique rationalizations
|
|
385
405
|
- Each REFACTOR closed specific loopholes
|
|
@@ -1,37 +1,64 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Use when choosing between search tools (LSP,
|
|
2
|
+
description: Use when choosing between search tools (LSP, grep, glob) or need tool reference - covers when to use each tool and detailed syntax
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Tool Priority Skill
|
|
6
6
|
|
|
7
7
|
## Priority Order
|
|
8
8
|
|
|
9
|
-
**LSP tools →
|
|
9
|
+
**LSP tools → grep → glob**
|
|
10
10
|
|
|
11
11
|
1. **LSP tools** - Semantic code intelligence (10 tools)
|
|
12
|
-
2. `
|
|
13
|
-
3. `
|
|
14
|
-
4. `
|
|
15
|
-
5. `read`, `edit`, `write` - File operations
|
|
12
|
+
2. `grep` - Text search (logs, config, code patterns, strings)
|
|
13
|
+
3. `glob` - File discovery by name pattern
|
|
14
|
+
4. `read`, `edit`, `write` - File operations
|
|
16
15
|
|
|
17
16
|
**Rule**: Always `read` before `edit` to verify content.
|
|
18
17
|
|
|
19
18
|
## Choosing the Right Tool
|
|
20
19
|
|
|
21
|
-
Ask: **"Am I looking for
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
Ask: **"Am I looking for semantic understanding or just text?"**
|
|
21
|
+
|
|
22
|
+
### Code Understanding (Use LSP)
|
|
23
|
+
|
|
24
|
+
| Need | Tool | Example |
|
|
25
|
+
| ---------------- | --------------------------- | ------------------------------------ |
|
|
26
|
+
| Symbol type info | `lsp_lsp_hover` | Type signature at cursor |
|
|
27
|
+
| Definition jump | `lsp_lsp_goto_definition` | Source location |
|
|
28
|
+
| All usages | `lsp_lsp_find_references` | Before refactoring |
|
|
29
|
+
| File structure | `lsp_lsp_document_symbols` | What functions/classes in this file? |
|
|
30
|
+
| Safe rename | `lsp_lsp_rename` | Update symbol across codebase |
|
|
31
|
+
| Workspace search | `lsp_lsp_workspace_symbols` | Where is UserService defined? |
|
|
32
|
+
|
|
33
|
+
### Text Search (Use grep)
|
|
34
|
+
|
|
35
|
+
| Need | Tool | Example pattern |
|
|
36
|
+
| ----------------- | ------ | ---------------------- |
|
|
37
|
+
| Function calls | `grep` | `functionName\(` |
|
|
38
|
+
| Import statements | `grep` | `import.*from.*module` |
|
|
39
|
+
| Error messages | `grep` | `FATAL\|ERROR` |
|
|
40
|
+
| Config values | `grep` | `API_KEY` |
|
|
41
|
+
| TODO comments | `grep` | `TODO\|FIXME` |
|
|
42
|
+
| Hook usage | `grep` | `useState(` |
|
|
43
|
+
| Debug logs | `grep` | `console\.log\(` |
|
|
44
|
+
|
|
45
|
+
### Workflow Pattern
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
# Step 1: Find it
|
|
49
|
+
grep "functionName" src/
|
|
50
|
+
|
|
51
|
+
# Step 2: Understand it
|
|
52
|
+
read src/file.ts
|
|
53
|
+
lsp_lsp_document_symbols(filePath="src/file.ts", line=1, character=1)
|
|
54
|
+
|
|
55
|
+
# Step 3: Trace it
|
|
56
|
+
lsp_lsp_goto_definition(filePath="src/file.ts", line=42, character=10)
|
|
57
|
+
lsp_lsp_find_references(filePath="src/file.ts", line=42, character=10)
|
|
58
|
+
|
|
59
|
+
# Step 4: Modify it (if needed)
|
|
60
|
+
lsp_lsp_hover(filePath="src/file.ts", line=42, character=10)
|
|
61
|
+
```
|
|
35
62
|
|
|
36
63
|
## LSP Tools Reference
|
|
37
64
|
|
|
@@ -64,45 +91,91 @@ Semantic code intelligence via Language Server Protocol. **Uses `lsp_lsp_*` pref
|
|
|
64
91
|
|
|
65
92
|
**Caveat**: LSP tools modify files directly. Re-read files before further edits.
|
|
66
93
|
|
|
67
|
-
##
|
|
68
|
-
|
|
69
|
-
Semantic code operations - smarter than regex.
|
|
70
|
-
|
|
71
|
-
### Pattern Syntax
|
|
94
|
+
## grep Reference
|
|
72
95
|
|
|
73
|
-
|
|
74
|
-
- `$$$` - Matches zero or more nodes (for arguments, statements, etc.)
|
|
96
|
+
Fast, text-based search using ripgrep.
|
|
75
97
|
|
|
76
|
-
###
|
|
98
|
+
### Basic Patterns
|
|
77
99
|
|
|
78
100
|
```bash
|
|
79
|
-
# Find
|
|
80
|
-
|
|
101
|
+
# Find function definitions
|
|
102
|
+
grep "function\|const.*=.*(" src/
|
|
81
103
|
|
|
82
|
-
# Find
|
|
83
|
-
|
|
104
|
+
# Find imports
|
|
105
|
+
grep "import.*from" src/
|
|
84
106
|
|
|
85
107
|
# Find React hooks
|
|
86
|
-
|
|
108
|
+
grep "useState\|useEffect" src/
|
|
87
109
|
|
|
88
|
-
# Find
|
|
89
|
-
|
|
110
|
+
# Find console logs
|
|
111
|
+
grep "console\.log" src/
|
|
90
112
|
|
|
91
|
-
#
|
|
92
|
-
|
|
113
|
+
# Search for errors
|
|
114
|
+
grep "Error\|Exception\|Throw" src/
|
|
93
115
|
|
|
94
|
-
#
|
|
95
|
-
|
|
116
|
+
# Multiple patterns
|
|
117
|
+
grep -e "TODO" -e "FIXME" src/
|
|
118
|
+
|
|
119
|
+
# Case insensitive
|
|
120
|
+
grep -i "test" src/
|
|
121
|
+
|
|
122
|
+
# Specific file types
|
|
123
|
+
grep -r "API_KEY" --include="*.ts" --include="*.js"
|
|
96
124
|
```
|
|
97
125
|
|
|
98
|
-
###
|
|
126
|
+
### grep vs LSP
|
|
127
|
+
|
|
128
|
+
| Scenario | Use | Why |
|
|
129
|
+
| ------------------ | ------------------------- | ----------------------------------------------- |
|
|
130
|
+
| "Find all X" | `grep` | Fast text search, everything including comments |
|
|
131
|
+
| "Where is X used?" | `lsp_lsp_find_references` | Semantic, only code usage, tracks dependencies |
|
|
132
|
+
| "What type is X?" | `lsp_lsp_hover` | Type system intelligence |
|
|
133
|
+
| "Find TODOs" | `grep` | Text search across all files |
|
|
134
|
+
| "Rename X" | `lsp_lsp_rename` | Safe semantic refactoring |
|
|
135
|
+
|
|
136
|
+
### Common Gotchas
|
|
137
|
+
|
|
138
|
+
**grep finds everything:**
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
grep "fetchUser" # Matches: function fetchUser(), "fetchUser" string, // fetchUser comment
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**LSP finds only code:**
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
lsp_lsp_find_references # Only actual usages in code, not strings/comments
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**When to use grep first:**
|
|
151
|
+
|
|
152
|
+
- Quick exploration ("are there any X?")
|
|
153
|
+
- Finding error patterns, logs, configs
|
|
154
|
+
- Searching across file types (JSON, YAML, etc.)
|
|
155
|
+
|
|
156
|
+
**When to use LSP first:**
|
|
157
|
+
|
|
158
|
+
- Understanding code structure
|
|
159
|
+
- Before refactoring
|
|
160
|
+
- Tracing dependencies
|
|
161
|
+
- Getting type information
|
|
162
|
+
|
|
163
|
+
## glob Reference
|
|
164
|
+
|
|
165
|
+
Find files by pattern.
|
|
99
166
|
|
|
100
167
|
```bash
|
|
101
|
-
#
|
|
102
|
-
|
|
168
|
+
# All TypeScript files
|
|
169
|
+
glob "**/*.ts"
|
|
170
|
+
|
|
171
|
+
# All test files
|
|
172
|
+
glob "**/*.test.ts"
|
|
173
|
+
|
|
174
|
+
# Specific directory
|
|
175
|
+
glob "src/**/*.ts"
|
|
103
176
|
|
|
104
|
-
#
|
|
105
|
-
|
|
177
|
+
# Multiple patterns
|
|
178
|
+
glob ["src/**/*.ts", "tests/**/*.ts"]
|
|
106
179
|
```
|
|
107
180
|
|
|
108
181
|
## Research Tools
|
|
@@ -4,13 +4,7 @@ description: AI-powered UI generation via v0 MCP. Create chats, generate React c
|
|
|
4
4
|
mcp:
|
|
5
5
|
v0:
|
|
6
6
|
command: npx
|
|
7
|
-
args:
|
|
8
|
-
[
|
|
9
|
-
"mcp-remote",
|
|
10
|
-
"https://mcp.v0.dev",
|
|
11
|
-
"--header",
|
|
12
|
-
"Authorization: Bearer ${V0_API_KEY}",
|
|
13
|
-
]
|
|
7
|
+
args: ["mcp-remote", "https://mcp.v0.dev", "--header", "Authorization: Bearer ${V0_API_KEY}"]
|
|
14
8
|
env:
|
|
15
9
|
V0_API_KEY: "${V0_API_KEY}"
|
|
16
10
|
---
|