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.
Files changed (156) hide show
  1. package/README.md +140 -0
  2. package/dist/cli.cjs +63 -0
  3. package/dist/mcp-server.cjs +51 -0
  4. package/dist/plugin.cjs +4 -0
  5. package/dist/worker.cjs +224 -0
  6. package/opencode/agent/the-analyst/feature-prioritization.md +66 -0
  7. package/opencode/agent/the-analyst/market-research.md +77 -0
  8. package/opencode/agent/the-analyst/project-coordination.md +81 -0
  9. package/opencode/agent/the-analyst/requirements-analysis.md +77 -0
  10. package/opencode/agent/the-architect/compatibility-review.md +138 -0
  11. package/opencode/agent/the-architect/complexity-review.md +137 -0
  12. package/opencode/agent/the-architect/quality-review.md +67 -0
  13. package/opencode/agent/the-architect/security-review.md +127 -0
  14. package/opencode/agent/the-architect/system-architecture.md +119 -0
  15. package/opencode/agent/the-architect/system-documentation.md +83 -0
  16. package/opencode/agent/the-architect/technology-research.md +85 -0
  17. package/opencode/agent/the-chief.md +79 -0
  18. package/opencode/agent/the-designer/accessibility-implementation.md +101 -0
  19. package/opencode/agent/the-designer/design-foundation.md +74 -0
  20. package/opencode/agent/the-designer/interaction-architecture.md +75 -0
  21. package/opencode/agent/the-designer/user-research.md +70 -0
  22. package/opencode/agent/the-meta-agent.md +155 -0
  23. package/opencode/agent/the-platform-engineer/ci-cd-pipelines.md +109 -0
  24. package/opencode/agent/the-platform-engineer/containerization.md +106 -0
  25. package/opencode/agent/the-platform-engineer/data-architecture.md +81 -0
  26. package/opencode/agent/the-platform-engineer/dependency-review.md +144 -0
  27. package/opencode/agent/the-platform-engineer/deployment-automation.md +81 -0
  28. package/opencode/agent/the-platform-engineer/infrastructure-as-code.md +107 -0
  29. package/opencode/agent/the-platform-engineer/performance-tuning.md +82 -0
  30. package/opencode/agent/the-platform-engineer/pipeline-engineering.md +81 -0
  31. package/opencode/agent/the-platform-engineer/production-monitoring.md +105 -0
  32. package/opencode/agent/the-qa-engineer/exploratory-testing.md +66 -0
  33. package/opencode/agent/the-qa-engineer/performance-testing.md +81 -0
  34. package/opencode/agent/the-qa-engineer/quality-assurance.md +77 -0
  35. package/opencode/agent/the-qa-engineer/test-execution.md +66 -0
  36. package/opencode/agent/the-software-engineer/api-development.md +78 -0
  37. package/opencode/agent/the-software-engineer/component-development.md +79 -0
  38. package/opencode/agent/the-software-engineer/concurrency-review.md +141 -0
  39. package/opencode/agent/the-software-engineer/domain-modeling.md +66 -0
  40. package/opencode/agent/the-software-engineer/performance-optimization.md +113 -0
  41. package/opencode/command/analyze.md +149 -0
  42. package/opencode/command/constitution.md +178 -0
  43. package/opencode/command/debug.md +194 -0
  44. package/opencode/command/document.md +178 -0
  45. package/opencode/command/implement.md +225 -0
  46. package/opencode/command/refactor.md +207 -0
  47. package/opencode/command/review.md +229 -0
  48. package/opencode/command/simplify.md +267 -0
  49. package/opencode/command/specify.md +191 -0
  50. package/opencode/command/validate.md +224 -0
  51. package/opencode/skill/accessibility-design/SKILL.md +566 -0
  52. package/opencode/skill/accessibility-design/checklists/wcag-checklist.md +435 -0
  53. package/opencode/skill/agent-coordination/SKILL.md +224 -0
  54. package/opencode/skill/api-contract-design/SKILL.md +550 -0
  55. package/opencode/skill/api-contract-design/templates/graphql-schema-template.md +818 -0
  56. package/opencode/skill/api-contract-design/templates/rest-api-template.md +417 -0
  57. package/opencode/skill/architecture-design/SKILL.md +160 -0
  58. package/opencode/skill/architecture-design/examples/architecture-examples.md +170 -0
  59. package/opencode/skill/architecture-design/template.md +749 -0
  60. package/opencode/skill/architecture-design/validation.md +99 -0
  61. package/opencode/skill/architecture-selection/SKILL.md +522 -0
  62. package/opencode/skill/architecture-selection/examples/adrs/001-example-adr.md +71 -0
  63. package/opencode/skill/architecture-selection/examples/architecture-patterns.md +239 -0
  64. package/opencode/skill/bug-diagnosis/SKILL.md +235 -0
  65. package/opencode/skill/code-quality-review/SKILL.md +337 -0
  66. package/opencode/skill/code-quality-review/examples/anti-patterns.md +629 -0
  67. package/opencode/skill/code-quality-review/reference.md +322 -0
  68. package/opencode/skill/code-review/SKILL.md +363 -0
  69. package/opencode/skill/code-review/reference.md +450 -0
  70. package/opencode/skill/codebase-analysis/SKILL.md +139 -0
  71. package/opencode/skill/codebase-navigation/SKILL.md +227 -0
  72. package/opencode/skill/codebase-navigation/examples/exploration-patterns.md +263 -0
  73. package/opencode/skill/coding-conventions/SKILL.md +178 -0
  74. package/opencode/skill/coding-conventions/checklists/accessibility-checklist.md +176 -0
  75. package/opencode/skill/coding-conventions/checklists/performance-checklist.md +154 -0
  76. package/opencode/skill/coding-conventions/checklists/security-checklist.md +127 -0
  77. package/opencode/skill/constitution-validation/SKILL.md +315 -0
  78. package/opencode/skill/constitution-validation/examples/CONSTITUTION.md +202 -0
  79. package/opencode/skill/constitution-validation/reference/rule-patterns.md +328 -0
  80. package/opencode/skill/constitution-validation/template.md +115 -0
  81. package/opencode/skill/context-preservation/SKILL.md +445 -0
  82. package/opencode/skill/data-modeling/SKILL.md +385 -0
  83. package/opencode/skill/data-modeling/templates/schema-design-template.md +268 -0
  84. package/opencode/skill/deployment-pipeline-design/SKILL.md +579 -0
  85. package/opencode/skill/deployment-pipeline-design/templates/pipeline-template.md +633 -0
  86. package/opencode/skill/documentation-extraction/SKILL.md +259 -0
  87. package/opencode/skill/documentation-sync/SKILL.md +431 -0
  88. package/opencode/skill/domain-driven-design/SKILL.md +509 -0
  89. package/opencode/skill/domain-driven-design/examples/ddd-patterns.md +688 -0
  90. package/opencode/skill/domain-driven-design/reference.md +465 -0
  91. package/opencode/skill/drift-detection/SKILL.md +383 -0
  92. package/opencode/skill/drift-detection/reference.md +340 -0
  93. package/opencode/skill/error-recovery/SKILL.md +162 -0
  94. package/opencode/skill/error-recovery/examples/error-patterns.md +484 -0
  95. package/opencode/skill/feature-prioritization/SKILL.md +419 -0
  96. package/opencode/skill/feature-prioritization/examples/rice-template.md +139 -0
  97. package/opencode/skill/feature-prioritization/reference.md +256 -0
  98. package/opencode/skill/git-workflow/SKILL.md +453 -0
  99. package/opencode/skill/implementation-planning/SKILL.md +215 -0
  100. package/opencode/skill/implementation-planning/examples/phase-examples.md +217 -0
  101. package/opencode/skill/implementation-planning/template.md +220 -0
  102. package/opencode/skill/implementation-planning/validation.md +88 -0
  103. package/opencode/skill/implementation-verification/SKILL.md +272 -0
  104. package/opencode/skill/knowledge-capture/SKILL.md +265 -0
  105. package/opencode/skill/knowledge-capture/reference/knowledge-capture.md +402 -0
  106. package/opencode/skill/knowledge-capture/reference.md +444 -0
  107. package/opencode/skill/knowledge-capture/templates/domain-template.md +325 -0
  108. package/opencode/skill/knowledge-capture/templates/interface-template.md +255 -0
  109. package/opencode/skill/knowledge-capture/templates/pattern-template.md +144 -0
  110. package/opencode/skill/observability-design/SKILL.md +291 -0
  111. package/opencode/skill/observability-design/references/monitoring-patterns.md +461 -0
  112. package/opencode/skill/pattern-detection/SKILL.md +171 -0
  113. package/opencode/skill/pattern-detection/examples/common-patterns.md +359 -0
  114. package/opencode/skill/performance-analysis/SKILL.md +266 -0
  115. package/opencode/skill/performance-analysis/references/profiling-tools.md +499 -0
  116. package/opencode/skill/requirements-analysis/SKILL.md +139 -0
  117. package/opencode/skill/requirements-analysis/examples/good-prd.md +66 -0
  118. package/opencode/skill/requirements-analysis/template.md +177 -0
  119. package/opencode/skill/requirements-analysis/validation.md +69 -0
  120. package/opencode/skill/requirements-elicitation/SKILL.md +518 -0
  121. package/opencode/skill/requirements-elicitation/examples/interview-questions.md +226 -0
  122. package/opencode/skill/requirements-elicitation/examples/user-stories.md +414 -0
  123. package/opencode/skill/safe-refactoring/SKILL.md +312 -0
  124. package/opencode/skill/safe-refactoring/reference/code-smells.md +347 -0
  125. package/opencode/skill/security-assessment/SKILL.md +421 -0
  126. package/opencode/skill/security-assessment/checklists/security-review-checklist.md +285 -0
  127. package/opencode/skill/specification-management/SKILL.md +143 -0
  128. package/opencode/skill/specification-management/readme-template.md +32 -0
  129. package/opencode/skill/specification-management/reference.md +115 -0
  130. package/opencode/skill/specification-management/spec.py +229 -0
  131. package/opencode/skill/specification-validation/SKILL.md +397 -0
  132. package/opencode/skill/specification-validation/reference/3cs-framework.md +306 -0
  133. package/opencode/skill/specification-validation/reference/ambiguity-detection.md +132 -0
  134. package/opencode/skill/specification-validation/reference/constitution-validation.md +301 -0
  135. package/opencode/skill/specification-validation/reference/drift-detection.md +383 -0
  136. package/opencode/skill/task-delegation/SKILL.md +607 -0
  137. package/opencode/skill/task-delegation/examples/file-coordination.md +495 -0
  138. package/opencode/skill/task-delegation/examples/parallel-research.md +337 -0
  139. package/opencode/skill/task-delegation/examples/sequential-build.md +504 -0
  140. package/opencode/skill/task-delegation/reference.md +825 -0
  141. package/opencode/skill/tech-stack-detection/SKILL.md +89 -0
  142. package/opencode/skill/tech-stack-detection/references/framework-signatures.md +598 -0
  143. package/opencode/skill/technical-writing/SKILL.md +190 -0
  144. package/opencode/skill/technical-writing/templates/adr-template.md +205 -0
  145. package/opencode/skill/technical-writing/templates/system-doc-template.md +380 -0
  146. package/opencode/skill/test-design/SKILL.md +464 -0
  147. package/opencode/skill/test-design/examples/test-pyramid.md +724 -0
  148. package/opencode/skill/testing/SKILL.md +213 -0
  149. package/opencode/skill/testing/examples/test-pyramid.md +724 -0
  150. package/opencode/skill/user-insight-synthesis/SKILL.md +576 -0
  151. package/opencode/skill/user-insight-synthesis/templates/research-plan-template.md +217 -0
  152. package/opencode/skill/user-research/SKILL.md +508 -0
  153. package/opencode/skill/user-research/examples/interview-questions.md +265 -0
  154. package/opencode/skill/user-research/examples/personas.md +267 -0
  155. package/opencode/skill/vibe-security/SKILL.md +654 -0
  156. package/package.json +45 -0
