@softure-ai/skills 0.2.0 → 0.3.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 (51) hide show
  1. package/README.md +4 -0
  2. package/WORKFLOW.md +6 -2
  3. package/package.json +1 -1
  4. package/scripts/install.mjs +5 -0
  5. package/skills/softure-archive/SKILL.md +76 -24
  6. package/skills/softure-archive/references/example-archive.md +106 -0
  7. package/skills/softure-code-review/SKILL.md +68 -18
  8. package/skills/softure-code-review/references/example-review.md +108 -0
  9. package/skills/softure-frame/SKILL.md +129 -40
  10. package/skills/softure-frame/references/diagnostic-lens.md +85 -0
  11. package/skills/softure-frame/references/examples.md +111 -0
  12. package/skills/softure-frame/references/pushback.md +38 -0
  13. package/skills/softure-impl-review/SKILL.md +138 -76
  14. package/skills/softure-impl-review/references/example-review.md +127 -0
  15. package/skills/softure-impl-review/references/rubric.md +120 -0
  16. package/skills/softure-impl-review/references/triage.md +124 -0
  17. package/skills/softure-implement/SKILL.md +116 -49
  18. package/skills/softure-implement/references/phase-commit.md +214 -0
  19. package/skills/softure-implement/references/worked-example.md +201 -0
  20. package/skills/softure-init/SKILL.md +57 -41
  21. package/skills/softure-init/references/example.md +96 -0
  22. package/skills/softure-init/references/templates.md +73 -0
  23. package/skills/softure-lesson/SKILL.md +47 -19
  24. package/skills/softure-lesson/references/examples.md +65 -0
  25. package/skills/softure-new/SKILL.md +100 -43
  26. package/skills/softure-new/references/example-change.md +149 -0
  27. package/skills/softure-new/references/placement.md +60 -0
  28. package/skills/softure-plan/SKILL.md +182 -50
  29. package/skills/softure-plan/references/plan-example.md +206 -0
  30. package/skills/softure-plan/references/progress-format.md +56 -2
  31. package/skills/softure-plan/references/questioning.md +162 -0
  32. package/skills/softure-plan-review/SKILL.md +211 -83
  33. package/skills/softure-plan-review/references/lenses.md +121 -0
  34. package/skills/softure-plan-review/references/review-example.md +184 -0
  35. package/skills/softure-prd/SKILL.md +130 -71
  36. package/skills/softure-prd/references/example-prd.md +233 -0
  37. package/skills/softure-prd/references/leak-lint.md +43 -0
  38. package/skills/softure-prd/references/prd-template.md +219 -0
  39. package/skills/softure-research/SKILL.md +73 -33
  40. package/skills/softure-research/references/example-research.md +106 -0
  41. package/skills/softure-research/references/fan-out.md +61 -0
  42. package/skills/softure-roadmap/SKILL.md +211 -65
  43. package/skills/softure-roadmap/references/example-roadmap.md +203 -0
  44. package/skills/softure-roadmap/references/interview.md +132 -0
  45. package/skills/softure-roadmap/references/slicing.md +118 -0
  46. package/skills/softure-rule-review/SKILL.md +83 -19
  47. package/skills/softure-rule-review/references/example-report.md +73 -0
  48. package/skills/softure-rule-review/references/scorecard.md +129 -0
  49. package/skills/softure-shape/SKILL.md +163 -53
  50. package/skills/softure-shape/references/example-shape-notes.md +192 -0
  51. package/skills/softure-shape/references/question-bank.md +248 -0
@@ -1,14 +1,16 @@
1
1
  ---
2
2
  name: softure-impl-review
3
3
  description: >
4
- Review a finished implementation against its plan before it is archived or merged: drift
5
- from plan.md, correctness bugs, missing or weak tests, dishonest Progress (ticked but not
6
- done), unsafe migrations and security gaps. Every finding gets a severity and a decision;
7
- accepted fixes are applied and committed. Writes context/changes/<change-id>/reviews/impl-review.md
8
- and sets change.md status to impl_reviewed. Use after softure-implement finishes the last
9
- phase, or when the user says "review the implementation", "impl review", "check it against
10
- the plan", "review what was done".
11
- argument-hint: "<change-id> [--auto] [--no-fix]"
4
+ Review a finished implementation (or one finished phase) against its plan before it is
5
+ archived or merged: drift from plan.md, correctness bugs, missing or weak tests, dishonest
6
+ Progress (ticked but not done), unsafe migrations, security gaps and broken project
7
+ patterns. Every finding gets a severity, an impact, a recommended fix and a decision, triaged
8
+ with the user one by one or in a batch; accepted fixes are applied and committed. Writes
9
+ context/changes/<change-id>/reviews/impl-review.md and sets change.md status to
10
+ impl_reviewed. Use after softure-implement finishes the last phase, or when the user says
11
+ "review the implementation", "impl review", "check it against the plan", "review what was
12
+ done", "review phase N".
13
+ argument-hint: "<change-id> [phase N] [--triage] [--auto] [--no-fix]"
12
14
  allowed-tools:
