@mrciphersmith/keryx 0.4.27 → 0.4.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cli.js +105640 -105242
- package/dist/core.js +24 -200
- package/dist/keryx-general-worker-entry.js +355 -418
- package/package.json +3 -3
- package/src/gdskills/bundled/agents/work-planner.md +1 -1
- package/src/gdskills/bundled/install-manifest.json +4 -26
- package/src/gdskills/bundled/rules/core/clean-architecture.mdc +25 -153
- package/src/gdskills/bundled/rules/core/code-review-learned-profile.mdc +1 -2
- package/src/gdskills/bundled/rules/core/code-style-patterns.mdc +1 -0
- package/src/gdskills/bundled/rules/core/definition-of-done.mdc +0 -1
- package/src/gdskills/bundled/rules/core/error-handling.mdc +57 -108
- package/src/gdskills/bundled/rules/core/implementation-doc-mandate.mdc +4 -5
- package/src/gdskills/bundled/rules/core/jobs-documentation.mdc +8 -8
- package/src/gdskills/bundled/rules/core/skill-authoring.mdc +190 -0
- package/src/gdskills/bundled/rules/core/skills-storage-workflow.mdc +12 -10
- package/src/gdskills/bundled/rules/core/solid-principles.mdc +48 -123
- package/src/gdskills/bundled/skills/core/reviewer-skill-creator/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.md +12 -21
- package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.md +3 -3
- package/src/gdskills/bundled/skills/orchestration/flow-orchestrator/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.md +2 -2
- package/src/gdskills/bundled/skills/orchestration/task-implementer/input-contract.schema.json +1 -1
- package/src/gdskills/bundled/skills/planning/autodoc-orchestrator/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/planning/interview/SKILL.md +3 -4
- package/src/gdskills/bundled/skills/planning/interviewer/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/quality/git-publish/SKILL.md +60 -0
- package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/review/code-learned-review/SKILL.md +3 -3
- package/src/gdskills/bundled/skills/review/review-architecture/SKILL.md +6 -6
- package/src/gdskills/bundled/skills/review/review-backend/SKILL.md +23 -25
- package/src/gdskills/bundled/skills/review/review-clean-code/SKILL.md +100 -421
- package/src/gdskills/bundled/skills/review/review-core-boundaries/SKILL.md +2 -2
- package/src/gdskills/bundled/skills/review/review-degradation/SKILL.md +6 -6
- package/src/gdskills/bundled/skills/review/review-flow-graph/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/review/review-frontend/SKILL.md +36 -33
- package/src/gdskills/bundled/skills/review/review-frontend-conventions/SKILL.md +1 -1
- package/src/gdskills/bundled/skills/review/review-highload/SKILL.md +63 -134
- package/src/gdskills/bundled/skills/review/review-logic/SKILL.md +4 -5
- package/src/gdskills/bundled/skills/review/review-orchestrator/SKILL.detail.md +18 -20
- package/src/gdskills/bundled/skills/review/review-orchestrator/SKILL.md +12 -18
- package/src/gdskills/bundled/skills/review/review-orchestrator/reviewer-finding.schema.json +2 -2
- package/src/gdskills/bundled/skills/review/review-orchestrator/reviewer-input.schema.json +2 -10
- package/src/gdskills/bundled/skills/review/review-performance/SKILL.md +35 -35
- package/src/gdskills/bundled/skills/review/review-pr-contract/SKILL.md +4 -5
- package/src/gdskills/bundled/skills/review/review-premise/SKILL.md +2 -2
- package/src/gdskills/bundled/skills/review/review-regression/SKILL.md +2 -4
- package/src/gdskills/bundled/skills/review/review-security-code/SKILL.md +13 -14
- package/src/gdskills/bundled/skills/review/review-style/SKILL.md +41 -44
- package/src/gdskills/bundled/skills/review/review-testing-practices/SKILL.md +10 -10
- package/src/gdskills/bundled/skills/review/review-ui-ux/SKILL.md +10 -11
- package/src/gdskills/bundled/skills/review/review-verifier/SKILL.md +5 -5
- package/src/gdskills/bundled/skills/shared/git-merge-base.md +1 -1
- package/src/gdskills/bundled/stacks/csharp-dotnet/rules/patterns.mdc +4 -3
- package/src/gdskills/bundled/stacks/java-kotlin-spring/rules/coding-style.mdc +3 -3
- package/src/gdskills/bundled/stacks/mobx/agent-refs.json +1 -1
- package/src/gdskills/bundled/stacks/mobx/governance/scout.json +2 -2
- package/src/gdskills/bundled/stacks/mobx/skills/mobx-store-implementation/SKILL.md +2 -2
- package/src/gdskills/bundled/stacks/ruby-rails/rules/coding-style.mdc +4 -4
- package/src/gdskills/bundled/stacks/vue/governance/scout.json +1 -1
- package/src/gdskills/contracts/review-finding.schema.json +2 -2
- package/src/gdskills/bundled/rules/core/code-review-ai-assistant.mdc +0 -49
- package/src/gdskills/bundled/rules/core/gproject-contracts.mdc +0 -198
- package/src/gdskills/bundled/skills/orchestration/feature-dev/SKILL.md +0 -177
- package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.md +0 -414
- package/src/gdskills/bundled/skills/orchestration/job-documenter/input-contract.schema.json +0 -55
- package/src/gdskills/bundled/skills/orchestration/job-documenter/output-contract.schema.json +0 -58
- package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.codex.md +0 -209
- package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.cursor.md +0 -209
- package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.md +0 -208
- package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.codex.md +0 -255
- package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.cursor.md +0 -255
- package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.md +0 -254
- package/src/gdskills/bundled/skills/planning/planner/SKILL.codex.md +0 -209
- package/src/gdskills/bundled/skills/planning/planner/SKILL.cursor.md +0 -209
- package/src/gdskills/bundled/skills/planning/planner/SKILL.md +0 -208
- package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.codex.md +0 -171
- package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.cursor.md +0 -171
- package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.md +0 -170
- package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.codex.md +0 -184
- package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.cursor.md +0 -184
- package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.md +0 -183
- package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.codex.md +0 -249
- package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.cursor.md +0 -249
- package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.md +0 -248
- package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.codex.md +0 -199
- package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.cursor.md +0 -199
- package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.md +0 -198
- package/src/gdskills/bundled/skills/quality/commit/SKILL.md +0 -87
- package/src/gdskills/bundled/skills/quality/pr/SKILL.md +0 -95
- package/src/gdskills/bundled/skills/quality/push/SKILL.md +0 -73
- package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.md +0 -238
- package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.md +0 -301
- package/src/gdskills/bundled/skills/review/code-style-review/SKILL.md +0 -208
|
@@ -18,7 +18,7 @@ triggers:
|
|
|
18
18
|
- "Uncle Bob review"
|
|
19
19
|
metadata:
|
|
20
20
|
author: "MrCipherSmith"
|
|
21
|
-
version: "
|
|
21
|
+
version: "2.0.0"
|
|
22
22
|
category: "review"
|
|
23
23
|
compatible_harnesses: "cursor,codex,zed,opencode,claude"
|
|
24
24
|
license: "MIT"
|
|
@@ -26,50 +26,38 @@ license: "MIT"
|
|
|
26
26
|
|
|
27
27
|
# Review: Clean Code + SOLID
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
You know Clean Code and SOLID. This file does not teach them. It says which
|
|
30
|
+
project standard applies, where the project departs from the textbook, and how
|
|
31
|
+
to turn what you see into a finding or into silence.
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
Focus: maintainability of the code this change introduces, at function and class
|
|
34
|
+
level. Its inputs are the reviewer payload only; session memory and earlier
|
|
35
|
+
conversation are not inputs. It runs no command unless its payload's
|
|
36
|
+
`allowed_tools` says `run-tests`, except the read-only `git log`, `git blame` and
|
|
37
|
+
`git show` where its host gives a read-only child git (keryx shell does not:
|
|
38
|
+
there the payload supplies the history).
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## Workflow
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
Clean Code Review Progress:
|
|
42
|
-
- [ ] Step 1: Read Job Context (if provided)
|
|
43
|
-
- [ ] Step 2: Determine git scope (merge-base)
|
|
44
|
-
- [ ] Step 3: Collect diff and changed file list
|
|
45
|
-
- [ ] Step 4: Meaningful Names check
|
|
46
|
-
- [ ] Step 5: Functions check (size, abstraction, arguments)
|
|
47
|
-
- [ ] Step 6: Comments check
|
|
48
|
-
- [ ] Step 7: Error Handling check
|
|
49
|
-
- [ ] Step 8: DRY check
|
|
50
|
-
- [ ] Step 9: SOLID check (SRP, OCP, LSP, ISP, DIP)
|
|
51
|
-
- [ ] Step 10: Emit findings in unified format
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
---
|
|
40
|
+
## The standard
|
|
55
41
|
|
|
56
|
-
|
|
42
|
+
Read both rules before the diff. They are what the code was written against.
|
|
57
43
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
| `branch` | string | no | Branch to review. Defaults to current branch. |
|
|
61
|
-
| `commit_range` | string | no | Explicit hash or range. Overrides merge-base detection. |
|
|
62
|
-
| `context_doc` | string | no | Path to job context document. Read before reviewing. |
|
|
44
|
+
- `.metaproject/rules/core/solid-principles.mdc` — the **Thresholds** table and the SOLID rules.
|
|
45
|
+
- `.metaproject/rules/core/error-handling.mdc` — how failure is signalled, what a message carries, `cause`, silent catches.
|
|
63
46
|
|
|
64
|
-
|
|
47
|
+
A threshold there is your threshold. Under it, report nothing; never apply a
|
|
48
|
+
stricter textbook number. Where this file and a rule disagree, the rule wins.
|
|
65
49
|
|
|
66
|
-
## Scope
|
|
50
|
+
## Scope
|
|
67
51
|
|
|
68
|
-
|
|
52
|
+
Only code introduced or modified in this change.
|
|
69
53
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
54
|
+
**Debt the change did not create.** A threshold counts only when this change
|
|
55
|
+
crosses it. Check the before-state (diff context or base file) first. One more of
|
|
56
|
+
the same on code already over the line is not a finding: a line added to a
|
|
57
|
+
function already past the length threshold, another copy of a literal already
|
|
58
|
+
copied 3+ times, another parameter on a signature already at 4+. It is a finding
|
|
59
|
+
when the change crosses from under to over, or when the diff adds a
|
|
60
|
+
self-contained block that meets the threshold on its own — cite that block.
|
|
73
61
|
|
|
74
62
|
**Supplied text first.** When the payload carries `slices`, `context_files`, `diff` or `file_contents`, review exactly that text and never rebuild the diff. A choice's history (law 4) is read with `git log`, `git blame` and `git show` only where the host gives a read-only child git; on keryx shell a read-only child has no shell and no git tool, so read the `git log -L`/`git blame` excerpts the payload supplies, or say the history was not read. Only with none supplied, collect it:
|
|
75
63
|
```bash
|
|
@@ -77,8 +65,6 @@ git diff --name-status "${BASE_SHA}" && git diff "${BASE_SHA}" && git ls-files -
|
|
|
77
65
|
# explicit range: <FROM_SHA>..<TO_SHA> in place of "${BASE_SHA}"
|
|
78
66
|
```
|
|
79
67
|
|
|
80
|
-
---
|
|
81
|
-
|
|
82
68
|
## Iron Laws
|
|
83
69
|
|
|
84
70
|
### Shared laws (every reviewer)
|
|
@@ -95,319 +81,74 @@ boundary is the trigger-and-outcome test.
|
|
|
95
81
|
|
|
96
82
|
### Clean Code laws
|
|
97
83
|
|
|
98
|
-
1. **
|
|
99
|
-
2. **A naming issue is `minor`.** It reaches `major` only when the name has
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
#### A3. Consistent Vocabulary
|
|
143
|
-
|
|
144
|
-
- [ ] Same concept named differently in the same diff: `user` / `account` / `member` used interchangeably for the same domain entity
|
|
145
|
-
- [ ] Verb inconsistency for similar actions: `fetch` vs `get` vs `load` vs `retrieve` for the same type of operation in the same module
|
|
146
|
-
- [ ] Antonym inconsistency: if one side is `add`, the other should be `remove` — not `delete` / `destroy` / `clear`
|
|
147
|
-
|
|
148
|
-
Flags:
|
|
149
|
-
- Two names for the same concept in the same diff — **minor**
|
|
150
|
-
|
|
151
|
-
---
|
|
152
|
-
|
|
153
|
-
### Part B: Functions
|
|
154
|
-
|
|
155
|
-
#### B1. Function Size and Single Responsibility
|
|
156
|
-
|
|
157
|
-
Clean Code guideline: functions should do **one thing** at one level of abstraction.
|
|
158
|
-
|
|
159
|
-
- [ ] Function body exceeds ~20 lines: a strong smell that it does more than one thing
|
|
160
|
-
- [ ] Function mixes levels of abstraction: high-level orchestration next to low-level data manipulation in the same block
|
|
161
|
-
- [ ] Function that both queries data AND transforms it AND persists it (three responsibilities)
|
|
162
|
-
- [ ] Functions with a `And` or `Or` in the name, describing two operations
|
|
163
|
-
|
|
164
|
-
Flags:
|
|
165
|
-
- Function body >40 lines — **major** (clear overload; flag specific function by name)
|
|
166
|
-
- Function body 20–40 lines with visible mixed abstraction — **minor**
|
|
167
|
-
- `doXAndY()` naming explicitly stating two operations — **minor**
|
|
168
|
-
|
|
169
|
-
#### B2. Function Arguments
|
|
170
|
-
|
|
171
|
-
- [ ] Monadic (1 arg): ideal for transformations (`parseDate(str)`) and predicates (`isEmpty(list)`)
|
|
172
|
-
- [ ] Dyadic (2 args): acceptable when arguments form a natural ordered pair (`createPoint(x, y)`)
|
|
173
|
-
- [ ] Triadic (3 args): consider if a config/options object would read more clearly
|
|
174
|
-
- [ ] Polyadic (≥4 args): almost always a sign of a missing abstraction (config object, parameter object, or SRP violation)
|
|
175
|
-
- [ ] Boolean flag arguments: `renderWidget(true, false, true)` — split into separate functions or use named option objects
|
|
176
|
-
- [ ] Output arguments: a function that mutates its argument instead of returning a value (`populate(result)`)
|
|
177
|
-
|
|
178
|
-
Flags:
|
|
179
|
-
- Function with ≥4 parameters not using an options/config object — **major**
|
|
180
|
-
- Boolean flag parameter (`enabled: boolean`) passed to control function flow — **major** (split into two functions)
|
|
181
|
-
- Output argument (mutating parameter instead of returning) — **minor**
|
|
182
|
-
- Three parameters where a plain named object would be clearer — **minor**
|
|
183
|
-
|
|
184
|
-
#### B3. Abstraction Level Consistency
|
|
185
|
-
|
|
186
|
-
Each function should stay at one level of the abstraction ladder. A function that opens a file, reads its bytes, decodes UTF-8, splits lines, and validates each record mixes at least 3 levels.
|
|
187
|
-
|
|
188
|
-
- [ ] Inline low-level operations (string splitting, index arithmetic) inside a high-level orchestration function
|
|
189
|
-
- [ ] High-level domain concepts (`createUserAccount`) containing raw SQL or HTTP fetch calls instead of delegating to a repository/service
|
|
190
|
-
|
|
191
|
-
Flags:
|
|
192
|
-
- High-level function with low-level implementation detail mixed in — **minor**
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
### Part C: Comments
|
|
197
|
-
|
|
198
|
-
#### C1. Comments That Lie or Are Redundant
|
|
199
|
-
|
|
200
|
-
- [ ] Comment that repeats what the code already says: `i++ // increment i`
|
|
201
|
-
- [ ] Comment that is stale / no longer matches the current code
|
|
202
|
-
- [ ] Commented-out code left in the diff
|
|
203
|
-
|
|
204
|
-
Flags:
|
|
205
|
-
- Redundant comment restating the code — **minor**
|
|
206
|
-
- Stale comment contradicting the code — **minor** (misleads the next reader; it
|
|
207
|
-
names no runtime trigger, so the canonical rubric puts it here. It was
|
|
208
|
-
**major** in this file until that was reconciled against
|
|
209
|
-
`review-orchestrator/SKILL.md` → **Severity (canonical)**, which reviewers may
|
|
210
|
-
not override. If the comment's inaccuracy *causes* a defect — someone relied on
|
|
211
|
-
it and the code does otherwise — that defect is the finding, at its own severity)
|
|
212
|
-
- Commented-out code block — **minor** (use git history, not comments, to preserve old code)
|
|
213
|
-
|
|
214
|
-
#### C1a. Documentation drift — the shapes worth searching for
|
|
215
|
-
|
|
216
|
-
Stale comments are not found by reading comments; they are found by reading each
|
|
217
|
-
comment **against the statement it sits above**. Three shapes recur, and they are
|
|
218
|
-
the cheapest real findings in a multi-round review:
|
|
219
|
-
|
|
220
|
-
- **A doc describing the rule a later round replaced.** A prop's JSDoc says the
|
|
221
|
-
tooltip drops the split "unless both are known"; the live rule is that both must
|
|
222
|
-
be greater than zero. The behaviour changed, the sentence did not. Check every
|
|
223
|
-
doc comment on every symbol the diff touched, not only the ones the diff edited.
|
|
224
|
-
- **A comment detached from its statement.** A `const` gets inserted between a
|
|
225
|
-
comment and the expression it explained, so the comment now reads as an
|
|
226
|
-
explanation of the insertion. The text is unchanged and is now wrong. Look for
|
|
227
|
-
this wherever the diff adds a line inside an existing block.
|
|
228
|
-
- **Two files documenting one field oppositely.** One says a cell is the valid
|
|
229
|
-
percentage, another computes `100 - cell` and calls it the invalid percentage.
|
|
230
|
-
Only one is right, and the diff just made the field load-bearing.
|
|
231
|
-
|
|
232
|
-
Where an issue or PR is cited, check that it is the right one and still says what
|
|
233
|
-
the comment claims — a closed *issue* cited in place of the *PR* that shipped the
|
|
234
|
-
work sends the next reader to the wrong page.
|
|
235
|
-
|
|
236
|
-
A comment that describes a behaviour with **no code path at all** — including one
|
|
237
|
-
left behind by a review finding that was later withdrawn — is the same class: it
|
|
238
|
-
should state the defensiveness it actually provides, not assert a path that does
|
|
239
|
-
not exist.
|
|
240
|
-
|
|
241
|
-
#### C2. Comments That Compensate for Bad Names
|
|
242
|
-
|
|
243
|
-
A comment whose entire purpose is to explain a poorly-named identifier is a sign to improve the name, not add a comment.
|
|
244
|
-
|
|
245
|
-
- [ ] `// This is the pipeline execution queue` explaining a variable named `queue2`
|
|
246
|
-
- [ ] JSDoc `@param data The data to process` adding zero information
|
|
247
|
-
|
|
248
|
-
Flags:
|
|
249
|
-
- Comment exists only to explain a name that could be made self-documenting — **minor**
|
|
250
|
-
|
|
251
|
-
#### C3. Comments That Are Justified
|
|
252
|
-
|
|
253
|
-
These are the correct uses of comments — do NOT flag:
|
|
254
|
-
- Legal comments (license headers)
|
|
255
|
-
- Explanation of intent for a non-obvious algorithm or business rule
|
|
256
|
-
- Clarification of a subtle domain constraint (`// ISO week starts on Monday per business requirement`)
|
|
257
|
-
- Warning about consequences (`// Do not cache — response contains time-sensitive token`)
|
|
258
|
-
- TODO/FIXME with an issue reference (`// TODO(#1234): remove after migration`)
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
|
-
### Part D: Error Handling
|
|
263
|
-
|
|
264
|
-
#### D1. Error Types and Propagation
|
|
265
|
-
|
|
266
|
-
- [ ] Returning `null` or `undefined` to signal failure instead of throwing or using a Result type — causes null propagation and eventual NPE
|
|
267
|
-
- [ ] Swallowing exceptions: `catch (err) {}` with no logging or re-throw
|
|
268
|
-
- [ ] Logging AND re-throwing the same error — double-logs across callers
|
|
269
|
-
- [ ] Using error strings instead of typed errors: `throw new Error("NOT_FOUND")` — callers cannot pattern-match
|
|
270
|
-
- [ ] `catch (err: any)` — loses type safety; use `catch (err: unknown)`
|
|
271
|
-
|
|
272
|
-
Flags:
|
|
273
|
-
- `catch` block with empty body or only a comment — **major** (silent failure)
|
|
274
|
-
- Returning `null` / `undefined` from a function to signal "not found" in a critical path — **major**
|
|
275
|
-
- Log + rethrow in the same catch block — **minor**
|
|
276
|
-
- Untyped error in catch — **minor**
|
|
277
|
-
|
|
278
|
-
#### D2. Error Context
|
|
279
|
-
|
|
280
|
-
- [ ] Re-throwing an error without wrapping context: `throw err` loses the call site information; prefer `throw new AppError("context", { cause: err })`
|
|
281
|
-
- [ ] Generic `new Error("something went wrong")` — message must identify what went wrong and ideally what inputs caused it
|
|
282
|
-
|
|
283
|
-
Flags:
|
|
284
|
-
- Bare `throw err` re-throw losing context in a library/service boundary — **minor**
|
|
285
|
-
- Generic error message with no context — **minor**
|
|
286
|
-
|
|
287
|
-
---
|
|
288
|
-
|
|
289
|
-
### Part E: DRY (Don't Repeat Yourself)
|
|
290
|
-
|
|
291
|
-
#### E1. Code Duplication
|
|
292
|
-
|
|
293
|
-
- [ ] Identical or near-identical code blocks in ≥3 places in the diff
|
|
294
|
-
- [ ] Copy-pasted logic that differs only in one or two variable names
|
|
295
|
-
- [ ] Multiple functions doing the same transformation with slightly different wrapping
|
|
296
|
-
|
|
297
|
-
Flags:
|
|
298
|
-
- 3+ identical or near-identical blocks in the diff that could be extracted — **major**
|
|
299
|
-
- 2 occurrences — **minor** (note, do not raise unless the pattern is clearly intentional duplication)
|
|
300
|
-
|
|
301
|
-
#### E2. Magic Numbers and Strings
|
|
302
|
-
|
|
303
|
-
- [ ] Hardcoded numeric literal used in business logic with no named constant (`if (status === 3)`)
|
|
304
|
-
- [ ] Repeated string literal used as a key, type discriminant, or route path without a shared constant
|
|
305
|
-
|
|
306
|
-
Flags:
|
|
307
|
-
- Magic number in business logic (not an obvious neutral like `0`, `1`, `100`) — **minor**
|
|
308
|
-
- Repeated string constant defined inline in multiple places — **minor**
|
|
309
|
-
|
|
310
|
-
---
|
|
311
|
-
|
|
312
|
-
### Part F: SOLID (at function/class level)
|
|
313
|
-
|
|
314
|
-
This overlaps with `review-architecture` at the system level, but here the focus is on
|
|
315
|
-
**individual classes and functions**, not module structure or layer assignments.
|
|
316
|
-
|
|
317
|
-
#### F1. Single Responsibility Principle (SRP)
|
|
318
|
-
|
|
319
|
-
A class should have **one reason to change**: one owner (one part of the system that drives its evolution).
|
|
320
|
-
|
|
321
|
-
- [ ] Class responsible for both data access AND business logic
|
|
322
|
-
- [ ] Class responsible for both input validation AND output formatting
|
|
323
|
-
- [ ] A constructor that does real work: making network calls, reading files, computing state — constructors should only assign
|
|
324
|
-
|
|
325
|
-
Flags:
|
|
326
|
-
- Class with two clearly distinct responsibilities that have different change drivers — **major**
|
|
327
|
-
- Constructor performing I/O or async operations — **major**
|
|
328
|
-
- Service method doing validation + transformation + persistence inline — **minor**
|
|
329
|
-
|
|
330
|
-
#### F2. Open/Closed Principle (OCP)
|
|
331
|
-
|
|
332
|
-
Classes should be open for extension, closed for modification. Violations appear as chains that must grow every time a new case is added.
|
|
333
|
-
|
|
334
|
-
- [ ] `if/else if` or `switch` over a type discriminant that already has 3+ branches — consider a strategy/visitor pattern
|
|
335
|
-
- [ ] Adding a case to an existing long `switch` in a file not in the diff context — flag if the diff shows a new `case` in a multi-case switch
|
|
336
|
-
|
|
337
|
-
Flags:
|
|
338
|
-
- New `case` added to a switch with ≥4 existing cases where a strategy pattern would be more appropriate — **minor**
|
|
339
|
-
- `instanceof` chain (`if (x instanceof A) ... else if (x instanceof B)`) — **minor**
|
|
340
|
-
|
|
341
|
-
#### F3. Liskov Substitution Principle (LSP)
|
|
342
|
-
|
|
343
|
-
Subtypes must be substitutable for their base types without changing the program's behavior.
|
|
344
|
-
|
|
345
|
-
- [ ] Subclass `override` method that throws `NotImplementedException` or `UnsupportedOperationException`
|
|
346
|
-
- [ ] Subclass method that requires checking `instanceof this` to determine behavior
|
|
347
|
-
- [ ] Override that strengthens preconditions (rejects more inputs than the parent)
|
|
348
|
-
- [ ] Override that weakens postconditions (returns less than the parent guarantees)
|
|
349
|
-
|
|
350
|
-
Flags:
|
|
351
|
-
- Override throwing "not supported" — **major**
|
|
352
|
-
- Override requiring `instanceof` self-check — **major**
|
|
353
|
-
|
|
354
|
-
#### F4. Interface Segregation Principle (ISP)
|
|
355
|
-
|
|
356
|
-
Clients should not be forced to depend on methods they do not use.
|
|
357
|
-
|
|
358
|
-
- [ ] Interface with ≥7 methods where implementing classes use only a subset — split into smaller interfaces
|
|
359
|
-
- [ ] Abstract class method that all concrete subclasses implement as a no-op
|
|
360
|
-
|
|
361
|
-
Flags:
|
|
362
|
-
- Interface with methods that have stub/no-op implementations in subclasses — **minor**
|
|
363
|
-
|
|
364
|
-
#### F5. Dependency Inversion Principle (DIP) — at class level
|
|
365
|
-
|
|
366
|
-
High-level modules should not depend on low-level modules. Both should depend on abstractions.
|
|
367
|
-
|
|
368
|
-
- [ ] Class instantiating its own dependencies with `new` instead of receiving them via constructor injection
|
|
369
|
-
- [ ] Class importing a concrete implementation class from another module instead of an interface/abstract class
|
|
370
|
-
|
|
371
|
-
Flags:
|
|
372
|
-
- `new ConcreteService()` inside a class method that should receive it via DI — **major**
|
|
373
|
-
- Import of concrete implementation where an interface or abstract type exists — **minor**
|
|
374
|
-
|
|
375
|
-
---
|
|
84
|
+
1. **Every finding cites a `file:line` in the diff.** No observations about the codebase in general.
|
|
85
|
+
2. **A naming issue is `minor`.** It reaches `major` only when the name has already produced an observable wrong outcome at a call site you can name. Naming is never a `blocker`. (`review-style` carries the identical rule.)
|
|
86
|
+
3. **Duplication needs 3+ copies and is `minor`**, reported once with every copy. This lens owns duplication and comments; `review-style` defers to it.
|
|
87
|
+
4. **A SOLID finding names the principle, the two responsibilities or the broken contract, and the impact**, or it is `info`.
|
|
88
|
+
5. **Language idioms and framework conventions are not violations.**
|
|
89
|
+
|
|
90
|
+
## Decision table
|
|
91
|
+
|
|
92
|
+
Each row: what to look for, when it is a finding, and its default severity. Use
|
|
93
|
+
your own Clean Code judgment for anything not listed, but the same tests apply:
|
|
94
|
+
a named site, a threshold crossed by this change, a cost someone will pay.
|
|
95
|
+
|
|
96
|
+
| Signal | A finding when | Default | Not a finding |
|
|
97
|
+
|---|---|---|---|
|
|
98
|
+
| Failure paths: a hiding `catch`, failure as a value, lost `cause`, log-and-rethrow | per `error-handling.mdc` **Review severities** | as there | as there |
|
|
99
|
+
| Override that throws "not supported" or rejects base input | a named call site reaches it through the base type | `major`, or `blocker` on the crash/corruption outcome; else `minor` | — |
|
|
100
|
+
| Constructor doing I/O or async work | always | `minor`; `major` only with a named defect it causes | — |
|
|
101
|
+
| Function length | over 40 lines **and** two separable jobs or mixed abstraction levels | `minor` (name the jobs) | a long linear table, serializer, test or one-level sequence |
|
|
102
|
+
| I/O mixed with a transform | one function reads or writes (file, network, store) and transforms the data in between, at any length | `minor` (name the transform that should be a pure helper) | the transform already lives in a helper the I/O shell calls |
|
|
103
|
+
| Positional parameters | 4+, no options object, not a natural ordered set the codebase already uses | `minor` | — |
|
|
104
|
+
| Boolean flag parameter | it selects between two behaviours (`run(x, true)`) | `minor` | — |
|
|
105
|
+
| Output argument | a function fills a caller-supplied argument instead of returning | `minor` | — |
|
|
106
|
+
| Constructor dependencies | more than 5 | `minor` (name the two responsibilities) | — |
|
|
107
|
+
| Class or function with two change drivers | you can name both (e.g. validation + persistence) | `minor` | — |
|
|
108
|
+
| Branch chain over a type discriminant | 4+ branches, extended by the diff, and a map/strategy precedent exists (name it) | `minor` | no precedent in the codebase |
|
|
109
|
+
| Interface wider than its implementers | implementers leave methods as stubs/no-ops | `minor` | — |
|
|
110
|
+
| Business logic constructing its I/O, network or clock dependency | always | `minor` | a plain helper or value object built inside a module |
|
|
111
|
+
| Duplicated block | 3+ copies | `minor`, one finding listing every copy | 2 copies |
|
|
112
|
+
| Magic number / repeated string literal | business meaning, no named constant | `minor` | `0`, `1`, `100` and other neutral values |
|
|
113
|
+
| Name | needs a comment to be understood; generic (`data`, `result`, `temp`); two names for one concept in the diff; ambiguous boolean polarity | `minor` | loop counters; project-standard abbreviations |
|
|
114
|
+
| Comment | stale, contradicting the code; redundant; commented-out code; compensating for a bad name | `minor` | intent, a domain constraint, a warning, a TODO with an issue |
|
|
115
|
+
| Stylistic opinion; a future issue with no current violation | — | `info` | — |
|
|
116
|
+
|
|
117
|
+
## Documentation drift — search for it
|
|
118
|
+
|
|
119
|
+
A stale comment is found by reading each doc comment **against the statement it
|
|
120
|
+
sits above**, for every symbol the diff touched, not only the lines it edited.
|
|
121
|
+
Three shapes recur and are the cheapest real findings:
|
|
122
|
+
|
|
123
|
+
- **A doc describing the rule a later change replaced.** The behaviour changed, the sentence did not.
|
|
124
|
+
- **A comment detached from its statement.** A line inserted between a comment and the expression it explained.
|
|
125
|
+
- **Two places documenting one field or behaviour oppositely**, or a comment asserting a code path that does not exist.
|
|
126
|
+
|
|
127
|
+
Where an issue or PR is cited, check it is the right one and still says what the comment claims.
|
|
376
128
|
|
|
377
129
|
## Scope Boundaries
|
|
378
130
|
|
|
379
|
-
| Concern |
|
|
380
|
-
|
|
381
|
-
|
|
|
382
|
-
|
|
|
383
|
-
|
|
|
384
|
-
|
|
|
385
|
-
|
|
|
386
|
-
|
|
|
387
|
-
| Performance anti-patterns | NO | `review-performance` |
|
|
388
|
-
| React/MobX-specific frontend patterns | NO | `review-frontend` |
|
|
389
|
-
|
|
390
|
-
---
|
|
131
|
+
| Concern | Use instead |
|
|
132
|
+
|---------|-------------|
|
|
133
|
+
| Layer violations, module coupling, dependency direction | `review-architecture` |
|
|
134
|
+
| Naming convention formatting (casing, prefix) | `review-style` |
|
|
135
|
+
| Logic bugs, off-by-one errors, null-safety | `review-logic` |
|
|
136
|
+
| Security vulnerabilities | `review-security-code` |
|
|
137
|
+
| Performance anti-patterns | `review-performance` |
|
|
138
|
+
| React/MobX-specific frontend patterns | `review-frontend` |
|
|
391
139
|
|
|
392
140
|
## Orchestrated Review Contract
|
|
393
141
|
|
|
394
142
|
When dispatched by `review-orchestrator`, follow the provided `reviewer-input.schema.json` payload. Return a `REVIEW_RESULT` object compatible with `.metaproject/skills/gdskills/review/review-orchestrator/reviewer-finding.schema.json`, then a concise markdown summary. Keep findings evidence-based, include concrete `suggested_fix` for every blocker/major, and return `NEEDS_CONTEXT` instead of guessing when required context is missing.
|
|
395
143
|
|
|
396
|
-
---
|
|
397
|
-
|
|
398
144
|
## Finding Format
|
|
399
145
|
|
|
400
146
|
### Class scope — required for `blocker` and `major`
|
|
401
147
|
|
|
402
|
-
Every `blocker` and `major` finding
|
|
148
|
+
Every `blocker` and `major` finding carries `class_scope`: **every** site that
|
|
403
149
|
holds the shape you found, and **how you enumerated them** — the grep or query
|
|
404
|
-
you ran, or the guard that derives the set.
|
|
405
|
-
|
|
406
|
-
A finding anchored to one `file:line` is a claim about one site. The recorded
|
|
407
|
-
history of this repository is that a fix then repairs that site and leaves its
|
|
408
|
-
siblings: one writer of five, one operator instruction of four, six readers of
|
|
409
|
-
eight. Each was found by the *next* review round, which is why reviews here have
|
|
410
|
-
run to seven and four rounds instead of one.
|
|
150
|
+
you ran, or the guard that derives the set. A fix to one site that leaves its
|
|
151
|
+
siblings is what the next review round finds.
|
|
411
152
|
|
|
412
153
|
```yaml
|
|
413
154
|
class_scope:
|
|
@@ -415,49 +156,22 @@ class_scope:
|
|
|
415
156
|
enumeration_method: "grep for the config-path resolvers; 7 writers, 2 unguarded"
|
|
416
157
|
```
|
|
417
158
|
|
|
418
|
-
"I checked the others" is not an enumeration method.
|
|
419
|
-
is a claim that the class has exactly one member — make it deliberately, because
|
|
420
|
-
`review-finding.schema.json` accepts it and the next round tests it.
|
|
421
|
-
|
|
422
|
-
`minor` and `info` may omit it: enumerating the class for every low-severity
|
|
423
|
-
observation is theatre, not rigour.
|
|
159
|
+
"I checked the others" is not an enumeration method. `minor` and `info` may omit it.
|
|
424
160
|
|
|
425
161
|
```markdown
|
|
426
162
|
### [F-NNN] Title
|
|
427
163
|
|
|
428
164
|
- **Severity**: blocker | major | minor | info
|
|
429
165
|
- **File**: path/to/file.ts:line
|
|
430
|
-
- **Principle**: Clean Code —
|
|
166
|
+
- **Principle**: Clean Code — names | function design | comments | error handling | DRY | SOLID — SRP/OCP/LSP/ISP/DIP
|
|
431
167
|
- **Problem**: what is wrong and why it matters
|
|
432
168
|
- **Fix**: concrete actionable suggestion
|
|
433
|
-
- **Patch** (optional):
|
|
434
|
-
```diff
|
|
435
|
-
- old line
|
|
436
|
-
+ new line
|
|
437
|
-
```
|
|
438
169
|
```
|
|
439
170
|
|
|
440
|
-
Severity comes from **Severity (canonical)** in `review-orchestrator/SKILL.md
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
| Condition | Severity | Why, under the canonical rubric |
|
|
445
|
-
|---|---|---|
|
|
446
|
-
| Swallowed exception hiding a failed operation | `major` — `blocker` only if the caller then persists or returns wrong data | Same wording as `review-logic`, deliberately. Silent failure is wrong behaviour; corruption is a different shape |
|
|
447
|
-
| LSP violation that produces a wrong result or a crash at a named call site | `major`, or `blocker` on the crash/corruption outcome | The outcome decides, not the principle's name |
|
|
448
|
-
| Constructor performing I/O | `major` | Named trigger (constructing it) and named outcome (the I/O runs); untestable is not one of the four shapes |
|
|
449
|
-
| Function > 40 lines; ≥ 4 parameters without an options object; boolean flag argument; class with two distinct responsibilities; `new ConcreteService()` bypassing DI | `minor` | The code is correct. The cost is to whoever reads or edits it next — that is exactly `minor` |
|
|
450
|
-
| Poor naming; redundant comment; magic number; 20–40 line function; OCP/ISP smell; log-and-rethrow | `minor` | Same |
|
|
451
|
-
| Stylistic opinion; a future issue with no current violation | `info` | Neither trigger nor a named maintenance cost |
|
|
452
|
-
|
|
453
|
-
**Clean Code findings are `minor` by default.** A long function with a named
|
|
454
|
-
responsibility split is a maintenance cost, not observable wrong behaviour, and
|
|
455
|
-
`major` is reserved for findings that name a trigger and an outcome. This
|
|
456
|
-
reviewer previously called a 41-line function `major` and thereby forced
|
|
457
|
-
`REQUEST_CHANGES` on it; that is the exact mis-ranking the canonical rubric
|
|
458
|
-
exists to stop.
|
|
459
|
-
|
|
460
|
-
---
|
|
171
|
+
Severity comes from **Severity (canonical)** in `review-orchestrator/SKILL.md`;
|
|
172
|
+
the Default column above is where this lens's conditions land under it, not a
|
|
173
|
+
second rubric. **Clean Code findings are `minor` by default**: a maintenance
|
|
174
|
+
cost, not wrong behaviour. `major` needs a named trigger and outcome.
|
|
461
175
|
|
|
462
176
|
## Output Contract
|
|
463
177
|
|
|
@@ -469,70 +183,35 @@ STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED
|
|
|
469
183
|
## Clean Code Review
|
|
470
184
|
|
|
471
185
|
### Review Scope
|
|
472
|
-
- Branch: `<BRANCH>`
|
|
473
|
-
-
|
|
474
|
-
- Merge-base: `<BASE_SHA>`
|
|
475
|
-
- Scope mode: `<default-with-uncommitted | explicit-hash-range>`
|
|
476
|
-
- Changed files reviewed: <N>
|
|
186
|
+
- Branch: `<BRANCH>` | Parent ref: `<PARENT>` | Merge-base: `<BASE_SHA>`
|
|
187
|
+
- Scope mode: `<default-with-uncommitted | explicit-hash-range>` | Changed files reviewed: <N>
|
|
477
188
|
|
|
478
189
|
### Summary
|
|
479
|
-
<2-3 sentences
|
|
190
|
+
<2-3 sentences.>
|
|
480
191
|
|
|
481
192
|
### Stats
|
|
482
193
|
- blocker: N | major: N | minor: N | info: N
|
|
483
194
|
|
|
484
195
|
### Findings
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
<[F-NNN] findings or "No naming issues found.">
|
|
488
|
-
|
|
489
|
-
#### Functions
|
|
490
|
-
<[F-NNN] findings or "No function design issues found.">
|
|
491
|
-
|
|
492
|
-
#### Comments
|
|
493
|
-
<[F-NNN] findings or "No comment issues found.">
|
|
494
|
-
|
|
495
|
-
#### Error Handling
|
|
496
|
-
<[F-NNN] findings or "No error handling issues found.">
|
|
497
|
-
|
|
498
|
-
#### DRY
|
|
499
|
-
<[F-NNN] findings or "No DRY violations found.">
|
|
500
|
-
|
|
501
|
-
#### SOLID
|
|
502
|
-
<[F-NNN] findings or "No SOLID violations found.">
|
|
196
|
+
One `####` section per area (Naming, Functions, Comments, Error Handling, DRY,
|
|
197
|
+
SOLID): its `[F-NNN]` findings, or "No <area> issues found."
|
|
503
198
|
|
|
504
199
|
### Clean Areas
|
|
505
|
-
[
|
|
200
|
+
[Areas checked with no findings]
|
|
506
201
|
```
|
|
507
202
|
|
|
508
|
-
---
|
|
509
|
-
|
|
510
203
|
## Job Context Awareness
|
|
511
204
|
|
|
512
|
-
When dispatched by `review-orchestrator` or `job-orchestrator`, the prompt MAY include
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
JOB_NAME: <job-name>
|
|
516
|
-
CONTEXT_PATH: <JOBS_ROOT>/<job-name>/ai/context.md
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
If provided and the file exists, read the context document before reviewing. Use it to:
|
|
520
|
-
- Understand team-agreed naming conventions that may differ from defaults
|
|
521
|
-
- Identify intentional design decisions that appear to violate Clean Code but are documented exceptions
|
|
522
|
-
- Understand error handling strategy (Result types vs. exceptions vs. null)
|
|
523
|
-
|
|
524
|
-
If absent, proceed normally — context is optional and non-blocking.
|
|
525
|
-
|
|
526
|
-
---
|
|
205
|
+
When dispatched by `review-orchestrator` or `job-orchestrator`, the prompt MAY include
|
|
206
|
+
`JOB_NAME` and `CONTEXT_PATH: <JOBS_ROOT>/<job-name>/ai/context.md`. If the file
|
|
207
|
+
exists, read it first for team conventions and documented exceptions. If absent, proceed.
|
|
527
208
|
|
|
528
209
|
## Red Flags
|
|
529
210
|
|
|
530
211
|
| Rationalization | Why it is wrong |
|
|
531
212
|
|----------------|-----------------|
|
|
532
|
-
| "
|
|
533
|
-
| "
|
|
534
|
-
| "
|
|
535
|
-
| "
|
|
536
|
-
| "
|
|
537
|
-
| "I can flag SOLID issues at info because they're just design opinions" | Named SOLID violations with concrete impact (testability, extensibility) are at least minor |
|
|
538
|
-
| "This is how the framework works, so it's not a violation" | Framework idioms are explicitly exempt — Iron Law 5 |
|
|
213
|
+
| "Stricter is safer, I'll flag 25-line functions too" | The threshold is the shared standard the writer followed. A finding under it is noise |
|
|
214
|
+
| "It's over the threshold" (when it already was before this change) | Old debt is not this change's finding |
|
|
215
|
+
| "The catch block logs the error, that's enough" | Logging and swallowing are the same if the caller proceeds — check what happens after the catch |
|
|
216
|
+
| "I can flag SOLID issues at info because they're just design opinions" | A named violation with a concrete impact is at least `minor` |
|
|
217
|
+
| "This is how the framework works, so it's not a violation" | Framework idioms are exempt — Clean Code law 5 |
|
|
@@ -16,7 +16,7 @@ triggers:
|
|
|
16
16
|
- "review core boundaries"
|
|
17
17
|
metadata:
|
|
18
18
|
author: "MrCipherSmith"
|
|
19
|
-
version: "1.
|
|
19
|
+
version: "1.1.0"
|
|
20
20
|
category: "review"
|
|
21
21
|
license: "MIT"
|
|
22
22
|
---
|
|
@@ -120,7 +120,7 @@ conditions land under that rubric.
|
|
|
120
120
|
| Condition | Severity | Why, under the canonical rubric |
|
|
121
121
|
|---|---|---|
|
|
122
122
|
| A core API change that breaks a named consumer at runtime | `blocker` | Crash at a named call site |
|
|
123
|
-
| Importing feature code into core; adding feature-specific public API to core; inverted dependency | `major`
|
|
123
|
+
| Importing feature code into core; adding feature-specific public API to core; inverted dependency | `minor` — `major` only when a concrete defect it causes is named (trigger and outcome) or a stated project rule makes it one | A layer violation. Identical to `review-architecture` for the same condition |
|
|
124
124
|
| A generic helper whose names or types lean on one feature's language | `minor` | Works today; the cost is to the next module that needs it |
|
|
125
125
|
| A blast-radius concern with no named consumer | `info` | Shared law 1 |
|
|
126
126
|
|