liteagents 2.4.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/CHANGELOG.md +441 -0
- package/LICENSE +21 -0
- package/README.md +179 -0
- package/cli.js +230 -0
- package/docs/.gitkeep +1 -0
- package/docs/CONTRIBUTING.md +739 -0
- package/docs/DUAL_PUBLISH_SUMMARY.md +177 -0
- package/docs/ERROR_HANDLING_IMPLEMENTATION.md +327 -0
- package/docs/GITHUB_PACKAGES.md +181 -0
- package/docs/GITHUB_SETUP.md +158 -0
- package/docs/INSTALLATION_DEMO.md +691 -0
- package/docs/INSTALLATION_LOCATIONS.md +299 -0
- package/docs/INSTALLER_GUIDE.md +1586 -0
- package/docs/INTEGRATION_ISSUES_9.1.md +341 -0
- package/docs/KNOWLEDGE_BASE.md +727 -0
- package/docs/MIGRATION.md +384 -0
- package/docs/PACKAGE_BASELINE.md +557 -0
- package/docs/PACKAGE_VALIDATION_REPORT.md +427 -0
- package/docs/PASS_INTEGRATION.md +307 -0
- package/docs/PASS_QUICK_START.md +150 -0
- package/docs/PRIVACY.md +203 -0
- package/docs/PUBLISHING.md +494 -0
- package/docs/QUICK-START.md +318 -0
- package/docs/RELEASE_NOTES_1.2.0.md +323 -0
- package/docs/SECURITY.md +317 -0
- package/docs/SILENT_MODE_GUIDE.md +526 -0
- package/docs/SKILLS_CONVERSION.md +154 -0
- package/docs/TESTING.md +582 -0
- package/docs/TEST_COVERAGE.md +347 -0
- package/docs/TROUBLESHOOTING.md +788 -0
- package/docs/UPDATED_VARIANT_CONFIGURATION.md +274 -0
- package/docs/VARIANT_CONFIGURATION.md +440 -0
- package/installer/cli.js +761 -0
- package/installer/installation-engine.js +1536 -0
- package/installer/package-manager.js +640 -0
- package/installer/path-manager.js +427 -0
- package/installer/report-template.js +298 -0
- package/installer/verification-system.js +274 -0
- package/package.json +83 -0
- package/packages/ampcode/AGENT.md +58 -0
- package/packages/ampcode/README.md +17 -0
- package/packages/ampcode/agents/1-create-prd.md +175 -0
- package/packages/ampcode/agents/2-generate-tasks.md +190 -0
- package/packages/ampcode/agents/3-process-task-list.md +225 -0
- package/packages/ampcode/agents/code-developer.md +198 -0
- package/packages/ampcode/agents/context-builder.md +142 -0
- package/packages/ampcode/agents/feature-planner.md +199 -0
- package/packages/ampcode/agents/market-researcher.md +89 -0
- package/packages/ampcode/agents/orchestrator.md +116 -0
- package/packages/ampcode/agents/quality-assurance.md +115 -0
- package/packages/ampcode/agents/system-architect.md +135 -0
- package/packages/ampcode/agents/ui-designer.md +184 -0
- package/packages/ampcode/commands/brainstorming.md +56 -0
- package/packages/ampcode/commands/code-review.md +107 -0
- package/packages/ampcode/commands/condition-based-waiting/example.ts +158 -0
- package/packages/ampcode/commands/condition-based-waiting.md +122 -0
- package/packages/ampcode/commands/debug.md +20 -0
- package/packages/ampcode/commands/docs-builder/templates.md +572 -0
- package/packages/ampcode/commands/docs-builder.md +106 -0
- package/packages/ampcode/commands/explain.md +18 -0
- package/packages/ampcode/commands/git-commit.md +14 -0
- package/packages/ampcode/commands/optimize.md +20 -0
- package/packages/ampcode/commands/refactor.md +21 -0
- package/packages/ampcode/commands/review.md +18 -0
- package/packages/ampcode/commands/root-cause-tracing/find-polluter.sh +63 -0
- package/packages/ampcode/commands/root-cause-tracing.md +176 -0
- package/packages/ampcode/commands/security.md +21 -0
- package/packages/ampcode/commands/ship.md +18 -0
- package/packages/ampcode/commands/skill-creator/scripts/init_skill.py +303 -0
- package/packages/ampcode/commands/skill-creator/scripts/package_skill.py +110 -0
- package/packages/ampcode/commands/skill-creator/scripts/quick_validate.py +65 -0
- package/packages/ampcode/commands/skill-creator.md +211 -0
- package/packages/ampcode/commands/stash.md +45 -0
- package/packages/ampcode/commands/systematic-debugging.md +297 -0
- package/packages/ampcode/commands/test-driven-development.md +390 -0
- package/packages/ampcode/commands/test-generate.md +18 -0
- package/packages/ampcode/commands/testing-anti-patterns.md +304 -0
- package/packages/ampcode/commands/verification-before-completion.md +152 -0
- package/packages/ampcode/settings.json +13 -0
- package/packages/ampcode/variants.json +8 -0
- package/packages/claude/CLAUDE.md +58 -0
- package/packages/claude/README.md +23 -0
- package/packages/claude/agents/1-create-prd.md +175 -0
- package/packages/claude/agents/2-generate-tasks.md +190 -0
- package/packages/claude/agents/3-process-task-list.md +225 -0
- package/packages/claude/agents/code-developer.md +198 -0
- package/packages/claude/agents/context-builder.md +142 -0
- package/packages/claude/agents/feature-planner.md +199 -0
- package/packages/claude/agents/market-researcher.md +89 -0
- package/packages/claude/agents/orchestrator.md +117 -0
- package/packages/claude/agents/quality-assurance.md +115 -0
- package/packages/claude/agents/system-architect.md +135 -0
- package/packages/claude/agents/ui-designer.md +184 -0
- package/packages/claude/commands/debug.md +20 -0
- package/packages/claude/commands/explain.md +18 -0
- package/packages/claude/commands/git-commit.md +14 -0
- package/packages/claude/commands/optimize.md +20 -0
- package/packages/claude/commands/refactor.md +21 -0
- package/packages/claude/commands/review.md +18 -0
- package/packages/claude/commands/security.md +21 -0
- package/packages/claude/commands/ship.md +18 -0
- package/packages/claude/commands/stash.md +45 -0
- package/packages/claude/commands/test-generate.md +18 -0
- package/packages/claude/skills/brainstorming/SKILL.md +56 -0
- package/packages/claude/skills/code-review/SKILL.md +107 -0
- package/packages/claude/skills/code-review/code-reviewer.md +146 -0
- package/packages/claude/skills/condition-based-waiting/SKILL.md +122 -0
- package/packages/claude/skills/condition-based-waiting/example.ts +158 -0
- package/packages/claude/skills/docs-builder/SKILL.md +106 -0
- package/packages/claude/skills/docs-builder/references/templates.md +572 -0
- package/packages/claude/skills/root-cause-tracing/SKILL.md +176 -0
- package/packages/claude/skills/root-cause-tracing/find-polluter.sh +63 -0
- package/packages/claude/skills/skill-creator/LICENSE.txt +202 -0
- package/packages/claude/skills/skill-creator/SKILL.md +211 -0
- package/packages/claude/skills/skill-creator/scripts/init_skill.py +303 -0
- package/packages/claude/skills/skill-creator/scripts/package_skill.py +110 -0
- package/packages/claude/skills/skill-creator/scripts/quick_validate.py +65 -0
- package/packages/claude/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/packages/claude/skills/systematic-debugging/SKILL.md +296 -0
- package/packages/claude/skills/systematic-debugging/test-academic.md +14 -0
- package/packages/claude/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/packages/claude/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/packages/claude/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/packages/claude/skills/test-driven-development/SKILL.md +392 -0
- package/packages/claude/skills/testing-anti-patterns/SKILL.md +304 -0
- package/packages/claude/skills/verification-before-completion/SKILL.md +152 -0
- package/packages/claude/variants.json +9 -0
- package/packages/droid/AGENTS.md +52 -0
- package/packages/droid/README.md +17 -0
- package/packages/droid/change_settings.json +61 -0
- package/packages/droid/commands/brainstorming.md +56 -0
- package/packages/droid/commands/code-review.md +107 -0
- package/packages/droid/commands/condition-based-waiting/example.ts +158 -0
- package/packages/droid/commands/condition-based-waiting.md +122 -0
- package/packages/droid/commands/debug.md +20 -0
- package/packages/droid/commands/docs-builder/templates.md +572 -0
- package/packages/droid/commands/docs-builder.md +106 -0
- package/packages/droid/commands/explain.md +18 -0
- package/packages/droid/commands/git-commit.md +14 -0
- package/packages/droid/commands/optimize.md +20 -0
- package/packages/droid/commands/refactor.md +21 -0
- package/packages/droid/commands/review.md +18 -0
- package/packages/droid/commands/root-cause-tracing/find-polluter.sh +63 -0
- package/packages/droid/commands/root-cause-tracing.md +176 -0
- package/packages/droid/commands/security.md +21 -0
- package/packages/droid/commands/ship.md +18 -0
- package/packages/droid/commands/skill-creator/scripts/init_skill.py +303 -0
- package/packages/droid/commands/skill-creator/scripts/package_skill.py +110 -0
- package/packages/droid/commands/skill-creator/scripts/quick_validate.py +65 -0
- package/packages/droid/commands/skill-creator.md +211 -0
- package/packages/droid/commands/stash.md +45 -0
- package/packages/droid/commands/systematic-debugging.md +297 -0
- package/packages/droid/commands/test-driven-development.md +390 -0
- package/packages/droid/commands/test-generate.md +18 -0
- package/packages/droid/commands/testing-anti-patterns.md +304 -0
- package/packages/droid/commands/verification-before-completion.md +152 -0
- package/packages/droid/droids/1-create-prd.md +170 -0
- package/packages/droid/droids/2-generate-tasks.md +190 -0
- package/packages/droid/droids/3-process-task-list.md +225 -0
- package/packages/droid/droids/code-developer.md +198 -0
- package/packages/droid/droids/context-builder.md +142 -0
- package/packages/droid/droids/feature-planner.md +199 -0
- package/packages/droid/droids/market-researcher.md +89 -0
- package/packages/droid/droids/orchestrator.md +116 -0
- package/packages/droid/droids/quality-assurance.md +115 -0
- package/packages/droid/droids/system-architect.md +135 -0
- package/packages/droid/droids/ui-designer.md +184 -0
- package/packages/droid/variants.json +8 -0
- package/packages/opencode/AGENTS.md +52 -0
- package/packages/opencode/README.md +17 -0
- package/packages/opencode/agent/1-create-prd.md +179 -0
- package/packages/opencode/agent/2-generate-tasks.md +194 -0
- package/packages/opencode/agent/3-process-task-list.md +229 -0
- package/packages/opencode/agent/code-developer.md +202 -0
- package/packages/opencode/agent/context-builder.md +146 -0
- package/packages/opencode/agent/feature-planner.md +203 -0
- package/packages/opencode/agent/market-researcher.md +93 -0
- package/packages/opencode/agent/orchestrator.md +120 -0
- package/packages/opencode/agent/quality-assurance.md +119 -0
- package/packages/opencode/agent/system-architect.md +139 -0
- package/packages/opencode/agent/ui-designer.md +188 -0
- package/packages/opencode/command/brainstorming.md +56 -0
- package/packages/opencode/command/code-review.md +107 -0
- package/packages/opencode/command/condition-based-waiting/example.ts +158 -0
- package/packages/opencode/command/condition-based-waiting.md +122 -0
- package/packages/opencode/command/debug.md +20 -0
- package/packages/opencode/command/docs-builder/templates.md +572 -0
- package/packages/opencode/command/docs-builder.md +106 -0
- package/packages/opencode/command/explain.md +18 -0
- package/packages/opencode/command/git-commit.md +14 -0
- package/packages/opencode/command/optimize.md +20 -0
- package/packages/opencode/command/refactor.md +21 -0
- package/packages/opencode/command/review.md +18 -0
- package/packages/opencode/command/root-cause-tracing/find-polluter.sh +63 -0
- package/packages/opencode/command/root-cause-tracing.md +176 -0
- package/packages/opencode/command/security.md +21 -0
- package/packages/opencode/command/ship.md +18 -0
- package/packages/opencode/command/skill-creator/scripts/init_skill.py +303 -0
- package/packages/opencode/command/skill-creator/scripts/package_skill.py +110 -0
- package/packages/opencode/command/skill-creator/scripts/quick_validate.py +65 -0
- package/packages/opencode/command/skill-creator.md +211 -0
- package/packages/opencode/command/stash.md +45 -0
- package/packages/opencode/command/systematic-debugging.md +297 -0
- package/packages/opencode/command/test-driven-development.md +390 -0
- package/packages/opencode/command/test-generate.md +18 -0
- package/packages/opencode/command/testing-anti-patterns.md +304 -0
- package/packages/opencode/command/verification-before-completion.md +152 -0
- package/packages/opencode/opencode.jsonc +201 -0
- package/packages/opencode/variants.json +8 -0
- package/packages/subagentic-manual.md +349 -0
- package/postinstall.js +21 -0
- package/tools/ampcode/manifest-template.json +14 -0
- package/tools/claude/manifest-template.json +14 -0
- package/tools/droid/manifest-template.json +14 -0
- package/tools/opencode/manifest-template.json +14 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testing-anti-patterns
|
|
3
|
+
description: Use when writing or changing tests, adding mocks, or tempted to add test-only methods to production code - prevents testing mock behavior, production pollution with test-only methods, and mocking without understanding dependencies
|
|
4
|
+
usage: /testing-anti-patterns <testing-scenario>
|
|
5
|
+
auto_trigger: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Testing Anti-Patterns
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Tests must verify real behavior, not mock behavior. Mocks are a means to isolate, not the thing being tested.
|
|
13
|
+
|
|
14
|
+
**Core principle:** Test what the code does, not what the mocks do.
|
|
15
|
+
|
|
16
|
+
**Following strict TDD prevents these anti-patterns.**
|
|
17
|
+
|
|
18
|
+
## The Iron Laws
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
1. NEVER test mock behavior
|
|
22
|
+
2. NEVER add test-only methods to production classes
|
|
23
|
+
3. NEVER mock without understanding dependencies
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Anti-Pattern 1: Testing Mock Behavior
|
|
27
|
+
|
|
28
|
+
**The violation:**
|
|
29
|
+
```typescript
|
|
30
|
+
// ❌ BAD: Testing that the mock exists
|
|
31
|
+
test('renders sidebar', () => {
|
|
32
|
+
render(<Page />);
|
|
33
|
+
expect(screen.getByTestId('sidebar-mock')).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Why this is wrong:**
|
|
38
|
+
- You're verifying the mock works, not that the component works
|
|
39
|
+
- Test passes when mock is present, fails when it's not
|
|
40
|
+
- Tells you nothing about real behavior
|
|
41
|
+
|
|
42
|
+
**your human partner's correction:** "Are we testing the behavior of a mock?"
|
|
43
|
+
|
|
44
|
+
**The fix:**
|
|
45
|
+
```typescript
|
|
46
|
+
// ✅ GOOD: Test real component or don't mock it
|
|
47
|
+
test('renders sidebar', () => {
|
|
48
|
+
render(<Page />); // Don't mock sidebar
|
|
49
|
+
expect(screen.getByRole('navigation')).toBeInTheDocument();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// OR if sidebar must be mocked for isolation:
|
|
53
|
+
// Don't assert on the mock - test Page's behavior with sidebar present
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Gate Function
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
BEFORE asserting on any mock element:
|
|
60
|
+
Ask: "Am I testing real component behavior or just mock existence?"
|
|
61
|
+
|
|
62
|
+
IF testing mock existence:
|
|
63
|
+
STOP - Delete the assertion or unmock the component
|
|
64
|
+
|
|
65
|
+
Test real behavior instead
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Anti-Pattern 2: Test-Only Methods in Production
|
|
69
|
+
|
|
70
|
+
**The violation:**
|
|
71
|
+
```typescript
|
|
72
|
+
// ❌ BAD: destroy() only used in tests
|
|
73
|
+
class Session {
|
|
74
|
+
async destroy() { // Looks like production API!
|
|
75
|
+
await this._workspaceManager?.destroyWorkspace(this.id);
|
|
76
|
+
// ... cleanup
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// In tests
|
|
81
|
+
afterEach(() => session.destroy());
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Why this is wrong:**
|
|
85
|
+
- Production class polluted with test-only code
|
|
86
|
+
- Dangerous if accidentally called in production
|
|
87
|
+
- Violates YAGNI and separation of concerns
|
|
88
|
+
- Confuses object lifecycle with entity lifecycle
|
|
89
|
+
|
|
90
|
+
**The fix:**
|
|
91
|
+
```typescript
|
|
92
|
+
// ✅ GOOD: Test utilities handle test cleanup
|
|
93
|
+
// Session has no destroy() - it's stateless in production
|
|
94
|
+
|
|
95
|
+
// In test-utils/
|
|
96
|
+
export async function cleanupSession(session: Session) {
|
|
97
|
+
const workspace = session.getWorkspaceInfo();
|
|
98
|
+
if (workspace) {
|
|
99
|
+
await workspaceManager.destroyWorkspace(workspace.id);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// In tests
|
|
104
|
+
afterEach(() => cleanupSession(session));
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Gate Function
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
BEFORE adding any method to production class:
|
|
111
|
+
Ask: "Is this only used by tests?"
|
|
112
|
+
|
|
113
|
+
IF yes:
|
|
114
|
+
STOP - Don't add it
|
|
115
|
+
Put it in test utilities instead
|
|
116
|
+
|
|
117
|
+
Ask: "Does this class own this resource's lifecycle?"
|
|
118
|
+
|
|
119
|
+
IF no:
|
|
120
|
+
STOP - Wrong class for this method
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Anti-Pattern 3: Mocking Without Understanding
|
|
124
|
+
|
|
125
|
+
**The violation:**
|
|
126
|
+
```typescript
|
|
127
|
+
// ❌ BAD: Mock breaks test logic
|
|
128
|
+
test('detects duplicate server', () => {
|
|
129
|
+
// Mock prevents config write that test depends on!
|
|
130
|
+
vi.mock('ToolCatalog', () => ({
|
|
131
|
+
discoverAndCacheTools: vi.fn().mockResolvedValue(undefined)
|
|
132
|
+
}));
|
|
133
|
+
|
|
134
|
+
await addServer(config);
|
|
135
|
+
await addServer(config); // Should throw - but won't!
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Why this is wrong:**
|
|
140
|
+
- Mocked method had side effect test depended on (writing config)
|
|
141
|
+
- Over-mocking to "be safe" breaks actual behavior
|
|
142
|
+
- Test passes for wrong reason or fails mysteriously
|
|
143
|
+
|
|
144
|
+
**The fix:**
|
|
145
|
+
```typescript
|
|
146
|
+
// ✅ GOOD: Mock at correct level
|
|
147
|
+
test('detects duplicate server', () => {
|
|
148
|
+
// Mock the slow part, preserve behavior test needs
|
|
149
|
+
vi.mock('MCPServerManager'); // Just mock slow server startup
|
|
150
|
+
|
|
151
|
+
await addServer(config); // Config written
|
|
152
|
+
await addServer(config); // Duplicate detected ✓
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Gate Function
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
BEFORE mocking any method:
|
|
160
|
+
STOP - Don't mock yet
|
|
161
|
+
|
|
162
|
+
1. Ask: "What side effects does the real method have?"
|
|
163
|
+
2. Ask: "Does this test depend on any of those side effects?"
|
|
164
|
+
3. Ask: "Do I fully understand what this test needs?"
|
|
165
|
+
|
|
166
|
+
IF depends on side effects:
|
|
167
|
+
Mock at lower level (the actual slow/external operation)
|
|
168
|
+
OR use test doubles that preserve necessary behavior
|
|
169
|
+
NOT the high-level method the test depends on
|
|
170
|
+
|
|
171
|
+
IF unsure what test depends on:
|
|
172
|
+
Run test with real implementation FIRST
|
|
173
|
+
Observe what actually needs to happen
|
|
174
|
+
THEN add minimal mocking at the right level
|
|
175
|
+
|
|
176
|
+
Red flags:
|
|
177
|
+
- "I'll mock this to be safe"
|
|
178
|
+
- "This might be slow, better mock it"
|
|
179
|
+
- Mocking without understanding the dependency chain
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Anti-Pattern 4: Incomplete Mocks
|
|
183
|
+
|
|
184
|
+
**The violation:**
|
|
185
|
+
```typescript
|
|
186
|
+
// ❌ BAD: Partial mock - only fields you think you need
|
|
187
|
+
const mockResponse = {
|
|
188
|
+
status: 'success',
|
|
189
|
+
data: { userId: '123', name: 'Alice' }
|
|
190
|
+
// Missing: metadata that downstream code uses
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// Later: breaks when code accesses response.metadata.requestId
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Why this is wrong:**
|
|
197
|
+
- **Partial mocks hide structural assumptions** - You only mocked fields you know about
|
|
198
|
+
- **Downstream code may depend on fields you didn't include** - Silent failures
|
|
199
|
+
- **Tests pass but integration fails** - Mock incomplete, real API complete
|
|
200
|
+
- **False confidence** - Test proves nothing about real behavior
|
|
201
|
+
|
|
202
|
+
**The Iron Rule:** Mock the COMPLETE data structure as it exists in reality, not just fields your immediate test uses.
|
|
203
|
+
|
|
204
|
+
**The fix:**
|
|
205
|
+
```typescript
|
|
206
|
+
// ✅ GOOD: Mirror real API completeness
|
|
207
|
+
const mockResponse = {
|
|
208
|
+
status: 'success',
|
|
209
|
+
data: { userId: '123', name: 'Alice' },
|
|
210
|
+
metadata: { requestId: 'req-789', timestamp: 1234567890 }
|
|
211
|
+
// All fields real API returns
|
|
212
|
+
};
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Gate Function
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
BEFORE creating mock responses:
|
|
219
|
+
Check: "What fields does the real API response contain?"
|
|
220
|
+
|
|
221
|
+
Actions:
|
|
222
|
+
1. Examine actual API response from docs/examples
|
|
223
|
+
2. Include ALL fields system might consume downstream
|
|
224
|
+
3. Verify mock matches real response schema completely
|
|
225
|
+
|
|
226
|
+
Critical:
|
|
227
|
+
If you're creating a mock, you must understand the ENTIRE structure
|
|
228
|
+
Partial mocks fail silently when code depends on omitted fields
|
|
229
|
+
|
|
230
|
+
If uncertain: Include all documented fields
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Anti-Pattern 5: Integration Tests as Afterthought
|
|
234
|
+
|
|
235
|
+
**The violation:**
|
|
236
|
+
```
|
|
237
|
+
✅ Implementation complete
|
|
238
|
+
❌ No tests written
|
|
239
|
+
"Ready for testing"
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Why this is wrong:**
|
|
243
|
+
- Testing is part of implementation, not optional follow-up
|
|
244
|
+
- TDD would have caught this
|
|
245
|
+
- Can't claim complete without tests
|
|
246
|
+
|
|
247
|
+
**The fix:**
|
|
248
|
+
```
|
|
249
|
+
TDD cycle:
|
|
250
|
+
1. Write failing test
|
|
251
|
+
2. Implement to pass
|
|
252
|
+
3. Refactor
|
|
253
|
+
4. THEN claim complete
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## When Mocks Become Too Complex
|
|
257
|
+
|
|
258
|
+
**Warning signs:**
|
|
259
|
+
- Mock setup longer than test logic
|
|
260
|
+
- Mocking everything to make test pass
|
|
261
|
+
- Mocks missing methods real components have
|
|
262
|
+
- Test breaks when mock changes
|
|
263
|
+
|
|
264
|
+
**your human partner's question:** "Do we need to be using a mock here?"
|
|
265
|
+
|
|
266
|
+
**Consider:** Integration tests with real components often simpler than complex mocks
|
|
267
|
+
|
|
268
|
+
## TDD Prevents These Anti-Patterns
|
|
269
|
+
|
|
270
|
+
**Why TDD helps:**
|
|
271
|
+
1. **Write test first** → Forces you to think about what you're actually testing
|
|
272
|
+
2. **Watch it fail** → Confirms test tests real behavior, not mocks
|
|
273
|
+
3. **Minimal implementation** → No test-only methods creep in
|
|
274
|
+
4. **Real dependencies** → You see what the test actually needs before mocking
|
|
275
|
+
|
|
276
|
+
**If you're testing mock behavior, you violated TDD** - you added mocks without watching test fail against real code first.
|
|
277
|
+
|
|
278
|
+
## Quick Reference
|
|
279
|
+
|
|
280
|
+
| Anti-Pattern | Fix |
|
|
281
|
+
|--------------|-----|
|
|
282
|
+
| Assert on mock elements | Test real component or unmock it |
|
|
283
|
+
| Test-only methods in production | Move to test utilities |
|
|
284
|
+
| Mock without understanding | Understand dependencies first, mock minimally |
|
|
285
|
+
| Incomplete mocks | Mirror real API completely |
|
|
286
|
+
| Tests as afterthought | TDD - tests first |
|
|
287
|
+
| Over-complex mocks | Consider integration tests |
|
|
288
|
+
|
|
289
|
+
## Red Flags
|
|
290
|
+
|
|
291
|
+
- Assertion checks for `*-mock` test IDs
|
|
292
|
+
- Methods only called in test files
|
|
293
|
+
- Mock setup is >50% of test
|
|
294
|
+
- Test fails when you remove mock
|
|
295
|
+
- Can't explain why mock is needed
|
|
296
|
+
- Mocking "just to be safe"
|
|
297
|
+
|
|
298
|
+
## The Bottom Line
|
|
299
|
+
|
|
300
|
+
**Mocks are tools to isolate, not things to test.**
|
|
301
|
+
|
|
302
|
+
If TDD reveals you're testing mock behavior, you've gone wrong.
|
|
303
|
+
|
|
304
|
+
Fix: Test real behavior or question why you're mocking at all.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verification-before-completion
|
|
3
|
+
description: Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
|
|
4
|
+
usage: /verification-before-completion <work-to-verify>
|
|
5
|
+
auto_trigger: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Verification Before Completion
|
|
9
|
+
|
|
10
|
+
## Auto-Trigger
|
|
11
|
+
|
|
12
|
+
**APPLIES WHEN:**
|
|
13
|
+
- About to say: done, fixed, complete, passing, success
|
|
14
|
+
- About to commit, push, create PR
|
|
15
|
+
- About to mark task [x]
|
|
16
|
+
|
|
17
|
+
**APPLIES TO:** All agents, all invocation paths
|
|
18
|
+
|
|
19
|
+
**NEVER SKIP:** Even for "obvious" tasks
|
|
20
|
+
|
|
21
|
+
## Overview
|
|
22
|
+
|
|
23
|
+
Claiming work is complete without verification is dishonesty, not efficiency.
|
|
24
|
+
|
|
25
|
+
**Core principle:** Evidence before claims, always.
|
|
26
|
+
|
|
27
|
+
**Violating the letter of this rule is violating the spirit of this rule.**
|
|
28
|
+
|
|
29
|
+
## The Iron Law
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
If you haven't run the verification command in this message, you cannot claim it passes.
|
|
36
|
+
|
|
37
|
+
## The Gate Function
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
BEFORE claiming any status or expressing satisfaction:
|
|
41
|
+
|
|
42
|
+
1. IDENTIFY: What command proves this claim?
|
|
43
|
+
2. RUN: Execute the FULL command (fresh, complete)
|
|
44
|
+
3. READ: Full output, check exit code, count failures
|
|
45
|
+
4. VERIFY: Does output confirm the claim?
|
|
46
|
+
- If NO: State actual status with evidence
|
|
47
|
+
- If YES: State claim WITH evidence
|
|
48
|
+
5. ONLY THEN: Make the claim
|
|
49
|
+
|
|
50
|
+
Skip any step = lying, not verifying
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Common Failures
|
|
54
|
+
|
|
55
|
+
| Claim | Requires | Not Sufficient |
|
|
56
|
+
|-------|----------|----------------|
|
|
57
|
+
| Tests pass | Test command output: 0 failures | Previous run, "should pass" |
|
|
58
|
+
| Linter clean | Linter output: 0 errors | Partial check, extrapolation |
|
|
59
|
+
| Build succeeds | Build command: exit 0 | Linter passing, logs look good |
|
|
60
|
+
| Bug fixed | Test original symptom: passes | Code changed, assumed fixed |
|
|
61
|
+
| Regression test works | Red-green cycle verified | Test passes once |
|
|
62
|
+
| Agent completed | VCS diff shows changes | Agent reports "success" |
|
|
63
|
+
| Requirements met | Line-by-line checklist | Tests passing |
|
|
64
|
+
|
|
65
|
+
## Red Flags - STOP
|
|
66
|
+
|
|
67
|
+
- Using "should", "probably", "seems to"
|
|
68
|
+
- Expressing satisfaction before verification ("Great!", "Perfect!", "Done!", etc.)
|
|
69
|
+
- About to commit/push/PR without verification
|
|
70
|
+
- Trusting agent success reports
|
|
71
|
+
- Relying on partial verification
|
|
72
|
+
- Thinking "just this once"
|
|
73
|
+
- Tired and wanting work over
|
|
74
|
+
- **ANY wording implying success without having run verification**
|
|
75
|
+
|
|
76
|
+
## Rationalization Prevention
|
|
77
|
+
|
|
78
|
+
| Excuse | Reality |
|
|
79
|
+
|--------|---------|
|
|
80
|
+
| "Should work now" | RUN the verification |
|
|
81
|
+
| "I'm confident" | Confidence ≠ evidence |
|
|
82
|
+
| "Just this once" | No exceptions |
|
|
83
|
+
| "Linter passed" | Linter ≠ compiler |
|
|
84
|
+
| "Agent said success" | Verify independently |
|
|
85
|
+
| "I'm tired" | Exhaustion ≠ excuse |
|
|
86
|
+
| "Partial check is enough" | Partial proves nothing |
|
|
87
|
+
| "Different words so rule doesn't apply" | Spirit over letter |
|
|
88
|
+
|
|
89
|
+
## Key Patterns
|
|
90
|
+
|
|
91
|
+
**Tests:**
|
|
92
|
+
```
|
|
93
|
+
✅ [Run test command] [See: 34/34 pass] "All tests pass"
|
|
94
|
+
❌ "Should pass now" / "Looks correct"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Regression tests (TDD Red-Green):**
|
|
98
|
+
```
|
|
99
|
+
✅ Write → Run (pass) → Revert fix → Run (MUST FAIL) → Restore → Run (pass)
|
|
100
|
+
❌ "I've written a regression test" (without red-green verification)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Build:**
|
|
104
|
+
```
|
|
105
|
+
✅ [Run build] [See: exit 0] "Build passes"
|
|
106
|
+
❌ "Linter passed" (linter doesn't check compilation)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Requirements:**
|
|
110
|
+
```
|
|
111
|
+
✅ Re-read plan → Create checklist → Verify each → Report gaps or completion
|
|
112
|
+
❌ "Tests pass, phase complete"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Agent delegation:**
|
|
116
|
+
```
|
|
117
|
+
✅ Agent reports success → Check VCS diff → Verify changes → Report actual state
|
|
118
|
+
❌ Trust agent report
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Why This Matters
|
|
122
|
+
|
|
123
|
+
From 24 failure memories:
|
|
124
|
+
- your human partner said "I don't believe you" - trust broken
|
|
125
|
+
- Undefined functions shipped - would crash
|
|
126
|
+
- Missing requirements shipped - incomplete features
|
|
127
|
+
- Time wasted on false completion → redirect → rework
|
|
128
|
+
- Violates: "Honesty is a core value. If you lie, you'll be replaced."
|
|
129
|
+
|
|
130
|
+
## When To Apply
|
|
131
|
+
|
|
132
|
+
**ALWAYS before:**
|
|
133
|
+
- ANY variation of success/completion claims
|
|
134
|
+
- ANY expression of satisfaction
|
|
135
|
+
- ANY positive statement about work state
|
|
136
|
+
- Committing, PR creation, task completion
|
|
137
|
+
- Moving to next task
|
|
138
|
+
- Delegating to agents
|
|
139
|
+
|
|
140
|
+
**Rule applies to:**
|
|
141
|
+
- Exact phrases
|
|
142
|
+
- Paraphrases and synonyms
|
|
143
|
+
- Implications of success
|
|
144
|
+
- ANY communication suggesting completion/correctness
|
|
145
|
+
|
|
146
|
+
## The Bottom Line
|
|
147
|
+
|
|
148
|
+
**No shortcuts for verification.**
|
|
149
|
+
|
|
150
|
+
Run the command. Read the output. THEN claim the result.
|
|
151
|
+
|
|
152
|
+
This is non-negotiable.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opencode.ai/config.json",
|
|
3
|
+
"agent": {
|
|
4
|
+
"1-create-prd": {
|
|
5
|
+
"prompt": "{file:./agent/1-create-prd.md}",
|
|
6
|
+
"mode": "subagent",
|
|
7
|
+
"tools": {
|
|
8
|
+
"write": true,
|
|
9
|
+
"edit": true,
|
|
10
|
+
"bash": true
|
|
11
|
+
},
|
|
12
|
+
"description": "Define scope with structured Product Requirement Documents"
|
|
13
|
+
},
|
|
14
|
+
"2-generate-tasks": {
|
|
15
|
+
"prompt": "{file:./agent/2-generate-tasks.md}",
|
|
16
|
+
"mode": "subagent",
|
|
17
|
+
"tools": {
|
|
18
|
+
"write": true,
|
|
19
|
+
"edit": true,
|
|
20
|
+
"bash": true
|
|
21
|
+
},
|
|
22
|
+
"description": "Break PRDs into granular, actionable task lists"
|
|
23
|
+
},
|
|
24
|
+
"3-process-task-list": {
|
|
25
|
+
"prompt": "{file:./agent/3-process-task-list.md}",
|
|
26
|
+
"mode": "subagent",
|
|
27
|
+
"tools": {
|
|
28
|
+
"write": true,
|
|
29
|
+
"edit": true,
|
|
30
|
+
"bash": true
|
|
31
|
+
},
|
|
32
|
+
"description": "Execute tasks iteratively with progress tracking and review checkpoints"
|
|
33
|
+
},
|
|
34
|
+
"ui-designer": {
|
|
35
|
+
"prompt": "{file:./agent/ui-designer.md}",
|
|
36
|
+
"mode": "subagent",
|
|
37
|
+
"tools": {
|
|
38
|
+
"write": true,
|
|
39
|
+
"edit": true,
|
|
40
|
+
"bash": true
|
|
41
|
+
},
|
|
42
|
+
"description": "UI/UX design, wireframes, prototypes, accessibility, design systems"
|
|
43
|
+
},
|
|
44
|
+
"quality-assurance": {
|
|
45
|
+
"prompt": "{file:./agent/quality-assurance.md}",
|
|
46
|
+
"mode": "subagent",
|
|
47
|
+
"tools": {
|
|
48
|
+
"write": true,
|
|
49
|
+
"edit": true,
|
|
50
|
+
"bash": true
|
|
51
|
+
},
|
|
52
|
+
"description": "Test architecture, quality gates, requirements traceability, risk assessment"
|
|
53
|
+
},
|
|
54
|
+
"feature-planner": {
|
|
55
|
+
"prompt": "{file:./agent/feature-planner.md}",
|
|
56
|
+
"mode": "subagent",
|
|
57
|
+
"tools": {
|
|
58
|
+
"write": true,
|
|
59
|
+
"edit": true,
|
|
60
|
+
"bash": true
|
|
61
|
+
},
|
|
62
|
+
"description": "Epics, user stories, prioritization, backlog management, retrospectives"
|
|
63
|
+
},
|
|
64
|
+
"code-developer": {
|
|
65
|
+
"prompt": "{file:./agent/code-developer.md}",
|
|
66
|
+
"mode": "subagent",
|
|
67
|
+
"tools": {
|
|
68
|
+
"write": true,
|
|
69
|
+
"edit": true,
|
|
70
|
+
"bash": true
|
|
71
|
+
},
|
|
72
|
+
"description": "Implementation, debugging, refactoring, code best practices"
|
|
73
|
+
},
|
|
74
|
+
"orchestrator": {
|
|
75
|
+
"prompt": "{file:./agent/orchestrator.md}",
|
|
76
|
+
"mode": "primary",
|
|
77
|
+
"tools": {
|
|
78
|
+
"write": true,
|
|
79
|
+
"edit": true,
|
|
80
|
+
"bash": true
|
|
81
|
+
},
|
|
82
|
+
"description": "Analyze intent, coordinate workflows, route to optimal agent sequences"
|
|
83
|
+
},
|
|
84
|
+
"system-architect": {
|
|
85
|
+
"prompt": "{file:./agent/system-architect.md}",
|
|
86
|
+
"mode": "subagent",
|
|
87
|
+
"tools": {
|
|
88
|
+
"write": true,
|
|
89
|
+
"edit": true,
|
|
90
|
+
"bash": true
|
|
91
|
+
},
|
|
92
|
+
"description": "System design, technology selection, API design, scalability planning"
|
|
93
|
+
},
|
|
94
|
+
"context-builder": {
|
|
95
|
+
"prompt": "{file:./agent/context-builder.md}",
|
|
96
|
+
"mode": "subagent",
|
|
97
|
+
"tools": {
|
|
98
|
+
"write": true,
|
|
99
|
+
"edit": true,
|
|
100
|
+
"bash": true
|
|
101
|
+
},
|
|
102
|
+
"description": "Initialize project context, discover documentation, create knowledge bases"
|
|
103
|
+
},
|
|
104
|
+
"market-researcher": {
|
|
105
|
+
"prompt": "{file:./agent/market-researcher.md}",
|
|
106
|
+
"mode": "subagent",
|
|
107
|
+
"tools": {
|
|
108
|
+
"write": true,
|
|
109
|
+
"edit": true,
|
|
110
|
+
"bash": true
|
|
111
|
+
},
|
|
112
|
+
"description": "Market analysis, competitive research, project discovery, brainstorming"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"command": {
|
|
116
|
+
"systematic-debugging": {
|
|
117
|
+
"template": "{file:./command/systematic-debugging.md}",
|
|
118
|
+
"description": "Systematic four-phase debugging framework - investigate root cause before any fixes"
|
|
119
|
+
},
|
|
120
|
+
"verification-before-completion": {
|
|
121
|
+
"template": "{file:./command/verification-before-completion.md}",
|
|
122
|
+
"description": "Verify work meets requirements before marking complete - prevents incomplete deliverables"
|
|
123
|
+
},
|
|
124
|
+
"skill-creator": {
|
|
125
|
+
"template": "{file:./command/skill-creator.md}",
|
|
126
|
+
"description": "Create reusable skills with proper structure, validation, and documentation"
|
|
127
|
+
},
|
|
128
|
+
"test-driven-development": {
|
|
129
|
+
"template": "{file:./command/test-driven-development.md}",
|
|
130
|
+
"description": "Write test first, watch it fail, write minimal code to pass - ensures tests actually verify behavior"
|
|
131
|
+
},
|
|
132
|
+
"testing-anti-patterns": {
|
|
133
|
+
"template": "{file:./command/testing-anti-patterns.md}",
|
|
134
|
+
"description": "Identify and avoid common testing anti-patterns that create fragile, useless tests"
|
|
135
|
+
},
|
|
136
|
+
"root-cause-tracing": {
|
|
137
|
+
"template": "{file:./command/root-cause-tracing.md}",
|
|
138
|
+
"description": "Trace issues to their root cause using systematic investigation techniques"
|
|
139
|
+
},
|
|
140
|
+
"condition-based-waiting": {
|
|
141
|
+
"template": "{file:./command/condition-based-waiting.md}",
|
|
142
|
+
"description": "Implement robust waiting mechanisms based on conditions rather than fixed delays"
|
|
143
|
+
},
|
|
144
|
+
"brainstorming": {
|
|
145
|
+
"template": "{file:./command/brainstorming.md}",
|
|
146
|
+
"description": "Facilitate structured brainstorming sessions with proven techniques and frameworks"
|
|
147
|
+
},
|
|
148
|
+
"code-review": {
|
|
149
|
+
"template": "{file:./command/code-review.md}",
|
|
150
|
+
"description": "Conduct thorough code reviews with focus on quality, security, and maintainability"
|
|
151
|
+
},
|
|
152
|
+
"docs-builder": {
|
|
153
|
+
"template": "{file:./command/docs-builder/SKILL.md}",
|
|
154
|
+
"description": "Create comprehensive project documentation with structured /docs hierarchy"
|
|
155
|
+
},
|
|
156
|
+
"debug": {
|
|
157
|
+
"template": "{file:./command/debug.md}",
|
|
158
|
+
"description": "Debug an issue systematically using structured investigation techniques"
|
|
159
|
+
},
|
|
160
|
+
"explain": {
|
|
161
|
+
"template": "{file:./command/explain.md}",
|
|
162
|
+
"description": "Explain code for someone new to the codebase"
|
|
163
|
+
},
|
|
164
|
+
"git-commit": {
|
|
165
|
+
"template": "{file:./command/git-commit.md}",
|
|
166
|
+
"description": "Analyze changes and create intelligent git commits"
|
|
167
|
+
},
|
|
168
|
+
"optimize": {
|
|
169
|
+
"template": "{file:./command/optimize.md}",
|
|
170
|
+
"description": "Analyze and optimize performance issues"
|
|
171
|
+
},
|
|
172
|
+
"refactor": {
|
|
173
|
+
"template": "{file:./command/refactor.md}",
|
|
174
|
+
"description": "Refactor code while maintaining behavior and tests"
|
|
175
|
+
},
|
|
176
|
+
"review": {
|
|
177
|
+
"template": "{file:./command/review.md}",
|
|
178
|
+
"description": "Comprehensive code review including quality, tests, and architecture"
|
|
179
|
+
},
|
|
180
|
+
"security": {
|
|
181
|
+
"template": "{file:./command/security.md}",
|
|
182
|
+
"description": "Security vulnerability scan and analysis"
|
|
183
|
+
},
|
|
184
|
+
"ship": {
|
|
185
|
+
"template": "{file:./command/ship.md}",
|
|
186
|
+
"description": "Pre-deployment verification checklist"
|
|
187
|
+
},
|
|
188
|
+
"stash": {
|
|
189
|
+
"template": "{file:./command/stash.md}",
|
|
190
|
+
"description": "Save session context for compaction recovery or handoffs"
|
|
191
|
+
},
|
|
192
|
+
"test-generate": {
|
|
193
|
+
"template": "{file:./command/test-generate.md}",
|
|
194
|
+
"description": "Generate comprehensive test suites for existing code"
|
|
195
|
+
},
|
|
196
|
+
"subagent-spawning": {
|
|
197
|
+
"template": "{file:./command/subagent-spawning.md}",
|
|
198
|
+
"description": "Provides TDD-aware templates for spawning fresh subagents"
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|