opencode-metis 0.1.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 +140 -0
- package/dist/cli.cjs +63 -0
- package/dist/mcp-server.cjs +51 -0
- package/dist/plugin.cjs +4 -0
- package/dist/worker.cjs +224 -0
- package/opencode/agent/the-analyst/feature-prioritization.md +66 -0
- package/opencode/agent/the-analyst/market-research.md +77 -0
- package/opencode/agent/the-analyst/project-coordination.md +81 -0
- package/opencode/agent/the-analyst/requirements-analysis.md +77 -0
- package/opencode/agent/the-architect/compatibility-review.md +138 -0
- package/opencode/agent/the-architect/complexity-review.md +137 -0
- package/opencode/agent/the-architect/quality-review.md +67 -0
- package/opencode/agent/the-architect/security-review.md +127 -0
- package/opencode/agent/the-architect/system-architecture.md +119 -0
- package/opencode/agent/the-architect/system-documentation.md +83 -0
- package/opencode/agent/the-architect/technology-research.md +85 -0
- package/opencode/agent/the-chief.md +79 -0
- package/opencode/agent/the-designer/accessibility-implementation.md +101 -0
- package/opencode/agent/the-designer/design-foundation.md +74 -0
- package/opencode/agent/the-designer/interaction-architecture.md +75 -0
- package/opencode/agent/the-designer/user-research.md +70 -0
- package/opencode/agent/the-meta-agent.md +155 -0
- package/opencode/agent/the-platform-engineer/ci-cd-pipelines.md +109 -0
- package/opencode/agent/the-platform-engineer/containerization.md +106 -0
- package/opencode/agent/the-platform-engineer/data-architecture.md +81 -0
- package/opencode/agent/the-platform-engineer/dependency-review.md +144 -0
- package/opencode/agent/the-platform-engineer/deployment-automation.md +81 -0
- package/opencode/agent/the-platform-engineer/infrastructure-as-code.md +107 -0
- package/opencode/agent/the-platform-engineer/performance-tuning.md +82 -0
- package/opencode/agent/the-platform-engineer/pipeline-engineering.md +81 -0
- package/opencode/agent/the-platform-engineer/production-monitoring.md +105 -0
- package/opencode/agent/the-qa-engineer/exploratory-testing.md +66 -0
- package/opencode/agent/the-qa-engineer/performance-testing.md +81 -0
- package/opencode/agent/the-qa-engineer/quality-assurance.md +77 -0
- package/opencode/agent/the-qa-engineer/test-execution.md +66 -0
- package/opencode/agent/the-software-engineer/api-development.md +78 -0
- package/opencode/agent/the-software-engineer/component-development.md +79 -0
- package/opencode/agent/the-software-engineer/concurrency-review.md +141 -0
- package/opencode/agent/the-software-engineer/domain-modeling.md +66 -0
- package/opencode/agent/the-software-engineer/performance-optimization.md +113 -0
- package/opencode/command/analyze.md +149 -0
- package/opencode/command/constitution.md +178 -0
- package/opencode/command/debug.md +194 -0
- package/opencode/command/document.md +178 -0
- package/opencode/command/implement.md +225 -0
- package/opencode/command/refactor.md +207 -0
- package/opencode/command/review.md +229 -0
- package/opencode/command/simplify.md +267 -0
- package/opencode/command/specify.md +191 -0
- package/opencode/command/validate.md +224 -0
- package/opencode/skill/accessibility-design/SKILL.md +566 -0
- package/opencode/skill/accessibility-design/checklists/wcag-checklist.md +435 -0
- package/opencode/skill/agent-coordination/SKILL.md +224 -0
- package/opencode/skill/api-contract-design/SKILL.md +550 -0
- package/opencode/skill/api-contract-design/templates/graphql-schema-template.md +818 -0
- package/opencode/skill/api-contract-design/templates/rest-api-template.md +417 -0
- package/opencode/skill/architecture-design/SKILL.md +160 -0
- package/opencode/skill/architecture-design/examples/architecture-examples.md +170 -0
- package/opencode/skill/architecture-design/template.md +749 -0
- package/opencode/skill/architecture-design/validation.md +99 -0
- package/opencode/skill/architecture-selection/SKILL.md +522 -0
- package/opencode/skill/architecture-selection/examples/adrs/001-example-adr.md +71 -0
- package/opencode/skill/architecture-selection/examples/architecture-patterns.md +239 -0
- package/opencode/skill/bug-diagnosis/SKILL.md +235 -0
- package/opencode/skill/code-quality-review/SKILL.md +337 -0
- package/opencode/skill/code-quality-review/examples/anti-patterns.md +629 -0
- package/opencode/skill/code-quality-review/reference.md +322 -0
- package/opencode/skill/code-review/SKILL.md +363 -0
- package/opencode/skill/code-review/reference.md +450 -0
- package/opencode/skill/codebase-analysis/SKILL.md +139 -0
- package/opencode/skill/codebase-navigation/SKILL.md +227 -0
- package/opencode/skill/codebase-navigation/examples/exploration-patterns.md +263 -0
- package/opencode/skill/coding-conventions/SKILL.md +178 -0
- package/opencode/skill/coding-conventions/checklists/accessibility-checklist.md +176 -0
- package/opencode/skill/coding-conventions/checklists/performance-checklist.md +154 -0
- package/opencode/skill/coding-conventions/checklists/security-checklist.md +127 -0
- package/opencode/skill/constitution-validation/SKILL.md +315 -0
- package/opencode/skill/constitution-validation/examples/CONSTITUTION.md +202 -0
- package/opencode/skill/constitution-validation/reference/rule-patterns.md +328 -0
- package/opencode/skill/constitution-validation/template.md +115 -0
- package/opencode/skill/context-preservation/SKILL.md +445 -0
- package/opencode/skill/data-modeling/SKILL.md +385 -0
- package/opencode/skill/data-modeling/templates/schema-design-template.md +268 -0
- package/opencode/skill/deployment-pipeline-design/SKILL.md +579 -0
- package/opencode/skill/deployment-pipeline-design/templates/pipeline-template.md +633 -0
- package/opencode/skill/documentation-extraction/SKILL.md +259 -0
- package/opencode/skill/documentation-sync/SKILL.md +431 -0
- package/opencode/skill/domain-driven-design/SKILL.md +509 -0
- package/opencode/skill/domain-driven-design/examples/ddd-patterns.md +688 -0
- package/opencode/skill/domain-driven-design/reference.md +465 -0
- package/opencode/skill/drift-detection/SKILL.md +383 -0
- package/opencode/skill/drift-detection/reference.md +340 -0
- package/opencode/skill/error-recovery/SKILL.md +162 -0
- package/opencode/skill/error-recovery/examples/error-patterns.md +484 -0
- package/opencode/skill/feature-prioritization/SKILL.md +419 -0
- package/opencode/skill/feature-prioritization/examples/rice-template.md +139 -0
- package/opencode/skill/feature-prioritization/reference.md +256 -0
- package/opencode/skill/git-workflow/SKILL.md +453 -0
- package/opencode/skill/implementation-planning/SKILL.md +215 -0
- package/opencode/skill/implementation-planning/examples/phase-examples.md +217 -0
- package/opencode/skill/implementation-planning/template.md +220 -0
- package/opencode/skill/implementation-planning/validation.md +88 -0
- package/opencode/skill/implementation-verification/SKILL.md +272 -0
- package/opencode/skill/knowledge-capture/SKILL.md +265 -0
- package/opencode/skill/knowledge-capture/reference/knowledge-capture.md +402 -0
- package/opencode/skill/knowledge-capture/reference.md +444 -0
- package/opencode/skill/knowledge-capture/templates/domain-template.md +325 -0
- package/opencode/skill/knowledge-capture/templates/interface-template.md +255 -0
- package/opencode/skill/knowledge-capture/templates/pattern-template.md +144 -0
- package/opencode/skill/observability-design/SKILL.md +291 -0
- package/opencode/skill/observability-design/references/monitoring-patterns.md +461 -0
- package/opencode/skill/pattern-detection/SKILL.md +171 -0
- package/opencode/skill/pattern-detection/examples/common-patterns.md +359 -0
- package/opencode/skill/performance-analysis/SKILL.md +266 -0
- package/opencode/skill/performance-analysis/references/profiling-tools.md +499 -0
- package/opencode/skill/requirements-analysis/SKILL.md +139 -0
- package/opencode/skill/requirements-analysis/examples/good-prd.md +66 -0
- package/opencode/skill/requirements-analysis/template.md +177 -0
- package/opencode/skill/requirements-analysis/validation.md +69 -0
- package/opencode/skill/requirements-elicitation/SKILL.md +518 -0
- package/opencode/skill/requirements-elicitation/examples/interview-questions.md +226 -0
- package/opencode/skill/requirements-elicitation/examples/user-stories.md +414 -0
- package/opencode/skill/safe-refactoring/SKILL.md +312 -0
- package/opencode/skill/safe-refactoring/reference/code-smells.md +347 -0
- package/opencode/skill/security-assessment/SKILL.md +421 -0
- package/opencode/skill/security-assessment/checklists/security-review-checklist.md +285 -0
- package/opencode/skill/specification-management/SKILL.md +143 -0
- package/opencode/skill/specification-management/readme-template.md +32 -0
- package/opencode/skill/specification-management/reference.md +115 -0
- package/opencode/skill/specification-management/spec.py +229 -0
- package/opencode/skill/specification-validation/SKILL.md +397 -0
- package/opencode/skill/specification-validation/reference/3cs-framework.md +306 -0
- package/opencode/skill/specification-validation/reference/ambiguity-detection.md +132 -0
- package/opencode/skill/specification-validation/reference/constitution-validation.md +301 -0
- package/opencode/skill/specification-validation/reference/drift-detection.md +383 -0
- package/opencode/skill/task-delegation/SKILL.md +607 -0
- package/opencode/skill/task-delegation/examples/file-coordination.md +495 -0
- package/opencode/skill/task-delegation/examples/parallel-research.md +337 -0
- package/opencode/skill/task-delegation/examples/sequential-build.md +504 -0
- package/opencode/skill/task-delegation/reference.md +825 -0
- package/opencode/skill/tech-stack-detection/SKILL.md +89 -0
- package/opencode/skill/tech-stack-detection/references/framework-signatures.md +598 -0
- package/opencode/skill/technical-writing/SKILL.md +190 -0
- package/opencode/skill/technical-writing/templates/adr-template.md +205 -0
- package/opencode/skill/technical-writing/templates/system-doc-template.md +380 -0
- package/opencode/skill/test-design/SKILL.md +464 -0
- package/opencode/skill/test-design/examples/test-pyramid.md +724 -0
- package/opencode/skill/testing/SKILL.md +213 -0
- package/opencode/skill/testing/examples/test-pyramid.md +724 -0
- package/opencode/skill/user-insight-synthesis/SKILL.md +576 -0
- package/opencode/skill/user-insight-synthesis/templates/research-plan-template.md +217 -0
- package/opencode/skill/user-research/SKILL.md +508 -0
- package/opencode/skill/user-research/examples/interview-questions.md +265 -0
- package/opencode/skill/user-research/examples/personas.md +267 -0
- package/opencode/skill/vibe-security/SKILL.md +654 -0
- package/package.json +45 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testing
|
|
3
|
+
description: "Writing effective tests and running them successfully. Covers layer-specific mocking rules, test design principles, debugging failures, and flaky test management. Use when writing tests, reviewing test quality, or debugging test failures."
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: opencode
|
|
6
|
+
metadata:
|
|
7
|
+
category: development
|
|
8
|
+
version: "1.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Testing
|
|
12
|
+
|
|
13
|
+
Roleplay as a testing specialist that designs effective test strategies, writes tests at appropriate layers, and debugs test failures using systematic approaches.
|
|
14
|
+
|
|
15
|
+
Testing {
|
|
16
|
+
Activation {
|
|
17
|
+
Writing unit, integration, or E2E tests
|
|
18
|
+
Debugging test failures
|
|
19
|
+
Reviewing test quality
|
|
20
|
+
Deciding what to mock vs use real implementations
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
LayerDistribution {
|
|
24
|
+
Unit (60-70%) => Mock at boundaries only
|
|
25
|
+
Integration (20-30%) => Real deps, mock external services only
|
|
26
|
+
E2E (5-10%) => No mocking - real user journeys
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
UnitTests {
|
|
30
|
+
Purpose: Verify isolated business logic
|
|
31
|
+
Characteristics: < 100ms, no I/O, deterministic
|
|
32
|
+
TestHere: Business logic, validation, transformations, edge cases
|
|
33
|
+
|
|
34
|
+
MockingRules {
|
|
35
|
+
Mock at the edge only (databases, APIs, file system, time)
|
|
36
|
+
Test the real system under test with actual implementations
|
|
37
|
+
Use real internal collaborators - mock only external boundaries
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
Example {
|
|
41
|
+
```typescript
|
|
42
|
+
// CORRECT: Mock only external dependency
|
|
43
|
+
const service = new OrderService(mockRepository) // Repository is the edge
|
|
44
|
+
const total = service.calculateTotal(order)
|
|
45
|
+
expect(total).toBe(90)
|
|
46
|
+
|
|
47
|
+
// WRONG: Mocking internal methods
|
|
48
|
+
vi.spyOn(service, 'applyDiscount') // Now you're testing the mock
|
|
49
|
+
```
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
IntegrationTests {
|
|
54
|
+
Purpose: Verify components work together with real dependencies
|
|
55
|
+
Characteristics: < 5 seconds, containerized deps, clean state between tests
|
|
56
|
+
TestHere: Database queries, API contracts, service communication, caching
|
|
57
|
+
|
|
58
|
+
MockingRules {
|
|
59
|
+
Use real databases
|
|
60
|
+
Use real caches
|
|
61
|
+
Mock only external third-party services (Stripe, SendGrid)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
Example {
|
|
65
|
+
```typescript
|
|
66
|
+
// CORRECT: Real DB, mock external payment API
|
|
67
|
+
const db = await createTestDatabase()
|
|
68
|
+
const paymentApi = vi.mocked(PaymentGateway)
|
|
69
|
+
const service = new CheckoutService(db, paymentApi)
|
|
70
|
+
|
|
71
|
+
await service.checkout(cart)
|
|
72
|
+
|
|
73
|
+
expect(await db.orders.find(orderId)).toBeDefined() // Real DB
|
|
74
|
+
expect(paymentApi.charge).toHaveBeenCalledOnce() // Mocked external
|
|
75
|
+
```
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
E2ETests {
|
|
80
|
+
Purpose: Validate critical user journeys in the real system
|
|
81
|
+
Characteristics: < 30 seconds, critical paths only, fix flakiness immediately
|
|
82
|
+
TestHere: Signup, checkout, auth flows, smoke tests
|
|
83
|
+
|
|
84
|
+
MockingRules {
|
|
85
|
+
No mocking - that's the entire point
|
|
86
|
+
Use real services (sandbox/test modes)
|
|
87
|
+
Real browser automation
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
Example {
|
|
91
|
+
```typescript
|
|
92
|
+
// Real browser, real system (Playwright example)
|
|
93
|
+
await page.goto('/checkout')
|
|
94
|
+
await page.fill('#card', '4242424242424242')
|
|
95
|
+
await page.click('[data-testid="pay"]')
|
|
96
|
+
|
|
97
|
+
await expect(page.locator('.confirmation')).toContainText('Order confirmed')
|
|
98
|
+
```
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
CorePrinciples {
|
|
103
|
+
TestBehaviorNotImplementation {
|
|
104
|
+
```typescript
|
|
105
|
+
// CORRECT: Observable behavior
|
|
106
|
+
expect(order.total).toBe(108)
|
|
107
|
+
|
|
108
|
+
// WRONG: Implementation detail
|
|
109
|
+
expect(order._calculateTax).toHaveBeenCalled()
|
|
110
|
+
```
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
ArrangeActAssert {
|
|
114
|
+
```typescript
|
|
115
|
+
// Arrange
|
|
116
|
+
const mockEmail = vi.mocked(EmailService)
|
|
117
|
+
const service = new UserService(mockEmail)
|
|
118
|
+
|
|
119
|
+
// Act
|
|
120
|
+
await service.register(userData)
|
|
121
|
+
|
|
122
|
+
// Assert
|
|
123
|
+
expect(mockEmail.sendTo).toHaveBeenCalledWith('user@example.com')
|
|
124
|
+
```
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
OneBehaviorPerTest => Multiple assertions OK if verifying same logical outcome
|
|
128
|
+
|
|
129
|
+
DescriptiveNames {
|
|
130
|
+
```typescript
|
|
131
|
+
// GOOD
|
|
132
|
+
it('rejects order when inventory insufficient', ...)
|
|
133
|
+
|
|
134
|
+
// BAD
|
|
135
|
+
it('test order', ...)
|
|
136
|
+
```
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
TestIsolation => No shared mutable state between tests
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
ExecutionOrder {
|
|
143
|
+
1. Lint/typecheck => Fastest feedback
|
|
144
|
+
2. Unit tests => Fast, high volume
|
|
145
|
+
3. Integration tests => Real dependencies
|
|
146
|
+
4. E2E tests => Highest confidence
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
DebuggingFailures {
|
|
150
|
+
UnitTestFails {
|
|
151
|
+
1. Read the assertion message carefully
|
|
152
|
+
2. Check test setup (Arrange section)
|
|
153
|
+
3. Run in isolation to rule out state leakage
|
|
154
|
+
4. Add logging to trace execution path
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
IntegrationTestFails {
|
|
158
|
+
1. Check database state before/after
|
|
159
|
+
2. Verify mocks configured correctly
|
|
160
|
+
3. Look for race conditions or timing issues
|
|
161
|
+
4. Check transaction/rollback behavior
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
E2ETestFails {
|
|
165
|
+
1. Check screenshots/videos (most frameworks capture these)
|
|
166
|
+
2. Verify selectors still match the UI
|
|
167
|
+
3. Add explicit waits for async operations
|
|
168
|
+
4. Run locally with visible browser to observe
|
|
169
|
+
5. Compare CI environment to local
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
FlakyTests {
|
|
174
|
+
HandleAggressively => They erode trust
|
|
175
|
+
|
|
176
|
+
Protocol {
|
|
177
|
+
1. Quarantine => Move to separate suite immediately
|
|
178
|
+
2. Fix within 1 week => Or delete
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
CommonCauses {
|
|
182
|
+
Shared state between tests
|
|
183
|
+
Time-dependent logic
|
|
184
|
+
Race conditions
|
|
185
|
+
Non-deterministic ordering
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
Coverage {
|
|
190
|
+
Quality over quantity => 80% meaningful coverage beats 100% trivial coverage
|
|
191
|
+
Focus on business-critical paths (payments, auth, core domain logic)
|
|
192
|
+
Skip generated code
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
EdgeCases {
|
|
196
|
+
Boundaries => min-1, min, min+1, max-1, max, max+1, zero, one, many
|
|
197
|
+
SpecialValues => null, empty, negative, MAX_INT, NaN, unicode, leap years, timezones
|
|
198
|
+
Errors => Network failures, timeouts, invalid input, unauthorized
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
AntiPatterns {
|
|
202
|
+
| Pattern | Problem |
|
|
203
|
+
| --- | --- |
|
|
204
|
+
| Over-mocking | Testing mocks instead of code |
|
|
205
|
+
| Implementation testing | Breaks on refactoring |
|
|
206
|
+
| Shared state | Test order affects results |
|
|
207
|
+
| Test duplication | Use parameterized tests instead |
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
## References
|
|
212
|
+
|
|
213
|
+
- [test-pyramid.md](examples/test-pyramid.md) - Test pyramid strategy and examples
|