13
15
  - Read
14
16
  - Glob
@@ -16,135 +18,195 @@ allowed-tools:
16
18
  - Edit
17
19
  - Write
18
20
  - Bash
21
+ - Agent
19
22
  - AskUserQuestion
20
23
  ---
21
24
 
22
25
  # softure-impl-review: does the code do what the plan promised?
23
26
 
24
27
  Contract: `WORKFLOW.md` §4 (change.md status), §6 (plan.md Progress), §8 (--auto), §9 (commits).
25
- Project commands come from `context/workflow.json`. Never hard-code them.
28
+ Project commands come from `context/workflow.json`. Never hard-code them. The report's headings
29
+ are fixed English; its prose follows `language` in workflow.json.
30
+
31
+ Read when needed:
32
+ - `references/rubric.md`: the dimensions and what to check in each, severity and impact scales,
33
+ the finding format with fix options, verdict rules, briefs for review subagents. Read before
34
+ grading.
35
+ - `references/triage.md`: the chat summary, the questions asked per finding, how each answer is
36
+ handled, the lesson flow, resuming a saved triage. Read before talking to the user.
37
+ - `references/example-review.md`: a complete `reviews/impl-review.md` for an invoicing change.
38
+ Read before writing the report.
39
+
40
+ ## Scope
41
+
42
+ | Invocation | Reviews | Requires | Writes | Status |
43
+ |---|---|---|---|---|
44
+ | `<change-id>` | all phases | `status: implemented` | `reviews/impl-review.md` | → `impl_reviewed` |
45
+ | `<change-id> phase N` | phase N, plus whether it broke what earlier phases assumed | phase N's Automated items all ticked | `reviews/impl-review-p<N>.md` | unchanged |
46
+ | `<change-id> [phase N] --triage` | nothing new; resumes deciding a saved report | a report with `**Decision:** pending` | the same report | as for its scope, once nothing is pending |
47
+
48
+ - Full review on `implementing`: stop and name the first open `- [ ]` Automated item.
49
+ - A path under `context/archive/`: refuse; archived changes are not reviewed again.
50
+ - No argument, interactive: list changes with status `implementing` or `implemented`, recommend
51
+ the most recently `updated`, and ask. `--auto`: the change-id is mandatory.
52
+ - The report already exists with pending decisions: interactive, ask "Resume triage"
53
+ (recommended) or "Review again from scratch" (keep earlier decisions for findings that still
54
+ apply); `--auto`, decide the pending ones by the `--auto` rules.
26
55
 
27
56
  ## Inputs
28
57
 