@@ -0,0 +1,322 @@
1
+ # Code Quality Review Reference
2
+
3
+ Expanded criteria, specific signals, and severity guidance for each review dimension. Load this when a review requires deeper analysis than the dimension tables in SKILL.md provide.
4
+
5
+ ---
6
+
7
+ ## Dimension Deep Dives
8
+
9
+ ### Readability
10
+
11
+ Readable code is understood correctly on first read. The goal is not brevity — it is clarity.
12
+
13
+ #### Naming
14
+
15
+ Good names eliminate the need to trace code to understand it.
16
+
17
+ | Signal | What to Look For | Severity |
18
+ |--------|------------------|----------|
19
+ | Cryptic abbreviations | `usr`, `d`, `tmp`, `val`, `res` as standalone names | MEDIUM |
20
+ | Misleading names | `isEnabled` that returns a count; `getUser` that saves | HIGH |
21
+ | Generic names | `data`, `info`, `obj`, `result`, `item` in non-trivial code | LOW |
22
+ | Boolean non-predicates | `user.active` instead of `user.isActive` | LOW |
23
+ | Inconsistent vocabulary | `fetch` in one function, `get`, `retrieve`, `load` for same concept elsewhere | MEDIUM |
24
+ | Noun-verb confusion | Functions named as nouns (`userSave()`); variables named as verbs | MEDIUM |
25
+
26
+ Specific names to scrutinize:
27
+
28
+ - Loop variables: `i`, `j` are acceptable for simple index loops; not acceptable as meaningful identifiers
29
+ - Boolean parameters: `createUser(true)` — what does `true` mean? Should be `createUser({ sendWelcomeEmail: true })`
30
+ - Return value names: a function returning a filtered list should not store the result in `list2`
31
+
32
+ #### Comments
33
+
34
+ The right comment explains why code does something, not what it does. The code itself should explain the what.
35
+
36
+ | Signal | What to Look For | Severity |
37
+ |--------|------------------|----------|
38
+ | Redundant comments | `// increment counter` above `count++` | LOW |
39
+ | Stale comments | Comment describes behavior that code no longer implements | HIGH |
40
+ | Missing intent comments | Complex algorithm, regex, or workaround with no explanation | MEDIUM |
41
+ | Commented-out code | Dead code left in place — creates confusion about intent | MEDIUM |
42
+ | TODO without ticket | `// TODO: fix this later` with no owner or reference | LOW |
43
+
44
+ Comments that add value:
45
+
46
+ ```
47
+ // Stripe requires amounts in cents, not dollars
48
+ // See: https://stripe.com/docs/currencies#zero-decimal
49
+ const amount = Math.round(price * 100);
50
+
51
+ // We skip soft-deleted records here because the report
52
+ // only counts billable events — deleted users are not billed.
53
+ const events = await Event.where({ deletedAt: null });
54
+ ```
55
+
56
+ #### Complexity
57
+
58
+ Cyclomatic complexity above 10 is a warning. Above 15 is a blocker.
59
+
60
+ | Signal | What to Look For | Severity |
61
+ |--------|------------------|----------|
62
+ | Nesting depth > 3 | Three or more levels of if/for/while nesting | MEDIUM |
63
+ | Boolean explosion | Conditions with 4+ AND/OR clauses | MEDIUM |
64
+ | Negated negatives | `if (!isNotActive)` — double negation obscures intent | MEDIUM |
65
+ | Long methods | Functions exceeding 20 lines doing multiple things | MEDIUM |
66
+ | Flag parameters | `processOrder(order, true, false, true)` — positional booleans | HIGH |
67
+
68
+ Measuring complexity in practice:
69
+
70
+ - Count the number of independent code paths through a function
71
+ - Each `if`, `else if`, `for`, `while`, `case`, `&&`, `||` adds one path
72
+ - A function with complexity of 8 needs 8 distinct test cases to cover all paths
73
+
74
+ ---
75
+
76
+ ### Maintainability
77
+
78
+ Maintainable code is easy to change safely. The test is: can a developer who did not write this code modify it confidently six months later?
79
+
80
+ #### Duplication
81
+
82
+ DRY violations increase the cost of every future change and create drift between copies.
83
+
84
+ | Signal | What to Look For | Severity |
85
+ |--------|------------------|----------|
86
+ | Copy-paste blocks | Identical or near-identical logic in 2+ places | MEDIUM |
87
+ | Repeated conditionals | Same `if (user.role === 'admin')` check in 5 places | HIGH |
88
+ | Structural duplication | Different data, same shape — suggests a missing abstraction | MEDIUM |
89
+ | Literal duplication | Same string constant typed in multiple files | LOW |
90
+
91
+ The threshold: duplicated logic that appears twice is a candidate for extraction. Appearing three or more times is a requirement to extract.
92
+
93
+ Exception: premature deduplication that requires complex parameterization to handle slight variations is worse than duplication. Evaluate whether extraction actually simplifies.
94
+
95
+ #### Coupling
96
+
97
+ Tightly coupled code breaks in unexpected places when changed.
98
+
99
+ | Signal | What to Look For | Severity |
100
+ |--------|------------------|----------|
101
+ | Feature Envy | A method references another class's fields more than its own | MEDIUM |
102
+ | Inappropriate Intimacy | Class A accesses private internals of Class B | HIGH |
103
+ | Deep import chains | `import { x } from '../../../../core/utils/helpers/string'` | LOW |
104
+ | Circular dependency | Module A imports from B, B imports from A | HIGH |
105
+ | Law of Demeter violations | `order.customer.address.city` — chained navigation | MEDIUM |
106
+
107
+ #### Cohesion
108
+
109
+ A class or module should have one reason to change. When it has multiple, changes in one area risk breaking another.
110
+
111
+ | Signal | What to Look For | Severity |
112
+ |--------|------------------|----------|
113
+ | God Object | Class with 10+ public methods spanning unrelated concerns | HIGH |
114
+ | Utility dumping ground | `utils.ts` or `helpers.py` growing without domain organization | MEDIUM |
115
+ | Mixed abstraction levels | High-level orchestration mixed with low-level string parsing | MEDIUM |
116
+ | Unrelated exports | Module exporting types for two different bounded contexts | MEDIUM |
117
+
118
+ ---
119
+
120
+ ### Testability
121
+
122
+ If code is hard to test, it is usually hard to understand, change, or reason about. Poor testability is a design signal, not just a testing concern.
123
+
124
+ #### Dependency Injection
125
+
126
+ Code that instantiates its own dependencies is hard to test in isolation.
127
+
128
+ | Signal | What to Look For | Severity |
129
+ |--------|------------------|----------|
130
+ | Hard-coded instantiation | `const db = new Database()` inside a service constructor | HIGH |
131
+ | Static method calls | `UserService.getCurrentUser()` called deep inside business logic | HIGH |
132
+ | Global state access | Direct access to `process.env`, singleton registries inside functions | MEDIUM |
133
+ | Date/time coupling | `new Date()` or `Date.now()` called inside functions that need deterministic tests | MEDIUM |
134
+
135
+ The test: can you run a unit test for this function without starting a database, making a network call, or reading the filesystem? If no, the dependencies are not properly injected.
136
+
137
+ #### Observability
138
+
139
+ Code needs to expose enough surface area to write meaningful assertions.
140
+
141
+ | Signal | What to Look For | Severity |
142
+ |--------|------------------|----------|
143
+ | Hidden side effects | Function sends email, writes file, or mutates global state without returning a testable signal | HIGH |
144
+ | Void returns on complex logic | Functions doing significant work but returning nothing | MEDIUM |
145
+ | Non-determinism | Functions that depend on random values, current time, or external state without injection | MEDIUM |
146
+ | Private everything | Classes with no public interface except the final output | MEDIUM |
147
+
148
+ #### Test Coverage Gaps
149
+
150
+ | Signal | What to Look For | Severity |
151
+ |--------|------------------|----------|
152
+ | No tests for new code | PR adds logic with zero corresponding test file changes | HIGH |
153
+ | Tests for implementation only | Tests that break on every refactor without logic changes | MEDIUM |
154
+ | Happy path only | Tests that never simulate errors, empty inputs, or boundary values | HIGH |
155
+ | Missing boundary tests | Off-by-one errors, empty collections, zero values, maximum values | MEDIUM |
156
+ | Integration tests masking unit gaps | Every test hits the database; no unit-level isolation | MEDIUM |
157
+
158
+ ---
159
+
160
+ ### Error Handling
161
+
162
+ Error handling is part of correctness. Code that fails silently or loses context on failure is as broken as code with wrong logic.
163
+
164
+ #### Failure Coverage
165
+
166
+ | Signal | What to Look For | Severity |
167
+ |--------|------------------|----------|
168
+ | Swallowed exceptions | `catch (e) { /* ignore */ }` or `catch (e) { return null; }` | HIGH |
169
+ | Generic catch-all | Catching `Exception` or `Error` instead of specific types | MEDIUM |
170
+ | Missing error propagation | Callers cannot distinguish success from failure | HIGH |
171
+ | Optimistic code | Database calls, API calls, file reads with no error handling | HIGH |
172
+
173
+ #### Error Quality
174
+
175
+ | Signal | What to Look For | Severity |
176
+ |--------|------------------|----------|
177
+ | Context-free messages | `throw new Error('invalid input')` — which field? what value? | MEDIUM |
178
+ | Exposing internals | Stack traces or SQL errors returned to API callers | CRITICAL |
179
+ | Type information lost | Re-throwing as a different error type without preserving original | MEDIUM |
180
+ | Logging without acting | `console.error(e)` followed by normal code execution | HIGH |
181
+
182
+ What good error handling looks like:
183
+
184
+ ```
185
+ // Specific error type
186
+ // Context in the message (what failed, what was expected)
187
+ // Original error preserved for debugging
188
+ throw new ValidationError(
189
+ `User age must be between 18 and 120, got ${age}`,
190
+ { field: 'age', received: age, min: 18, max: 120 }
191
+ );
192
+ ```
193
+
194
+ #### Null and Undefined Safety
195
+
196
+ | Signal | What to Look For | Severity |
197
+ |--------|------------------|----------|
198
+ | Unchecked optional chaining | Accessing `.property` on a value that could be null/undefined | HIGH |
199
+ | Missing null guards at boundaries | Data from external APIs, user input, or database queries used without null check | HIGH |
200
+ | Implicit truthiness checks | `if (user)` when the check should be `if (user !== null)` | LOW |
201
+ | Nullable return not handled | Function documented to return null used without null check at call site | HIGH |
202
+
203
+ ---
204
+
205
+ ### Naming Specifics
206
+
207
+ Naming deserves its own expanded section because it is the most frequent source of LOW and MEDIUM findings.
208
+
209
+ #### Functions and Methods
210
+
211
+ | Pattern | Problem | Better |
212
+ |---------|---------|--------|
213
+ | `getData()` | What data? Where from? | `fetchUserProfileFromCache()` |
214
+ | `process()` | Process what? How? | `normalizeIncomingWebhookPayload()` |
215
+ | `handle()` | Vague event handler | `handlePaymentFailedEvent()` |
216
+ | `check()` | Returns bool? Throws? Logs? | `validateEmailFormat()` or `assertEmailIsValid()` |
217
+ | `update()` | Updates one field? All fields? | `updateUserEmailAddress()` |
218
+ | `calculate()` | Calculate and return? Side effects? | `computeOrderSubtotal()` |
219
+
220
+ #### Variables
221
+
222
+ | Pattern | Problem | Better |
223
+ |---------|---------|--------|
224
+ | `flag` | Flag for what? | `isEmailVerified` |
225
+ | `list` | List of what? | `pendingOrderIds` |
226
+ | `count` | Count of what? | `failedLoginAttemptCount` |
227
+ | `temp` | Temporary what? | `intermediateCalculationResult` (or extract a function) |
228
+ | `data` | Data from where? | `rawApiResponse` or `parsedUserRecord` |
229
+ | `config` | Config for what? | `databaseConnectionConfig` |
230
+
231
+ #### Boolean Naming
232
+
233
+ Booleans should always be readable as a yes/no question:
234
+
235
+ - `isActive` not `active`
236
+ - `hasPermission` not `permission`
237
+ - `canEdit` not `editable`
238
+ - `shouldRetry` not `retry`
239
+ - `wasDeleted` not `deleted`
240
+
241
+ ---
242
+
243
+ ## Severity Reference
244
+
245
+ The SKILL.md severity matrix covers broad categories. This section provides finer guidance for borderline cases.
246
+
247
+ ### CRITICAL
248
+
249
+ Reserve CRITICAL for findings that represent immediate risk if the code ships:
250
+
251
+ - Any code path that could expose secrets, credentials, or PII
252
+ - SQL/command/script injection without sanitization
253
+ - Missing authentication on endpoints that modify data
254
+ - Logic that can corrupt or permanently destroy data
255
+ - Breaking changes to a public API or shared contract without versioning
256
+
257
+ Do not use CRITICAL for style issues, even severe ones.
258
+
259
+ ### HIGH
260
+
261
+ Use HIGH for issues that will cause problems in production — not might, but will, given normal usage:
262
+
263
+ - Logic error affecting the stated purpose of the code
264
+ - Missing error handling for a failure mode that occurs in the real world (network timeout, disk full, invalid user input)
265
+ - N+1 queries in endpoints that handle realistic data volumes
266
+ - Race condition in code that runs concurrently
267
+ - Architectural violation that will require significant rework later
268
+
269
+ ### MEDIUM
270
+
271
+ Use MEDIUM for issues that reduce quality, increase risk over time, or add friction without causing immediate breakage:
272
+
273
+ - Code duplication that will drift
274
+ - Missing tests for new, non-trivial logic
275
+ - Naming that requires reading surrounding code to understand
276
+ - Cyclomatic complexity between 10-15
277
+ - Missing documentation for public APIs
278
+ - Hard-coded values that belong in configuration
279
+
280
+ ### LOW
281
+
282
+ Use LOW for findings where the current code works correctly but could be improved:
283
+
284
+ - Style inconsistencies not caught by linters
285
+ - Mild optimization opportunities not in hot paths
286
+ - Naming that could be slightly clearer
287
+ - Comments that could be more precise
288
+ - Minor structural improvements with no behavioral impact
289
+
290
+ ### Nitpick (not a severity level)
291
+
292
+ Anything caught by a configured linter should not appear as a review finding. Flag it once if the linter is misconfigured, then stop.
293
+
294
+ ---
295
+
296
+ ## Severity Escalation Rules
297
+
298
+ Some findings warrant escalating from their initial severity based on context:
299
+
300
+ | Situation | Escalation |
301
+ |-----------|-----------|
302
+ | MEDIUM issue in security-critical path | Escalate to HIGH |
303
+ | LOW naming issue on public API boundary | Escalate to MEDIUM (it will outlive this PR) |
304
+ | HIGH issue but only reached by authenticated admins | May stay HIGH, document the mitigating control |
305
+ | MEDIUM duplication in code with frequent change history | Escalate to HIGH (drift will occur) |
306
+ | Any finding in code with zero test coverage | Escalate one level (harder to catch regressions) |
307
+
308
+ ---
309
+
310
+ ## Dimension Interaction
311
+
312
+ Dimensions are not fully independent. Findings often span multiple:
313
+
314
+ | Finding | Primary Dimension | Secondary Dimensions |
315
+ |---------|-------------------|----------------------|
316
+ | God Object | Design | Testability, Maintainability |
317
+ | Hardcoded API key | Security | Correctness (will break in different environments) |
318
+ | N+1 query | Performance | Correctness (may timeout in production) |
319
+ | Swallowed exception | Correctness | Readability (hides failure signals) |
320
+ | Missing null check | Correctness | Readability (reader cannot tell if null is valid) |
321
+
322
+ When a finding spans dimensions, report it under the highest-severity dimension and note the secondary impact in the recommendation.
@@ -0,0 +1,363 @@
1
+ ---
2
+ name: code-review
3
+ description: "Multi-perspective code review methodology with severity/confidence scoring, deduplication, and actionable findings"
4
+ license: MIT
5
+ compatibility: opencode
6
+ metadata:
7
+ category: development
8
+ version: "1.0"
9
+ ---
10
+
11
+ # Code Review
12
+
13
+ Roleplay as a code review methodology specialist that coordinates comprehensive review feedback across specialized perspectives.
14
+
15
+ CodeReview {
16
+ Activation {
17
+ Reviewing pull requests or code changes
18
+ Providing multi-perspective code analysis
19
+ Coordinating specialized review agents
20
+ Synthesizing findings into actionable feedback
21
+ }
22
+
23
+ Constraints {
24
+ 1. Every finding must include a specific location -- no generic "the codebase has issues"
25
+ 2. Every recommendation must be actionable -- no "consider improving"
26
+ 3. Include positive observations alongside issues
27
+ 4. Deduplicate overlapping findings across perspectives
28
+ 5. Sort findings by severity (Critical > High > Medium > Low) then confidence
29
+ }
30
+
31
+ ReviewPerspectives {
32
+ AlwaysReview {
33
+ | Perspective | Intent | What to Look For |
34
+ |-------------|--------|------------------|
35
+ | Security | Find vulnerabilities before they reach production | Auth/authz gaps, injection risks, hardcoded secrets, input validation, CSRF, cryptographic weaknesses |
36
+ | Simplification | Aggressively challenge unnecessary complexity | YAGNI violations, over-engineering, premature abstraction, dead code, "clever" code that should be obvious |
37
+ | Performance | Identify efficiency issues | N+1 queries, algorithm complexity, resource leaks, blocking operations, caching opportunities |
38
+ | Quality | Ensure code meets standards | SOLID violations, naming issues, error handling gaps, pattern inconsistencies, code smells |
39
+ | Testing | Verify adequate coverage | Missing tests for new code paths, edge cases not covered, test quality issues |
40
+ }
41
+
42
+ ReviewWhenApplicable {
43
+ | Perspective | Intent | Include When |
44
+ |-------------|--------|-------------|
45
+ | Concurrency | Find race conditions and async issues | Code uses async/await, threading, shared state, parallel operations |
46
+ | Dependencies | Assess supply chain security | Changes to package.json, requirements.txt, go.mod, Cargo.toml, etc. |
47
+ | Compatibility | Detect breaking changes | Modifications to public APIs, database schemas, config formats |
48
+ | Accessibility | Ensure inclusive design | Frontend/UI component changes |
49
+ | Constitution | Check project rules compliance | Project has CONSTITUTION.md |
50
+ }
51
+ }
52
+
53
+ SeverityClassification {
54
+ Evaluate top-to-bottom, first match wins:
55
+
56
+ | Trigger | Severity |
57
+ |---------|----------|
58
+ | Security vulnerability, data loss, production crash | CRITICAL |
59
+ | Incorrect behavior, perf regression, a11y blocker | HIGH |
60
+ | Code smell, maintainability, minor perf | MEDIUM |
61
+ | Style preference, minor improvement | LOW |
62
+ }
63
+
64
+ ConfidenceClassification {
65
+ | Level | Definition | Presentation |
66
+ |-------|------------|-------------|
67
+ | HIGH | Clear violation of established pattern or security rule | Present as definite issue |
68
+ | MEDIUM | Likely issue but context-dependent | Present as probable concern |
69
+ | LOW | Potential improvement, may not be applicable | Present as suggestion |
70
+ }
71
+
72
+ ClassificationMatrix {
73
+ | Finding Type | Severity | Confidence | Priority |
74
+ |--------------|----------|------------|----------|
75
+ | SQL Injection | CRITICAL | HIGH | Immediate |
76
+ | XSS Vulnerability | CRITICAL | HIGH | Immediate |
77
+ | Hardcoded Secret | CRITICAL | HIGH | Immediate |
78
+ | N+1 Query | HIGH | HIGH | Before merge |
79
+ | Missing Auth Check | CRITICAL | MEDIUM | Before merge |
80
+ | No Input Validation | MEDIUM | HIGH | Should fix |
81
+ | Long Function | LOW | HIGH | Nice to have |
82
+ | Missing Test | MEDIUM | MEDIUM | Should fix |
83
+ }
84
+
85
+ FindingFormat {
86
+ Every finding must include:
87
+ - id: Auto-assigned `[PREFIX]-NNN` (e.g., C1, H2, M3)
88
+ - title: One-line description (max 40 chars)
89
+ - severity: From severity classification
90
+ - confidence: HIGH / MEDIUM / LOW
91
+ - location: file:line or file:line-line
92
+ - finding: What was found (evidence-based)
93
+ - recommendation: What to do (actionable)
94
+ - diff: Suggested code change (required for CRITICAL, recommended for HIGH)
95
+ - principle: YAGNI, SRP, OWASP, etc. (if applicable)
96
+ - perspectives: Which review perspectives flagged this
97
+ }
98
+
99
+ VerdictDecision {
100
+ Evaluate top-to-bottom, first match wins:
101
+
102
+ | IF Critical > | AND High > | THEN Verdict |
103
+ |:---:|:---:|:---|
104
+ | 0 | Any | REVISIONS_NEEDED |
105
+ | -- | 3 | REVISIONS_NEEDED |
106
+ | -- | 1-3 | APPROVED_WITH_NOTES |
107
+ | -- | 0 (Medium > 0) | APPROVED_WITH_NOTES |
108
+ | -- | 0 (Low only or none) | APPROVED |
109
+
110
+ BLOCKED is reserved for findings that indicate the review cannot be completed (e.g., insufficient context, missing files).
111
+ }
112
+
113
+ AgentPromptTemplates {
114
+ SecurityReviewer {
115
+ ```
116
+ FOCUS: Security review of the provided code changes
117
+ - Identify authentication/authorization issues
118
+ - Check for injection vulnerabilities (SQL, XSS, command, LDAP)
119
+ - Look for hardcoded secrets or credentials
120
+ - Verify input validation and sanitization
121
+ - Check for insecure data handling (encryption, PII)
122
+ - Review session management
123
+ - Check for CSRF vulnerabilities in forms
124
+
125
+ EXCLUDE: Performance optimization, code style, or architectural patterns
126
+
127
+ CONTEXT:
128
+ - Files changed: [list]
129
+ - Changes: [the diff or code]
130
+ - Full file context: [surrounding code]
131
+
132
+ OUTPUT: Security findings in Finding format
133
+ SUCCESS: All security concerns identified with remediation steps
134
+ TERMINATION: Analysis complete OR code context insufficient
135
+ ```
136
+ }
137
+
138
+ PerformanceReviewer {
139
+ ```
140
+ FOCUS: Performance review of the provided code changes
141
+ - Identify N+1 query patterns
142
+ - Check for unnecessary re-renders or recomputations
143
+ - Look for blocking operations in async code
144
+ - Identify memory leaks or resource cleanup issues
145
+ - Check algorithm complexity (avoid O(n^2) when O(n) possible)
146
+ - Review caching opportunities
147
+ - Check for proper pagination
148
+
149
+ EXCLUDE: Security vulnerabilities, code style, or naming conventions
150
+
151
+ CONTEXT:
152
+ - Files changed: [list]
153
+ - Changes: [the diff or code]
154
+ - Full file context: [surrounding code]
155
+
156
+ OUTPUT: Performance findings in Finding format
157
+ SUCCESS: All performance concerns identified with optimization strategies
158
+ TERMINATION: Analysis complete OR code context insufficient
159
+ ```
160
+ }
161
+
162
+ QualityReviewer {
163
+ ```
164
+ FOCUS: Code quality review of the provided code changes
165
+ - Check adherence to project coding standards
166
+ - Identify code smells (long methods, duplication, complexity)
167
+ - Verify proper error handling
168
+ - Check naming conventions and code clarity
169
+ - Identify missing or inadequate documentation
170
+ - Verify consistent patterns with existing codebase
171
+ - Check for proper abstractions
172
+
173
+ EXCLUDE: Security vulnerabilities or performance optimization
174
+
175
+ CONTEXT:
176
+ - Files changed: [list]
177
+ - Changes: [the diff or code]
178
+ - Full file context: [surrounding code]
179
+ - Project standards: [from CLAUDE.md, .editorconfig]
180
+
181
+ OUTPUT: Quality findings in Finding format
182
+ SUCCESS: All quality concerns identified with clear improvements
183
+ TERMINATION: Analysis complete OR code context insufficient
184
+ ```
185
+ }
186
+
187
+ TestCoverageReviewer {
188
+ ```
189
+ FOCUS: Test coverage review of the provided code changes
190
+ - Identify new code paths that need tests
191
+ - Check if existing tests cover the changes
192
+ - Look for test quality issues (flaky, incomplete assertions)
193
+ - Verify edge cases are covered
194
+ - Check for proper mocking at boundaries
195
+ - Identify integration test needs
196
+ - Verify test naming and organization
197
+
198
+ EXCLUDE: Implementation details not related to testing
199
+
200
+ CONTEXT:
201
+ - Files changed: [list]
202
+ - Changes: [the diff or code]
203
+ - Full file context: [surrounding code]
204
+ - Related test files: [existing tests]
205
+
206
+ OUTPUT: Test coverage findings in Finding format
207
+ SUCCESS: All testing gaps identified with specific test recommendations
208
+ TERMINATION: Analysis complete OR code context insufficient
209
+ ```
210
+ }
211
+
212
+ SimplificationReviewer {
213
+ ```
214
+ FOCUS: Complexity review - aggressively challenge unnecessary complexity
215
+ - Identify YAGNI violations (You Aren't Gonna Need It)
216
+ - Find over-engineered solutions
217
+ - Spot premature abstractions
218
+ - Look for dead code paths
219
+ - Challenge "clever" code that should be obvious
220
+ - Find unnecessary indirection
221
+ - Identify code that could be deleted
222
+
223
+ EXCLUDE: Security vulnerabilities or performance optimization
224
+
225
+ CONTEXT:
226
+ - Files changed: [list]
227
+ - Changes: [the diff or code]
228
+ - Full file context: [surrounding code]
229
+
230
+ OUTPUT: Simplification findings in Finding format
231
+ SUCCESS: All complexity issues identified with simpler alternatives
232
+ TERMINATION: Analysis complete OR code context insufficient
233
+ ```
234
+ }
235
+ }
236
+
237
+ SynthesisProtocol {
238
+ DeduplicationAlgorithm {
239
+ 1. Collect all findings from all reviewers
240
+ 2. Group by location (file:line range overlap -- within 5 lines = potential overlap)
241
+ 3. For overlapping findings: keep highest severity, merge complementary details, credit all perspectives
242
+ 4. Sort by severity (Critical > High > Medium > Low) then confidence
243
+ 5. Assign finding IDs (C1, C2, H1, H2, M1, M2, L1, etc.)
244
+ }
245
+
246
+ MergeRules {
247
+ | Field | Merge Rule |
248
+ |-------|-----------|
249
+ | severity | `max()` -- keep the highest severity from any finding in the group |
250
+ | confidence | `max()` -- keep the highest confidence |
251
+ | title | Use the title from the highest-severity finding |
252
+ | location | Use the most specific location (narrowest line range) |
253
+ | finding | Combine descriptions from all perspectives, labeled by perspective |
254
+ | recommendation | Use the most actionable recommendation; append complementary ones |
255
+ | diff | Keep the most complete diff; prefer diffs from highest-severity finding |
256
+ | principle | Union of all principles cited |
257
+ | perspectives | List all perspectives that flagged this location |
258
+
259
+ ConflictResolution: When two findings have equal severity but different recommendations:
260
+ - If recommendations are complementary (address different aspects), combine them
261
+ - If recommendations conflict, keep the one from the more specialized perspective (e.g., Security > Quality for auth-related code)
262
+ }
263
+ }
264
+
265
+ PresentationFormat {
266
+ ```markdown
267
+ ## Code Review: [target]
268
+
269
+ **Verdict**: [VERDICT from decision table]
270
+
271
+ ### Summary
272
+
273
+ | Category | Critical | High | Medium | Low |
274
+ |----------|----------|------|--------|-----|
275
+ | Security | X | X | X | X |
276
+ | Simplification | X | X | X | X |
277
+ | Performance | X | X | X | X |
278
+ | Quality | X | X | X | X |
279
+ | Testing | X | X | X | X |
280
+ | **Total** | X | X | X | X |
281
+
282
+ *Critical & High Findings (Must Address)*
283
+
284
+ | ID | Finding | Remediation |
285
+ |----|---------|-------------|
286
+ | C1 | Brief title *(file:line)* | Specific fix *(concise issue description)* |
287
+ | H1 | Brief title *(file:line)* | Specific fix *(concise issue description)* |
288
+
289
+ #### Code Examples for Critical Fixes
290
+
291
+ **[C1] Title**
292
+ // Before -> After code diff
293
+
294
+ *Medium Findings (Should Address)*
295
+
296
+ | ID | Finding | Remediation |
297
+ |----|---------|-------------|
298
+ | M1 | Brief title *(file:line)* | Specific fix *(concise issue description)* |
299
+
300
+ *Low Findings (Consider)*
301
+
302
+ | ID | Finding | Remediation |
303
+ |----|---------|-------------|
304
+ | L1 | Brief title *(file:line)* | Specific fix *(concise issue description)* |
305
+
306
+ ### Strengths
307
+
308
+ - [Positive observation with specific code reference]
309
+
310
+ ### Verdict Reasoning
311
+
312
+ [Why this verdict was chosen based on findings]
313
+ ```
314
+
315
+ TableColumnGuidelines {
316
+ - ID: Severity letter + number (C1 = Critical #1, H2 = High #2, M1 = Medium #1, L1 = Low #1)
317
+ - Finding: Brief title + location in italics
318
+ - Remediation: Fix recommendation + issue context in italics
319
+ }
320
+
321
+ CodeExamples {
322
+ - REQUIRED for all Critical findings (before/after style)
323
+ - Include for High findings when the fix is non-obvious
324
+ - Medium/Low findings use table-only format
325
+ }
326
+ }
327
+
328
+ PositiveFeedback {
329
+ Always include positive observations alongside issues:
330
+ - Good test coverage
331
+ - Proper error handling
332
+ - Clear naming and structure
333
+ - Security best practices followed
334
+ - Performance considerations
335
+ - Clean abstractions
336
+ }
337
+
338
+ Scoping {
339
+ 1. Parse target:
340
+ - PR number: fetch PR diff via `gh pr diff`
341
+ - Branch name: diff against main/master
342
+ - `staged`: use `git diff --cached`
343
+ - File path: read file and recent changes
344
+
345
+ 2. Retrieve full file contents for context (not just diff)
346
+
347
+ 3. Analyze changes to determine applicable conditional perspectives:
348
+ - Contains async/await, Promise, threading: include Concurrency
349
+ - Modifies dependency files: include Dependencies
350
+ - Changes public API/schema: include Compatibility
351
+ - Modifies frontend components: include Accessibility
352
+ - Project has CONSTITUTION.md: include Constitution
353
+ }
354
+ }
355
+
356
+ ## References
357
+
358
+ See [reference.md](reference.md) for:
359
+ - Detailed per-perspective review checklists (Security, Performance, Quality, Testing, Simplification)
360
+ - Severity and confidence classification matrices
361
+ - Agent prompt templates with FOCUS/EXCLUDE structure
362
+ - Synthesis protocol for deduplicating findings
363
+ - Example findings with proper formatting