29
- - `context/changes/<change-id>/change.md`. Status must be `implemented`. If it is
30
- `implementing`, stop and name the first open `- [ ]` item: the plan is not finished.
31
- - `plan.md`, `research.md`, and `frame.md` if it exists.
32
- - The change's commits: `git log --oneline <mainBranch>..HEAD`, plus the full diff
33
- `git diff <mainBranch>...HEAD`.
58
+ - `change.md`, `plan.md`, `research.md`, and `frame.md` if it exists.
59
+ - The change's commits: `git log --oneline <mainBranch>..HEAD`, plus `git diff <mainBranch>...HEAD`
60
+ (for a phase review: that phase's commit).
34
61
  - `context/foundation/lessons.md`: existing rules the code must respect.
62
+ - The project's AGENTS.md / CLAUDE.md conventions.
35
63
 
36
64
  ## Procedure
37
65
 
38
- 1. **Map the plan to commits.** For each `## Phase N`, find its commit
39
- (`(<change-id>): … (pN)`) and the files it touched. Any phase without a commit, or any
40
- commit outside every phase, is a finding.
41
- 2. **Audit Progress honesty.** For every `- [x]` item, find the evidence: a test name, a file,
42
- a command output, a screenshot path. A ticked box without evidence is a **CRITICAL**
43
- finding. Re-run the gates (`gates.*` in workflow.json) and record the result. Do not trust
44
- earlier runs.
45
- 3. **Check drift.** List everything the code does that the plan did not ask for, and everything
46
- the plan asked for that the code does not do. Intentional drift must be explained in
47
- plan.md (`## Decisions (auto)` or a phase note). Unexplained drift is a finding.
48
- 4. **Read for correctness.** Read every changed file in full, not just the hunks. Check:
49
- - edge cases (empty, null, boundaries, time zones, money rounding);
50
- - error paths: is each one surfaced or swallowed?
51
- - concurrency: unconditional UPDATEs, read-then-write without locking;
52
- - transaction boundaries;
53
- - cache and revalidation after writes.
54
- 5. **Check tests.** Does each new behaviour have a test that fails without the change? Assertions
55
- should be specific (`toEqual` over `toBeTruthy`). For the riskiest behaviour, temporarily
56
- break it and confirm a test goes red. Revert the break before continuing.
57
- 6. **Check migrations** (if `migrations.dir` changed):
58
- - forward-only;
59
- - rollback note present;
60
- - no destructive change without a data plan;
61
- - indexes for new lookups;
62
- - constraints enforce invariants in the database, not only in code;
63
- - numbering does not collide with the main branch.
64
- 7. **Check security:**
65
- - authorization on every new action and route, not just authentication;
66
- - input validated at the boundary;
67
- - parameterized SQL only;
68
- - no secrets in code or logs;
69
- - no stack traces in responses;
70
- - rate limits on anything public.
71
- 8. **Check lessons.** Is any rule in lessons.md violated? Cite the lesson ID.
72
- 9. **Write the report** (template below). Then decide each finding:
73
- - interactive: one AskUserQuestion per CRITICAL, batched for the rest;
74
- - `--auto`: see below.
75
- 10. **Apply the fixes** marked `fix now`. Re-run the gates, then commit
76
- `fix(<change-id>): address impl review`. Add the fix commit SHA to the report.
77
- 11. Set change.md `status: impl_reviewed` and update `updated`. Commit the report together
78
- with the fixes, or alone with `docs(<change-id>): impl review` if nothing was fixed.
79
-
80
- ## Severities and decisions
66
+ 1. **Map the plan to commits and files.** For each `## Phase N`, find its commit
67
+ (`(<change-id>): … (pN)`). A phase without a commit, or a commit outside every phase (other
68
+ than `fix`, `docs(<id>): progress` and review commits), is a finding. Then compare the files the
69
+ plan names with the files the diff touches: in both (check the content matches the intent),
70
+ only in the diff (unplanned: investigate), only in the plan (possibly missing).
71
+ 2. **Audit Progress honesty.** For every `- [x]`, find the evidence: a test name, a file, a
72
+ command output, a screenshot. Re-run the gates (`gates.*`) and every Automated criterion that
73
+ names a command; do not trust earlier runs. A ticked box without evidence is **CRITICAL**.
74
+ `(verified by agent: …)` must point at something that exists. Open Manual items are pending,
75
+ not findings.
76
+ 3. **Check drift.** Everything the code does that the plan did not ask for, everything the plan
77
+ asked for that the code does not do. Intentional drift must be explained in plan.md
78
+ (`## Decisions (auto)` or a phase note). Unexplained drift is a finding. A flaw in the plan
79
+ itself (an insecure approach it prescribed) is a finding too.
80
+ 4. **Read for correctness.** Read every changed file in full, not just the hunks: edge cases
81
+ (empty, null, boundaries, time zones, money rounding), error paths (surfaced or swallowed?),
82
+ concurrency (unconditional UPDATEs, read-then-write without locking), transaction boundaries,
83
+ cache and revalidation after writes, performance (N+1 queries, unbounded loops or result sets),
84
+ resource leaks.
85
+ 5. **Check tests.** Does each new behaviour have a test that fails without the change? Are the
86
+ assertions specific? For the riskiest behaviour, temporarily break it and confirm a test goes
87
+ red (copy the file aside first, restore it from that copy). Record the result.
88
+ 6. **Check migrations** (if `migrations.dir` changed): forward-only, rollback note, no destructive
89
+ change without a data plan, indexes for new lookups, constraints enforce invariants in the
90
+ database, numbering does not collide with the main branch.
91
+ 7. **Check security:** authorization on every new action and route (not just a session), input
92
+ validated at the boundary, parameterized SQL, no secrets in code or logs, no stack traces in
93
+ responses, rate limits on anything public.
94
+ 8. **Check patterns and lessons.** For each new module, compare with one or two siblings that do
95
+ the same kind of job (registration, error handling, structure, tests). Report only substantive
96
+ mismatches, scaled to the size of the diff. Cite any `lessons.md` rule the code breaks by ID.
97
+
98
+ For a diff over about ten files, fan out read-only subagents with targeted briefs
99
+ (`references/rubric.md`) instead of loading every file into the main context.
100
+ 9. **Grade and recommend.** Each finding gets a severity, an impact, a dimension, a location,
101
+ evidence and one recommended fix (two only for a genuine trade-off). Consolidate to at most
102
+ ten findings; never merge away a CRITICAL. Set a verdict per dimension and overall.
103
+ 10. **Triage.** Interactive: print the chat summary, then ask how to proceed and decide each
104
+ finding (`references/triage.md`): CRITICAL and HIGH-impact findings one by one, the rest one
105
+ by one or as a batch of recommended decisions. `--auto`: see below. `--no-fix`: decide, apply
106
+ nothing.
107
+ 11. **Apply the fixes** decided `fix now`: minimal edits, no refactoring around them. For a
108
+ MEDIUM or HIGH impact fix, show the before/after first. Re-run the gates, re-check each fixed
109
+ CRITICAL the way it was found, and commit `fix(<change-id>): address impl review`. That commit
110
+ also carries any pending Progress SHA edit from implementation.
111
+ 12. **Write and commit the report.** Write the fix SHA into each decision, set change.md
112
+ `status: impl_reviewed` and `updated` (full review only, and only when no decision is
113
+ pending), then commit the report and change.md as `docs(<change-id>): impl review` (phase
114
+ review: `docs(<change-id>): impl review p<N>`). The report never rides in the fix commit,
115
+ because it records that commit's SHA. Never amend.
116
+
117
+ ## Severities, impact and decisions
81
118
 
82
119
  | Severity | Meaning |
83
120
  |---|---|
84
121
  | CRITICAL | Wrong behaviour, data loss risk, security hole, or Progress claims something not done. Blocks archive and merge. |
85
- | WARNING | Real defect or gap with limited blast radius: missing test, unclear error, drift without explanation. |
122
+ | WARNING | Real defect or gap with limited blast radius: missing test, unclear error, drift without explanation, a broken pattern. |
86
123
  | SUGGESTION | Better, but not wrong. Never blocks. |
87
124
 
88
- Each finding gets exactly one decision. Never leave a finding without one.
89
- - `fix now`: applied in this run.
90
- - `accept`: risk understood and kept; give the reason.
91
- - `defer`: goes to `context/backlog/` or the roadmap "Owner decisions and checks" list; give the target.
92
- - `record as lesson`: hand off to softure-lesson with a one-line rule draft. This can be combined
93
- with `fix now`.
125
+ Impact is how much thought the **decision** needs, not how bad the defect is: LOW (the fix is
126
+ obvious and narrow), MEDIUM (a real trade-off), HIGH (wide blast radius or no clear best path). A
127
+ CRITICAL can be LOW impact (one obvious line) and a WARNING HIGH (an architectural choice).
128
+
129
+ Each finding gets exactly one decision. Never leave one without it, except while a triage is
130
+ saved for later; `pending` is not a decision, and archive and merge treat it as open.
131
+ - `fix now`: applied in this run (record which option, and the SHA).
132
+ - `accept`: risk understood and kept; give the reason and who accepted. Only the owner accepts a CRITICAL.
133
+ - `defer`: goes to `context/backlog/<topic>.md` (WORKFLOW §3 entry format) or the roadmap
134
+ "Owner decisions and checks" list; give the target.
135
+ - `withdrawn`: the finding was wrong; say why (keeps the audit trail honest).
136
+ - `record as lesson`: hand off to `softure-lesson --from <change-id>#F<n>` with a one-line rule
137
+ draft. Combined with `fix now` unless the lesson is purely about process.
94
138
 
95
139
  ## Output: `reviews/impl-review.md`
96
140
 
141
+ Layout (full example in `references/example-review.md`):
142
+
97
143
  ```markdown
98
144
  # Implementation review: <change-id>
99
145
 
100
- Date: YYYY-MM-DD · Commits: <first>..<last> · Gates: typecheck ✓ lint ✓ test ✓ (N tests)
146
+ Scope: full | phase N · Date: YYYY-MM-DD · Commits: <first>..<last> · Gates: typecheck ✓ lint ✓ test ✓ (N tests)
101
147
 
102
148
  ## Verdict
103
149
  Ready / Ready after fixes / Not ready. One paragraph.
104
150
 
151
+ ## Dimensions
152
+ | Dimension | Verdict | Findings |
153
+
105
154
  ## Plan coverage
106
155
  | Phase | Commit | Delivered | Notes |
156
+ Files: planned and changed N · unplanned N (…) · planned, not changed N (…)
107
157
 
108
158
  ## Findings
109
159
  ### F1 [CRITICAL] <title>
110
- **Where:** path:line · **What:** … · **Why it matters:** … · **Evidence:** …
160
+ **Impact:** LOW (obvious, narrow fix) · **Dimension:** … · **Where:** path:line
161
+ **What:** … **Why it matters:** … **Evidence:** …
162
+ **Fix:** … (or Fix A / Fix B with strength, trade-off, confidence, blind spot)
111
163
  **Decision:** fix now: <what was changed> (<sha>)
112
164
 
113
165
  ## Progress audit
114
- Items ticked without evidence (should be none after fixes).
115
-
166
+ ## Triage summary
116
167
  ## Lessons proposed
117
- - <rule draft> → softure-lesson
168
+ ## Decisions (auto) (only in --auto)
118
169
  ```
119
170
 
120
171
  ## --auto
121
172
 
122
- - CRITICAL and WARNING findings that have a clear local fix: `fix now`.
173
+ - CRITICAL and WARNING findings that have a clear local fix: `fix now` (the recommended option).
123
174
  - Fixes that need a product decision: `defer` to the roadmap "Owner decisions and checks"
124
175
  list, with the finding ID.
125
176
  - SUGGESTIONs: `accept`, unless the fix is under about 10 lines and risk-free.
126
177
  - A finding that matches a pattern already seen in lessons.md, or that repeats across changes:
127
178
  also `record as lesson`.
179
+ - No questions, no before/after confirmation. Each decision also goes under `## Decisions (auto)`.
128
180
  - If a CRITICAL cannot be fixed without leaving the change's scope, stop and escalate
129
181
  (WORKFLOW §8.2).
130
182
 
183
+ `--no-fix` (either mode): write the report with recommended decisions as
184
+ `**Decision:** pending (recommended: …)`, apply nothing, leave the status unchanged. Resume with
185
+ `--triage`.
186
+
131
187
  ## Checklist
132
188
 
133
- - [ ] Gates re-run in this session, results in the report header.
189
+ - [ ] Gates and command-based criteria re-run in this session, results in the report header.
134
190
  - [ ] Every `- [x]` has evidence.
135
- - [ ] Every finding has a decision.
136
- - [ ] Fix commit references the change-id.
137
- - [ ] Status is `impl_reviewed`.
191
+ - [ ] Every changed file was read in full; planned, unplanned and missing files are accounted for.
192
+ - [ ] Every finding has severity, impact, location, evidence, a recommended fix and a decision.
193
+ - [ ] Fix commit references the change-id; the report records its SHA in a separate commit.
194
+ - [ ] Status is `impl_reviewed` (full review) and no decision is pending.
138
195
 
139
196
  ## Anti-patterns
140
197
 
141
198
  - Reviewing only the diff hunks. Bugs live in the unchanged lines next to them.
142
199
  - "Looks good" with zero findings on a non-trivial change. Look again at the error paths and tests.
200
+ - Vague findings ("there may be a security issue"). Name the file, the line and the mechanism.
201
+ - Inventing a second fix option to look thorough. One fix unless the trade-off is real.
202
+ - Style preferences graded as WARNING. If the code works and matches the plan, it is a SUGGESTION at most.
143
203
  - Rewriting the feature during review. Fixes stay minimal; larger rework goes back to the plan.
144
204
  - Unticking or rewording Progress items to make the review pass.
205
+ - Arguing with a user who skips a finding. Record the decision and move on.
145
206
 
146
207
  ## Handoff
147
208
 
148
209
  - Lessons proposed: run `softure-lesson`.
149
- - Then `softure-archive <change-id>`. Inside a worktree run, `softure-worktree` continues with
150
- integration and archive.
210
+ - Phase review: back to `softure-implement <change-id> next`.
211
+ - Full review: `softure-archive <change-id>`. Inside a worktree run, `softure-worktree`
212
+ continues with integration and archive. After fixing a CRITICAL, it re-runs this review.
@@ -0,0 +1,127 @@
1
+ # Example: `reviews/impl-review.md`
2
+
3
+ An invoicing tool for small agencies. Change `invoice-late-fees`: an overdue invoice gets a
4
+ late fee of 1.5 % per started month, at least 5.00, shown on the invoice. Three phases:
5
+ 1 the fee rule (TDD), 2 an hourly job that applies fees, 3 the fee on the invoice page and PDF.
6
+ The review ran interactively; the user decided one by one. This is the file as committed.
7
+
8
+ ```markdown
9
+ # Implementation review: invoice-late-fees
10
+
11
+ Scope: full · Date: 2026-03-12 · Commits: 51e0a7c..c93b2d4 · Gates: typecheck ✓ lint ✓ test ✓ (594 tests, after fixes)
12
+
13
+ ## Verdict
14
+ Ready after fixes. The rule, the job and the invoice view do what the plan asked, but the job
15
+ could charge a fee twice on a retry, and the rounding criterion was ticked without a test that
16
+ rounds; the test added for it found a real float-rounding bug. Both are fixed in 8d2e4f1 and
17
+ re-checked. One unplanned CSV column is kept at the owner's request; one missing index is deferred.
18
+
19
+ ## Dimensions
20
+ | Dimension | Verdict | Findings |
21
+ |---|---|---|
22
+ | Plan adherence | PASS | |
23
+ | Scope | WARNING | F3 |
24
+ | Progress honesty | FAIL | F2 |
25
+ | Correctness | FAIL | F1 |
26
+ | Tests | PASS | F6 (suggestion only) |
27
+ | Data and migrations | WARNING | F5 |
28
+ | Security | PASS | |
29
+ | Architecture and patterns | WARNING | F4 |
30
+ | Lessons | PASS | L-004 (money in integer cents) respected after F2's fix |
31
+
32
+ ## Plan coverage
33
+ | Phase | Commit | Delivered | Notes |
34
+ |---|---|---|---|
35
+ | 1 Late fee rule | 51e0a7c | yes | rounding wrong for half-cent amounts until F2 |
36
+ | 2 Hourly job applies fees | 7fa3e19 | yes | not idempotent until F1; scheduling pattern F4 |
37
+ | 3 Fee on invoice page and PDF | c93b2d4 | yes | also added a CSV column (F3) |
38
+
39
+ Files: planned and changed 9 · unplanned 1 (exports/invoices-csv.ts) · planned, not changed 0
40
+
41
+ ## Findings
42
+
43
+ ### F1 [CRITICAL] A rerun of the job charges the fee twice
44
+ **Impact:** MEDIUM (a real trade-off) · **Dimension:** Correctness · **Where:** invoices/apply-late-fee.ts:41
45
+ **What:** the job inserts a fee row for every overdue invoice without checking for an existing
46
+ row for the same day. The scheduler retries a failed run while the next hourly run may start.
47
+ **Why it matters:** customers are overcharged; the fee appears twice on the invoice and the PDF.
48
+ **Evidence:** two runs against the test database gave two fee rows for invoice 1042.
49
+ **Fix A (recommended):** unique constraint on (invoice_id, fee_date) and ON CONFLICT DO NOTHING
50
+ - Strength: enforced for every writer, including retries; payments use the same pattern
51
+ - Trade-off: one migration; existing duplicates had to be checked first (none)
52
+ - Confidence: HIGH, same pattern in payments/record-payment.ts
53
+ - Blind spot: none found
54
+ **Fix B:** look up an existing row in the job before inserting
55
+ - Strength: no migration
56
+ - Trade-off: two concurrent runs still race between the lookup and the insert
57
+ - Confidence: MEDIUM
58
+ - Blind spot: retry timing under load not measured
59
+ **Decision:** record as lesson + fix now (Fix A): migration 0019_late_fee_unique.sql and the
60
+ conflict clause; a test runs the job twice and expects one row (8d2e4f1)
61
+
62
+ ### F2 [CRITICAL] Item 1.2 "rounds half-up to cents" ticked without a test that rounds
63
+ **Impact:** LOW (obvious, narrow fix) · **Dimension:** Progress honesty · **Where:** invoices/late-fee.test.ts:8
64
+ **What:** the only rounding test uses an amount of 1000.00, whose fee (15.00) never rounds.
65
+ **Why it matters:** the criterion was not proven. Adding the missing case showed the code
66
+ rounds on floats: 1.5 % of 1433.00 gave 21.49 instead of 21.50.
67
+ **Evidence:** new test "rounds a half cent up" failed before the fix, passes after.
68
+ **Fix:** compute in integer cents (L-004) and add half-cent and minimum-fee cases.
69
+ **Decision:** fix now: fee computed in cents, three cases added (8d2e4f1)
70
+
71
+ ### F3 [WARNING] late_fee column added to the CSV export, not in the plan
72
+ **Impact:** LOW (obvious, narrow fix) · **Dimension:** Scope · **Where:** exports/invoices-csv.ts:22
73
+ **What:** phase 3 added a column to the export; neither plan.md nor change.md mentions it.
74
+ **Why it matters:** customers who import the CSV elsewhere see a new column without notice.
75
+ **Fix:** remove the column, or keep it and note it in plan.md.
76
+ **Decision:** accept: the owner asked for it during implementation; noted under Phase 3 in plan.md (accepted by owner)
77
+
78
+ ### F4 [WARNING] Job scheduled with setInterval instead of the job registry
79
+ **Impact:** MEDIUM (a real trade-off) · **Dimension:** Architecture and patterns · **Where:** jobs/late-fees.ts:12
80
+ **What:** every other job registers in jobs/registry.ts, which adds locking and logging; this
81
+ one starts its own setInterval at import time.
82
+ **Why it matters:** with two app instances the job runs twice an hour, and failures are not logged.
83
+ **Fix:** register through jobs/registry.ts like jobs/send-reminders.ts.
84
+ **Decision:** fix now: registered in the registry, setInterval removed (8d2e4f1)
85
+
86
+ ### F5 [WARNING] No index for the overdue scan
87
+ **Impact:** LOW (obvious, narrow fix) · **Dimension:** Data and migrations · **Where:** invoices/apply-late-fee.ts:18
88
+ **What:** the job filters on status and due_date; invoices has no index covering them.
89
+ **Why it matters:** a sequential scan every hour; 4 100 rows today, so no visible cost yet.
90
+ **Fix:** index on (status, due_date).
91
+ **Decision:** defer -> context/backlog/performance.md, revisit above 50 000 invoices
92
+
93
+ ### F6 [SUGGESTION] Test names say "works"
94
+ **Impact:** LOW (obvious, narrow fix) · **Dimension:** Tests · **Where:** jobs/late-fees.test.ts:5, :19
95
+ **What:** "works" and "works for many" do not state the behaviour.
96
+ **Fix:** "applies one fee per overdue invoice", "skips invoices paid before the due date".
97
+ **Decision:** fix now: renamed (8d2e4f1)
98
+
99
+ ## Progress audit
100
+ Before the review: 1.2 ticked without evidence (F2). After the fixes every ticked item has
101
+ evidence; 1.2 is backed by "rounds a half cent up". Open Manual items, not findings:
102
+ 3.4 "PDF fee line matches the accountant's template" (owner).
103
+
104
+ ## Triage summary
105
+ Fixed: F1 (Fix A), F2, F4, F6 · Lessons: F1 · Deferred: F5 (backlog/performance.md) ·
106
+ Accepted: F3 · Withdrawn: none. Fix commit 8d2e4f1; gates green after it.
107
+
108
+ ## Lessons proposed
109
+ - A job that writes money is idempotent through a database constraint, not a check in code
110
+ (from F1) -> softure-lesson --from invoice-late-fees#F1
111
+ ```
112
+
113
+ What the run committed, in order:
114
+
115
+ 1. `fix(invoice-late-fees): address impl review` (8d2e4f1): the code, the migration, the tests,
116
+ the plan.md note for F3, and the Progress SHA edit left over from phase 3.
117
+ 2. `docs(invoice-late-fees): impl review`: this report with 8d2e4f1 filled in, the backlog entry
118
+ for F5, and change.md at `status: impl_reviewed`.
119
+
120
+ The backlog entry written for F5 (`context/backlog/performance.md`):
121
+
122
+ ```markdown
123
+ - [ ] 2026-03-12 invoice-late-fees impl review F5: index invoices(status, due_date) for the hourly overdue scan (WARNING) context/archive/2026-03-09-invoice-late-fees/reviews/impl-review.md
124
+ ```
125
+
126
+ The evidence path points at the archive location the change will have after `softure-archive`
127
+ (`<created>-<change-id>`); archive's link fix rewrites it if the date differs.
@@ -0,0 +1,120 @@
1
+ # Rubric: dimensions, scales, finding format, verdicts
2
+
3
+ ## Dimensions
4
+
5
+ Every finding belongs to one dimension. Every dimension gets a verdict, even when it has no
6
+ findings, so the reader sees what was looked at.
7
+
8
+ | Dimension | What to check | FAIL when |
9
+ |---|---|---|
10
+ | Plan adherence | each planned change exists and does what the phase said; each phase has its commit | a planned item is missing, or implemented with a different intent |
11
+ | Scope | unplanned files, endpoints, columns, flags; change.md Constraints (files owned by another change) | Constraints broken |
12
+ | Progress honesty | evidence for every `- [x]`; gates and command criteria re-run; agent-verified manual items point at real evidence | any ticked item without evidence, any red gate |
13
+ | Correctness | edge cases, error paths, concurrency, transactions, cache invalidation, time zones, rounding | wrong behaviour on a realistic input |
14
+ | Tests | a test per new behaviour that fails without it; specific assertions; edge and error cases; the break-it check | the riskiest behaviour can be broken with every test green |
15
+ | Data and migrations | forward-only, rollback note, indexes, constraints in the database, numbering, destructive steps | data loss possible, or an invariant enforced only in code where a constraint was planned |
16
+ | Security | authorization per action and route, input validation, parameterized SQL, secrets, error leakage, rate limits | any exploitable gap |
17
+ | Architecture and patterns | module boundaries and dependency direction; one or two sibling files compared for registration, error handling, structure, tests | a boundary is crossed (UI importing the database layer, a cycle) |
18
+ | Lessons | every rule in lessons.md whose "Applies to" matches the touched paths | a lesson is broken without a recorded reason |
19
+
20
+ Verdict per dimension: **PASS** (nothing above SUGGESTION), **WARNING** (WARNING findings
21
+ only), **FAIL** (the condition in the table, or any CRITICAL).
22
+
23
+ **Patterns, scaled to the diff.** For three files or fewer, a quick look at one sibling is
24
+ enough. For a larger diff, compare each new module with the closest existing one. Report only
25
+ mismatches that cost something: a job registered outside the scheduler the other jobs use, an
26
+ endpoint without the auth wrapper its neighbours use, an error type nobody else throws. A
27
+ different but working formatting choice is not a finding.
28
+
29
+ **Phase reviews** also ask: did this phase change something an earlier phase relied on (a
30
+ renamed export, a changed return shape, a migration that alters a column an earlier test seeds)?
31
+
32
+ ## Severity
33
+
34
+ | Severity | Meaning | Blocks |
35
+ |---|---|---|
36
+ | CRITICAL | wrong behaviour, data loss risk, security hole, Progress claiming something not done | archive and merge |
37
+ | WARNING | real defect or gap with limited blast radius | nothing, but needs a decision with a reason |
38
+ | SUGGESTION | better, not wrong | never |
39
+
40
+ Grade by consequence, not by how easy it was to spot. When torn between two levels, ask "what
41
+ happens in production if nobody touches this?" and pick the level that answer describes.
42
+
43
+ ## Impact
44
+
45
+ | Impact | Meaning, always printed next to the level |
46
+ |---|---|
47
+ | LOW | obvious, narrow fix; safe to decide in a batch |
48
+ | MEDIUM | a real trade-off; think before deciding |
49
+ | HIGH | wide blast radius or no clear best path; decide deliberately |
50
+
51
+ Severity says how bad it is to ignore; impact says how hard it is to decide. Print both on every
52
+ finding so the user can skim to the hard decisions.
53
+
54
+ ## Finding format
55
+
56
+ ```markdown
57
+ ### F2 [WARNING] <one-line title, nothing else on this line>
58
+ **Impact:** MEDIUM (a real trade-off) · **Dimension:** Architecture and patterns · **Where:** jobs/late-fees.ts:12
59
+ **What:** what the code does, with evidence (plan line vs code line, or code vs the sibling it should match).
60
+ **Why it matters:** the consequence if it ships as is.
61
+ **Evidence:** the command, test, query or file that shows it.
62
+ **Fix:** one concrete change.
63
+ **Decision:** …
64
+ ```
65
+
66
+ Default to **one** fix. Offer two only when a careful reviewer would genuinely weigh them (patch
67
+ the caller or fix the source; a database constraint or a code check). Then each option is one
68
+ block, and exactly one is recommended:
69
+
70
+ ```markdown
71
+ **Fix A (recommended):** <one sentence>
72
+ - Strength: <the advantage, grounded in this codebase or the plan>
73
+ - Trade-off: <the cost or risk>
74
+ - Confidence: HIGH | MEDIUM | LOW, <why>
75
+ - Blind spot: <what was not verified, or "none found">
76
+ **Fix B:** <one sentence>
77
+ - Strength / Trade-off / Confidence / Blind spot as above
78
+ ```
79
+
80
+ For a LOW-impact finding the single `**Fix:**` line is enough; strength and trade-off are noise
81
+ when the answer is obvious.
82
+
83
+ Specific beats general:
84
+ - Good: "`invoices/apply-late-fee.ts:41` inserts a fee row without checking for an existing one;
85
+ the job runs hourly, so a second run in the same day doubles the fee (reproduced: two runs, two
86
+ rows for invoice 1042)."
87
+ - Bad: "Fee logic might have idempotency issues."
88
+
89
+ ## Overall verdict
90
+
91
+ Computed after triage, from the decisions, and stated in `## Verdict`:
92
+
93
+ - **Ready**: no finding needed a code change; every dimension PASS or WARNING with accepted or
94
+ deferred findings.
95
+ - **Ready after fixes**: fixes were applied in this run; after them no CRITICAL is open, the gates
96
+ are green, and every finding has a decision.
97
+ - **Not ready**: a CRITICAL is deferred or unresolved, a gate is red, a pending decision remains,
98
+ or the review showed that the remaining work needs a re-plan (name the step: `softure-plan`).
99
+
100
+ Order findings CRITICAL, then WARNING, then SUGGESTION, and by impact within a severity. Cap
101
+ the list at ten: merge findings with one root cause into one (list every location), and drop
102
+ SUGGESTIONs before anything else. A CRITICAL is never merged away or dropped.
103
+
104
+ ## Briefs for review subagents (large diffs)
105
+
106
+ Keep the plan and the file map in the main context; let subagents read the code. Two read-only
107
+ subagents in parallel, each with only what it needs:
108
+
109
+ **Plan drift.** Give it: the text of the phases under review and the list of files the plan
110
+ names. Ask: for each planned change, read the file and report path, what the plan said, what
111
+ exists, and a verdict MATCH / DRIFT / MISSING / EXTRA. Intent mismatches only, not formatting.
112
+
113
+ **Safety, correctness and patterns.** Give it: every changed file path, the project root, the
114
+ relevant AGENTS.md sections and lessons. Ask: read each file in full; report security,
115
+ correctness, performance, reliability and data-safety problems with file, line, dimension,
116
+ proposed severity, evidence and a fix; for each new module, compare with one or two siblings and
117
+ report substantive mismatches only.
118
+
119
+ Merge their output, verify every CRITICAL yourself in the code before it goes into the report,
120
+ and grade with this rubric. A subagent's severity is a proposal.