@softure-ai/skills 0.2.1 → 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 (50) hide show
  1. package/README.md +4 -0
  2. package/WORKFLOW.md +6 -2
  3. package/package.json +1 -1
  4. package/skills/softure-archive/SKILL.md +76 -24
  5. package/skills/softure-archive/references/example-archive.md +106 -0
  6. package/skills/softure-code-review/SKILL.md +68 -18
  7. package/skills/softure-code-review/references/example-review.md +108 -0
  8. package/skills/softure-frame/SKILL.md +129 -40
  9. package/skills/softure-frame/references/diagnostic-lens.md +85 -0
  10. package/skills/softure-frame/references/examples.md +111 -0
  11. package/skills/softure-frame/references/pushback.md +38 -0
  12. package/skills/softure-impl-review/SKILL.md +138 -76
  13. package/skills/softure-impl-review/references/example-review.md +127 -0
  14. package/skills/softure-impl-review/references/rubric.md +120 -0
  15. package/skills/softure-impl-review/references/triage.md +124 -0
  16. package/skills/softure-implement/SKILL.md +116 -49
  17. package/skills/softure-implement/references/phase-commit.md +214 -0
  18. package/skills/softure-implement/references/worked-example.md +201 -0
  19. package/skills/softure-init/SKILL.md +57 -41
  20. package/skills/softure-init/references/example.md +96 -0
  21. package/skills/softure-init/references/templates.md +73 -0
  22. package/skills/softure-lesson/SKILL.md +47 -19
  23. package/skills/softure-lesson/references/examples.md +65 -0
  24. package/skills/softure-new/SKILL.md +100 -43
  25. package/skills/softure-new/references/example-change.md +149 -0
  26. package/skills/softure-new/references/placement.md +60 -0
  27. package/skills/softure-plan/SKILL.md +182 -50
  28. package/skills/softure-plan/references/plan-example.md +206 -0
  29. package/skills/softure-plan/references/progress-format.md +56 -2
  30. package/skills/softure-plan/references/questioning.md +162 -0
  31. package/skills/softure-plan-review/SKILL.md +211 -83
  32. package/skills/softure-plan-review/references/lenses.md +121 -0
  33. package/skills/softure-plan-review/references/review-example.md +184 -0
  34. package/skills/softure-prd/SKILL.md +130 -71
  35. package/skills/softure-prd/references/example-prd.md +233 -0
  36. package/skills/softure-prd/references/leak-lint.md +43 -0
  37. package/skills/softure-prd/references/prd-template.md +219 -0
  38. package/skills/softure-research/SKILL.md +73 -33
  39. package/skills/softure-research/references/example-research.md +106 -0
  40. package/skills/softure-research/references/fan-out.md +61 -0
  41. package/skills/softure-roadmap/SKILL.md +211 -65
  42. package/skills/softure-roadmap/references/example-roadmap.md +203 -0
  43. package/skills/softure-roadmap/references/interview.md +132 -0
  44. package/skills/softure-roadmap/references/slicing.md +118 -0
  45. package/skills/softure-rule-review/SKILL.md +83 -19
  46. package/skills/softure-rule-review/references/example-report.md +73 -0
  47. package/skills/softure-rule-review/references/scorecard.md +129 -0
  48. package/skills/softure-shape/SKILL.md +163 -53
  49. package/skills/softure-shape/references/example-shape-notes.md +192 -0
  50. package/skills/softure-shape/references/question-bank.md +248 -0
package/README.md CHANGED
@@ -63,6 +63,10 @@ autonomous mode.
63
63
  Every interactive skill accepts `--auto`: it decides instead of asking and records each
64
64
  decision in the artifact. The orchestrators always use it.
65
65
 
66
+ Each `SKILL.md` stays scannable: the procedure, the questions it asks and its quality bar.
67
+ Long material (question banks, rubrics, templates, complete worked examples, good and bad)
68
+ lives next to it in `references/` and is read when the skill points to it.
69
+
66
70
  ## Releasing
67
71
 
68
72
  Releases are tag-driven:
package/WORKFLOW.md CHANGED
@@ -82,8 +82,8 @@ forces one on a project that already has its own.
82
82
  context/
83
83
  workflow.json
84
84
  foundation/
85
- shape-notes.md softure-shape (frontmatter: session, status, created, updated; optional `## Frame` from softure-frame)
86
- prd.md softure-prd (frontmatter: version, status: draft | accepted, source, updated)
85
+ shape-notes.md softure-shape (frontmatter: session, status, context_type: greenfield | brownfield, created, updated; optional `## Frame` from softure-frame)
86
+ prd.md softure-prd (frontmatter: version, status: draft | accepted, context_type, source, updated)
87
87
  roadmap.md softure-roadmap (§5) the ONE active (main) roadmap
88
88
  roadmaps/roadmap-<slug>.md queued thematic roadmaps, status: waiting (§5.1)
89
89
  archive/<YYYY-MM-DD>-roadmap.md finished roadmaps (also old prd.md / shape-notes.md versions)
@@ -96,6 +96,7 @@ context/
96
96
  reviews/
97
97
  plan-review.md softure-plan-review
98
98
  impl-review.md softure-impl-review
99
+ impl-review-p<N>.md softure-impl-review phase <N> (optional, per-phase; leaves the status alone)
99
100
  code-review.md softure-code-review (when run on a change)
100
101
  archive/<YYYY-MM-DD>-<change-id>/ softure-archive (date = change.md `created`)
101
102
  backlog/ everything planned for "later", never what is in flight:
@@ -154,6 +155,9 @@ Free-form. Orchestrators append signals here.
154
155
  | `archived` | softure-archive | folder moved to archive |
155
156
 
156
157
  Every skill that changes `status` also sets `updated`.
158
+ Statuses move forward, with one exception: a refine or re-plan of the remaining phases moves `plan_reviewed` or
159
+ `implementing` back to `planned`, so the revised phases get a plan review before more code is written. Ticked
160
+ Progress items stay ticked.
157
161
  `softure-frame` leaves the status unchanged (`preparing`). When `softure-plan-review` finds a CRITICAL issue the plan
158
162
  cannot fix, the status stays `planned` and the finding names the step to redo (`research` or `plan`). Orchestrators
159
163
  read that finding before re-running plan-review.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softure-ai/skills",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "SOFTURE agent skills: a spec-driven delivery workflow (shape → prd → roadmap → plan → implement → review) plus parallel worktree orchestration",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,13 +1,14 @@
1
1
  ---
2
2
  name: softure-archive
3
3
  description: >
4
- Close a finished change: verify nothing is left uncommitted, stamp change.md as archived,
5
- move context/changes/<change-id>/ to context/archive/<created>-<change-id>/, mark the
6
- roadmap row and item as done (or done_code when something still waits for a release or the
7
- owner), record pending manual checks for the owner, fix links, and commit. Use when the
8
- user says "archive the change", "close this change", "we're done with X", or after
9
- softure-impl-review.
10
- argument-hint: "<change-id> [--auto] [--done-code \"<what waits>\"]"
4
+ Close a finished change: verify nothing is left uncommitted or staged by someone else, check
5
+ plan Progress and the review, stamp change.md as archived, move context/changes/<change-id>/
6
+ to context/archive/<created>-<change-id>/, mark the roadmap row and item as done (or
7
+ done_code when something still waits for a release or the owner), record pending manual
8
+ checks for the owner, fix links, and commit. Handles changes without a plan, a roadmap with
9
+ someone else's uncommitted edits, and a half-finished earlier run. Use when the user says
10
+ "archive the change", "close this change", "we're done with X", or after softure-impl-review.
11
+ argument-hint: "<change-id | path> [--auto] [--done-code \"<what waits>\"]"
11
12
  allowed-tools:
12
13
  - Read
13
14
  - Glob
@@ -20,22 +21,49 @@ allowed-tools:
20
21
 
21
22
  # softure-archive: the change leaves `changes/`, and the record of it stays
22
23
 
23
- Contract: `WORKFLOW.md` §3 (paths), §4 (status), §5 (roadmap rows and statuses), §9 (commit).
24
+ Contract: `WORKFLOW.md` §3 (paths), §4 (status), §5 (roadmap rows and statuses), §6 (Progress
25
+ notation), §9 (commit).
26
+
27
+ The argument is a change id or a path (`@context/changes/<id>/`: strip `@` and the trailing `/`,
28
+ take the last segment). With none, list the folders in `context/changes/` with their `status`
29
+ and ask which one; in `--auto`, escalate.
30
+
31
+ ## Resolve
32
+
33
+ A failed run is never rolled back; each step leaves a state the next run recognises, so
34
+ re-running is always safe. Report what you found and what you completed.
35
+
36
+ | Found | Do |
37
+ |---|---|
38
+ | `context/changes/<id>/change.md` | continue |
39
+ | no folder in `changes/`, but `context/archive/*-<id>/` | already archived: report the path. If its roadmap row is not `done` / `done_code`, offer to finish only steps 3 to 8 on the archived folder |
40
+ | `status: archived`, folder still in `changes/` | an earlier run stopped after the stamp. An uncommitted diff of change.md limited to the stamp is that run's own and does not count as uncommitted work; resume at step 2 once the other checks pass |
41
+ | `created` missing or not `YYYY-MM-DD` | stop: the archive folder name cannot be derived |
42
+ | nothing | stop: name the folders that do exist |
24
43
 
25
44
  ## Preconditions (check all, report all, then decide)
26
45
 
27
46
  | Check | Hard stop | Soft warning |
28
47
  |---|---|---|
29
- | no uncommitted changes in the change folder, `roadmap.md` or the files the change touched (`git status --porcelain -- <paths>`) | yes: commit them first; never archive over uncommitted work of the change | other uncommitted paths (someone else's WIP): leave them, never stage them |
48
+ | no uncommitted changes in the change folder or the files the change touched (`git status --porcelain -- <paths>`) | yes: commit them first; never archive over uncommitted work of the change | other uncommitted paths (someone else's WIP): leave them, never stage them |
49
+ | nothing staged that is not part of this change (`git diff --cached --name-only`) | yes: it would ride along in the archive commit. Name the paths; never unstage them yourself, they may be someone's work | |
30
50
  | change.md `status` is `impl_reviewed` | | `implemented` (no review) or earlier |
31
51
  | plan.md exists | | no: work done without the chain (interactively, or a change that turned out to need no code). Archive it anyway, see "Without a plan" |
32
52
  | plan.md Progress: no open `#### Automated` items | yes: name them | |
33
53
  | plan.md Progress: open `#### Manual` items | | yes: they become owner checks (step 4) |
34
- | `reviews/impl-review.md` has no CRITICAL without a decision | yes | |
54
+ | Progress without `#### Automated` / `#### Manual` headings (an older or hand-written plan) | open items count as Automated, unless the owner marks one as a human check (interactive only) | |
55
+ | done rows carry ` — <sha>` (7+ hex, optionally followed by `(verified by agent: …)`), or are `~~dropped~~ — dropped: …` | | rows without one: name them. Legitimate for phases with no code; never add SHAs yourself, that is `softure-implement`'s job |
56
+ | `reviews/impl-review.md` exists | | no review on file |
57
+ | `reviews/impl-review*.md` has no CRITICAL without a decision (`**Decision:** pending` counts as none) | yes | |
35
58
  | target `context/archive/<created>-<change-id>/` does not exist | yes | |
36
59
 
37
- Interactive: show the warnings and ask once ("Archive anyway" / "Stop"). `--auto`: proceed
38
- on warnings, stop on hard stops.
60
+ `context/foundation/roadmap.md` with uncommitted edits is **not** a stop: step 3 handles it.
61
+
62
+ Show every result in one report. Interactive: when only warnings remain, ask once:
63
+ "Archive anyway / Resume implementation (`softure-implement <id>`) / Stop". Recommend "Archive
64
+ anyway" when the only warnings are open Manual items or SHA-less rows (both are expected
65
+ outcomes); otherwise recommend running the missing step. `--auto`: proceed on warnings, stop on
66
+ hard stops. Sample reports: [references/example-archive.md](references/example-archive.md).
39
67
 
40
68
  ## Procedure
41
69
 
@@ -44,9 +72,15 @@ on warnings, stop on hard stops.
44
72
  - `archived_at: <today>`;
45
73
  - `updated: <today>`;
46
74
  - one closing line under `## Notes`: `Archived <date>: <outcome in one sentence>.`
75
+ Leave `change_id` and `created` untouched. Dates use `workflow.json` → `timezone` when set.
47
76
  2. **Move.** Run `git mv context/changes/<id> context/archive/<created>-<id>`, where `<created>`
48
- is the `created` date from change.md, not today.
77
+ is the `created` date from change.md, not today. `git mv` stages the rename with the
78
+ committed content only, so run `git add context/archive/<created>-<id>` afterwards or the
79
+ stamp stays out of the commit.
49
80
  3. **Update the roadmap** (when change.md has `roadmap_item`, or a row with `` `<id>` `` exists):
81
+ - Match exactly: the row whose second cell is `` `<id>` ``. One item can spawn several
82
+ changes, so a near miss is never closed. If `roadmap_item` names an ID whose row carries a
83
+ different change-id, report it and leave the row alone.
50
84
  - Choose the row status:
51
85
  - `done` when everything is delivered and verified;
52
86
  - `done_code (<today>; waiting: <what>)` when the code is finished but something still
@@ -57,14 +91,31 @@ on warnings, stop on hard stops.
57
91
  - Append to `## Done`:
58
92
  `- **<ID>** \`<id>\`: <outcome>; archived in \`archive/<created>-<id>/\``.
59
93
  - Set frontmatter `updated` to today.
94
+ - The roadmap shape is not this skill's to fix: when a target (row, block line, `## Done`) is
95
+ missing or hand-formatted, skip that edit, keep going, and name it in the report. Never
96
+ abort the archive over the roadmap's shape.
97
+ - **Dirty roadmap.** Before editing, `git status --porcelain -- context/foundation/roadmap.md`.
98
+ Clean, or every uncommitted hunk is this item's own row and block → edit and stage it.
99
+ Otherwise it holds someone else's edits: make the edits in the working tree, do **not**
100
+ stage the file, and say so in the report so its owner commits it with their work.
60
101
  4. **Owner checks.** For each open Manual item, add a line under `## Owner decisions and checks`:
61
102
  `- [ ] **<ID>**: <item text> (Manual N.M). archive/<created>-<id>/plan.md`. Do the same for
62
- deferred review findings that target the owner.
103
+ deferred review findings that target the owner. Anything that must happen before the next
104
+ deploy (an environment variable, a manual migration step, a production check) goes under
105
+ `## Before the next release` as `- [ ] <what> (**<ID>**)`. Unlinked change: these stay under
106
+ `## Notes` of its change.md.
63
107
  5. **Fix links.** `grep -rn "changes/<id>" context/ docs/ AGENTS.md CLAUDE.md` and rewrite each
64
108
  hit to `archive/<created>-<id>`. Links inside the archived folder are relative and stay valid.
65
109
  6. **Verify** that the old folder is gone, the new one exists, the roadmap row has exactly one
66
110
  match, and no dangling `changes/<id>` links remain.
67
- 7. **Commit** with `chore(archive): close <change-id>`, staging only the touched paths.
111
+ 7. **Commit** with `chore(archive): close <change-id>`, staging only the touched paths: the
112
+ archive folder, the roadmap (unless step 3 left it unstaged), and the files whose links you
113
+ fixed. Before committing, `git diff --cached --name-only` must list nothing else. Never
114
+ `--no-verify`; if a hook fails, fix the cause and commit again (a new commit, never an amend).
115
+ In `--auto`, the commit body lists the soft warnings.
116
+ 8. **Report:** old and new path, the stamp, the roadmap transition (or "no matching row"), owner
117
+ checks added, links fixed, edits skipped or left unstaged, and the commit SHA. The commit is
118
+ local: never push from this skill.
68
119
 
69
120
  ## Without a plan
70
121
 
@@ -82,7 +133,7 @@ to every orchestrator and blocks closing the roadmap. When there is no `plan.md`
82
133
 
83
134
  Proceed on soft warnings. Record each one in the archive commit body and in the roadmap owner
84
135
  checks. Pick `done_code` whenever any Manual item is open or the change affects deployment
85
- (migrations, env vars, infrastructure).
136
+ (migrations, env vars, infrastructure). Hard stops stay stops: report them all and end.
86
137
 
87
138
  ## Inside a worktree
88
139
 
@@ -92,20 +143,21 @@ row during the merge. Do not touch rows of other items.
92
143
 
93
144
  ## Checklist
94
145
 
95
- - [ ] No uncommitted files of the change before and after; nobody else's WIP staged.
96
- - [ ] `status: archived`, `archived_at` set.
97
- - [ ] Folder name uses the `created` date.
98
- - [ ] Roadmap row last cell, item block status, `## Done` and `updated` all changed.
99
- - [ ] Open Manual items listed for the owner.
100
- - [ ] No dangling links.
101
- - [ ] One commit, conventional message.
146
+ - [ ] No uncommitted files of the change before and after; nobody else's WIP or staged work in the commit.
147
+ - [ ] `status: archived` and `archived_at` set, the stamp inside the commit; folder named by `created`.
148
+ - [ ] Roadmap row last cell, item block status, `## Done` and `updated` all changed (or the skip is reported).
149
+ - [ ] Open Manual items listed for the owner; deploy prerequisites under `## Before the next release`.
150
+ - [ ] No dangling links; one commit, conventional message, not pushed.
102
151
 
103
152
  ## Anti-patterns
104
153
 
105
154
  - Ticking Manual items to make archiving clean. They go to the owner list instead.
106
155
  - Archiving with a red gate "to clean up later".
107
- - Rewriting history in the archived plan. It is a record and stays as it was executed.
156
+ - Rewriting history in the archived plan, or adding SHAs to it. It is a record and stays as it was executed.
108
157
  - Marking `done` when a release is still needed. That is `done_code`.
158
+ - Staging the whole tree, or someone else's roadmap edits, to get a clean status.
159
+ - Writing into an archived folder later. To revisit archived work, open a new change with
160
+ `softure-new` and link the archive folder; there is no unarchive.
109
161
 
110
162
  ## Handoff
111
163
 
@@ -0,0 +1,106 @@
1
+ # Worked examples: archiving a change
2
+
3
+ Read this before the first archive in a project, or when the roadmap or the working tree is in an
4
+ unusual state. The domain is invented: a team wiki, change `search-matches-page-titles`
5
+ (roadmap item `WK-8`, created 2026-10-02).
6
+
7
+ ## 1. A normal close with one open Manual item
8
+
9
+ ### Preconditions report (interactive)
10
+
11
+ ```
12
+ Archive search-matches-page-titles: checks
13
+ ok nothing uncommitted in the change folder or in the 3 files it touched
14
+ ok nothing staged
15
+ ok status impl_reviewed; reviews/impl-review.md: 0 CRITICAL open
16
+ ok Progress: 0 open Automated items
17
+ warn Progress: 1 open Manual item: 2.4 "search feels instant on the 2k-page staging space"
18
+ warn Progress: 1 done row without a SHA: 3.1 "release note drafted" (phase had no code)
19
+ ok target context/archive/2026-10-02-search-matches-page-titles/ is free
20
+
21
+ 1. Archive anyway (Recommended): the Manual item goes to the owner list, the SHA-less row is a docs-only phase
22
+ 2. Resume implementation: softure-implement search-matches-page-titles
23
+ 3. Stop
24
+ ```
25
+
26
+ ### change.md after the stamp
27
+
28
+ ```markdown
29
+ status: archived
30
+ updated: 2026-10-06
31
+ archived_at: 2026-10-06
32
+ ...
33
+ ## Notes
34
+ - Placement: main roadmap, WK-8. ...
35
+ - Archived 2026-10-06: searching for a page's title now returns that page first in every readable space.
36
+ ```
37
+
38
+ ### Roadmap diff
39
+
40
+ ```diff
41
+ -| **WK-8** | `search-matches-page-titles` | a title search finds the page first | — | autonomous | in_progress (archive, since 2026-10-06; worktree ../wiki-search-titles) |
42
+ +| **WK-8** | `search-matches-page-titles` | a title search finds the page first | — | autonomous | done_code (2026-10-06; waiting: owner check 2.4 on staging) |
43
+
44
+ ### WK-8: Search matches page titles
45
+ - **Change ID:** `search-matches-page-titles`
46
+ -- **Status:** in_progress (archive, since 2026-10-06; worktree ../wiki-search-titles)
47
+ +- **Status:** done_code (2026-10-06; waiting: owner check 2.4 on staging)
48
+
49
+ ## Owner decisions and checks
50
+ +- [ ] **WK-8**: search feels instant on the 2k-page staging space (Manual 2.4). archive/2026-10-02-search-matches-page-titles/plan.md
51
+
52
+ ## Done
53
+ +- **WK-8** `search-matches-page-titles`: a title search returns the page first; archived in `archive/2026-10-02-search-matches-page-titles/`
54
+ ```
55
+
56
+ Only the last cell of the row changed. The archive folder carries the `created` date (10-02), not today.
57
+
58
+ ### Final report
59
+
60
+ ```
61
+ Archived search-matches-page-titles
62
+ context/changes/search-matches-page-titles/ → context/archive/2026-10-02-search-matches-page-titles/
63
+ change.md: status archived, archived_at 2026-10-06
64
+ roadmap: WK-8 → done_code (waiting: owner check 2.4); ## Done +1; owner checks +1
65
+ links fixed: 2 (context/foundation/roadmap.md, docs/search.md)
66
+ commit: 5c81e0a chore(archive): close search-matches-page-titles
67
+ Not pushed. Next: softure-lesson for the lesson the review proposed (title weighting) and nobody recorded.
68
+ ```
69
+
70
+ ## 2. The roadmap has someone else's uncommitted edits
71
+
72
+ `git status --porcelain -- context/foundation/roadmap.md` prints ` M`, and `git diff` shows a new
73
+ item `WK-9` being drafted by the owner, not this change's row.
74
+
75
+ ```
76
+ Archived search-matches-page-titles (commit 5c81e0a), with one exception:
77
+ roadmap.md holds uncommitted edits that are not mine (a draft of WK-9).
78
+ I closed WK-8 in the working tree (row, block, ## Done, owner check) but did not stage the file,
79
+ so your draft is not committed by me. Commit roadmap.md together with your edits.
80
+ ```
81
+
82
+ ## 3. A hard stop
83
+
84
+ ```
85
+ Cannot archive invoice-pdf-download:
86
+ stop Progress: 2 open Automated items: 2.2 "PDF totals match the invoice view", 2.3 "gates green"
87
+ stop staged but not part of this change: src/lib/tax.ts, src/lib/tax.test.ts
88
+ (they would ride along in the archive commit; commit or unstage them yourself)
89
+ warn no reviews/impl-review.md
90
+ Nothing was changed. Next: softure-implement invoice-pdf-download.
91
+ ```
92
+
93
+ All failing checks are reported at once, so a second run does not discover a new one.
94
+
95
+ ## 4. A change without a plan
96
+
97
+ Change `pricing-page-copy`: the owner rewrote the copy by hand in commit `a1b2c3d`; no plan.
98
+
99
+ ```markdown
100
+ ## Notes
101
+ - Archived 2026-10-06 without a plan: delivered by a1b2c3d (copy in messages/en.ts), verified by
102
+ the owner on the preview deploy. Open: legal check of the refund sentence → owner checks.
103
+ ```
104
+
105
+ Roadmap: row `done`, `## Done` line, and under `## Owner decisions and checks`
106
+ `- [ ] **PR-2**: legal check of the refund sentence. archive/2026-09-30-pricing-page-copy/change.md`.
@@ -3,10 +3,10 @@ name: softure-code-review
3
3
  description: >
4
4
  Review a diff, a pull request or a set of paths against the project's own conventions:
5
5
  the SOFTURE rules block in AGENTS.md, the project's AGENTS.md/CLAUDE.md, and the numbered
6
- rules in context/foundation/lessons.md. Separates hard violations from taste-level
7
- suggestions, cites the rule behind every finding, and can apply the fixes. Use when the
8
- user says "review this code", "code review", "check my changes", "review PR 42",
9
- "take a look at this PR".
6
+ rules in context/foundation/lessons.md. Grades findings Critical / Warning / Suggestion,
7
+ cites the rule behind every finding, ends with one verdict (approve, request changes, needs
8
+ discussion), and can apply the fixes after asking. Use when the user says "review this
9
+ code", "code review", "check my changes", "review PR 42", "take a look at this PR".
10
10
  argument-hint: "[<change-id> | <pr-number> | <branch> | <path>...] [--fix] [--auto]"
11
11
  allowed-tools:
12
12
  - Read
@@ -20,8 +20,13 @@ allowed-tools:
20
20
 
21
21
  # softure-code-review: hold the code to the rules the project already wrote down
22
22
 
23
- This skill does not invent a standard. Every finding points at a written rule. Without a
24
- rule behind it, a finding can only be a Suggestion, and it says so.
23
+ This skill does not invent a standard. Every finding points at a written rule, or at a
24
+ concrete defect (a bug, a security hole) that needs no rule to be wrong. Without either, a
25
+ finding can only be a Suggestion, and it says so.
26
+
27
+ Read `references/example-review.md` (a complete review of a team-wiki pull request, with the
28
+ fix round that followed) before writing your first report in a session, and whenever unsure how
29
+ to grade or word a finding.
25
30
 
26
31
  ## Scope resolution
27
32
 
@@ -72,22 +77,49 @@ Read all of them before reading the code. Note which rules are relevant to the t
72
77
  - **UI:** accessibility (labels, roles, focus), user-visible text through the project's
73
78
  message layer, design tokens instead of raw values.
74
79
  - **Reuse:** a SOFTURE module or an existing helper that already does this (WORKFLOW §10).
75
- 4. Classify each finding:
76
- - **Violation**: breaks a cited rule, or is a correctness or security defect.
80
+ 4. Grade each finding:
81
+ - **Critical**: a bug, a security hole, data loss, or a broken contract (an API, a schema, a
82
+ public type other code relies on). Must be fixed before merge. Cite the rule when there is
83
+ one; a reproducible defect stands on its evidence.
84
+ - **Warning**: breaks a cited rule (convention, lesson, architecture test) without an
85
+ immediate defect. Should be fixed; does not block on its own.
77
86
  - **Suggestion**: an improvement without a rule behind it. Label it as taste.
78
- 5. Write the report. With `--fix` (or the user's approval), apply violations in small edits,
79
- run the gates from workflow.json, and report what changed. Never commit unless asked. Inside
80
- a change, the caller commits.
87
+
88
+ Critical and Warning together are the **violations**. When torn between Critical and Warning,
89
+ ask what happens in production if nobody touches it.
90
+ 5. Pick the verdict, exactly one:
91
+ - `APPROVE`: no Critical; the Warnings are minor or already acknowledged in the change.
92
+ - `REQUEST CHANGES`: at least one Critical, or Warnings that together make the change unsafe
93
+ to merge.
94
+ - `NEEDS DISCUSSION`: the diff raises a design question it cannot settle by itself (two
95
+ rules pull in opposite directions, the approach contradicts the plan or the PR description).
96
+ Name the question.
97
+ 6. Write the report and print it. Then fix (step 7) or stop.
98
+ 7. **Fixes.**
99
+ - With `--fix`: apply every violation with a local, mechanical fix.
100
+ - Interactive, without `--fix`: ask once, recommended answer first: "Fix Critical and
101
+ Warning findings" (recommended when there is anything to fix), "Fix Critical only", "Let me
102
+ pick" (one question listing the findings), "Leave it as a report".
103
+ - Apply in small edits, one finding at a time, without touching code no finding names. Run the
104
+ gates from workflow.json and add a `## Fixes applied` section (finding, what changed, gates
105
+ result). Never commit unless asked; inside a change, the caller commits. On a PR, never post
106
+ comments or push unless the user asks.
81
107
 
82
108
  ## Output
83
109
 
84
110
  ```markdown
85
111
  # Code review: <scope>
86
112
 
87
- Rules read: AGENTS.md, softure block, lessons L-001…L-0NN · Files: N · Gates: ✓/✗ (when run)
113
+ Rules read: AGENTS.md (project sections, softure block), lessons L-001…L-0NN, eslint config ·
114
+ Files: N reviewed, M skipped (generated) · Gates: ✓/✗ (when run)
115
+
116
+ **Verdict: REQUEST CHANGES** (one line why)
117
+
118
+ ## Critical
119
+ 1. **path:line**: <what is wrong, and the evidence>. Rule: <citation or "defect">. Fix: <concrete change>.
88
120
 
89
- ## Violations
90
- 1. **path:line**: <what is wrong>. Rule: <AGENTS.md "Security" / L-014>. Fix: <concrete change>.
121
+ ## Warnings
122
+ 1. **path:line**: <what is wrong>. Rule: <citation>. Fix: <concrete change>.
91
123
 
92
124
  ## Suggestions (taste)
93
125
  1. **path:line**: <idea>. No rule behind it; take or leave.
@@ -99,19 +131,35 @@ Naming, Types, …
99
131
  One paragraph: the most important thing to fix and the overall risk.
100
132
  ```
101
133
 
102
- Print the report in the chat. When a change-id is given, also write it to `reviews/code-review.md`.
134
+ Omit an empty severity section; list the category under "Clean categories" instead. Order
135
+ findings by impact within a section, and do not bury one real bug under twenty nits: when there
136
+ are more than about fifteen findings, merge those with one root cause and list every location.
137
+
138
+ **Citing a rule.** Name the source and the section, short enough to find: `AGENTS.md
139
+ "Security"`, `softure block "Data"`, `L-014`, `eslint no-floating-promises`,
140
+ `architecture test domain-has-no-ui-imports`. A citation the reader cannot find is not a citation.
141
+
142
+ **One finding, one fix.** The fix is a concrete edit ("pass `pageId` as a bound parameter"), not
143
+ advice ("consider improving the query"). When the right fix is a design choice, the finding is
144
+ NEEDS DISCUSSION material, and the verdict says so.
145
+
146
+ Print the report in the chat. When a change-id is given, also write it to `reviews/code-review.md`
147
+ (headings fixed English, prose in the workflow.json `language`).
103
148
 
104
149
  ## --auto
105
150
 
106
- Apply every violation that has a local, mechanical fix. Leave suggestions unapplied. Record
107
- what was applied and what was left. Ask nothing. Escalate only a security violation whose fix
108
- changes behaviour visible to users.
151
+ Behave as with `--fix`: apply every violation (Critical or Warning) that has a local, mechanical
152
+ fix, leave Suggestions unapplied, and record what was applied and what was left in `## Fixes
153
+ applied`. Ask nothing. A NEEDS DISCUSSION question is answered with the safer option and recorded
154
+ under `## Decisions (auto)` (WORKFLOW §8). Escalate only a security violation whose fix changes
155
+ behaviour visible to users.
109
156
 
110
157
  ## Checklist
111
158
 
112
159
  - [ ] Every violation cites a rule or is a concrete correctness/security defect.
113
160
  - [ ] Suggestions are labelled as such.
114
161
  - [ ] Existing helpers and SOFTURE modules checked before flagging duplication.
162
+ - [ ] Every finding has a location, a severity and a concrete fix; the verdict is exactly one line.
115
163
  - [ ] Gates run after any applied fix.
116
164
 
117
165
  ## Anti-patterns
@@ -120,6 +168,8 @@ changes behaviour visible to users.
120
168
  - Burying one real bug under twenty nits. Order findings by impact.
121
169
  - Flagging code outside the diff, unless the change makes it wrong.
122
170
  - Rewriting working code to the reviewer's taste under `--fix`.
171
+ - Grading a rule violation Critical to force a change, or a real bug Suggestion to stay polite.
172
+ - Advice instead of a fix: "consider", "might want to", "could be cleaner".
123
173
 
124
174
  ## Handoff
125
175
 
@@ -0,0 +1,108 @@
1
+ # Example: a code review and its fix round
2
+
3
+ A team wiki. The user runs `softure-code-review 57` on a pull request titled "Restore an older
4
+ page revision". The project carries the SOFTURE rules block in AGENTS.md (all sections) and
5
+ eleven lessons. Gates come from `context/workflow.json`.
6
+
7
+ ## What the skill read first
8
+
9
+ - AGENTS.md: project sections ("Spaces and permissions", "Dates") and the softure block.
10
+ - `context/foundation/lessons.md`: L-001…L-011; relevant to the touched paths are L-006
11
+ ("permission checks go through `assertCanEdit`, never an inline role comparison") and L-009
12
+ ("dates are formatted only through `lib/dates.ts`").
13
+ - `eslint.config.mjs`: `no-floating-promises` is on, so floating promises are left to the linter.
14
+ - `gh pr view 57` and `gh pr diff 57`: six files, one of them a generated migration snapshot
15
+ (skipped).
16
+
17
+ ## The report
18
+
19
+ ```markdown
20
+ # Code review: PR 57 "Restore an older page revision"
21
+
22
+ Rules read: AGENTS.md (project sections, softure block), lessons L-001…L-011, eslint config ·
23
+ Files: 5 reviewed, 1 skipped (drizzle/meta snapshot) · Gates: not run (review only)
24
+
25
+ **Verdict: REQUEST CHANGES** (the restore action can be called by anyone with a session, and it
26
+ interpolates an id into SQL)
27
+
28
+ ## Critical
29
+ 1. **pages/restore-revision.ts:14**: the server action checks that a session exists, but not
30
+ that the user may edit the page's space; any signed-in reader can overwrite any page.
31
+ Rule: softure block "Security" (authorization, not just a session), L-006.
32
+ Fix: call `assertCanEdit(session.user, page.spaceId)` before the write, as
33
+ `pages/update-page.ts:19` does.
34
+ 2. **pages/restore-revision.ts:27**: `` sql.raw(`... WHERE id = ${revisionId}`) `` puts a value from
35
+ the form into the query text. Rule: softure block "Data" (SQL is always parameterized).
36
+ Fix: `db.select().from(revisions).where(eq(revisions.id, revisionId))`, or a bound parameter.
37
+
38
+ ## Warnings
39
+ 1. **pages/RestoreButton.tsx:22**: `aria-label="Restore this revision"` is inline text.
40
+ Rule: softure block "React / Next.js" (user-visible text, including `aria-label`, goes
41
+ through the message layer). Fix: add `revision.restoreLabel` to `messages/en.ts` and read it
42
+ with `t()`.
43
+ 2. **pages/RevisionList.tsx:9**: a local `formatRevisionDate` builds the date with
44
+ `toLocaleString()`, which uses the server's time zone. Rule: L-009.
45
+ Fix: use `formatDateTime(revision.createdAt, viewer.timeZone)` from `lib/dates.ts`.
46
+ 3. **pages/restore-revision.test.ts:31**: "restore works" asserts `expect(result).toBeTruthy()`.
47
+ Rule: softure block "Tests" (a name states the behaviour; assert exact values).
48
+ Fix: "restores the body and title of the chosen revision", asserting both fields with
49
+ `toEqual`, plus a case for a revision of another page (expects a refusal).
50
+
51
+ ## Suggestions (taste)
52
+ 1. **pages/RevisionList.tsx:40-88**: the inline diff view could be its own component; the file
53
+ would read more easily. No rule behind it; take or leave.
54
+
55
+ ## Clean categories
56
+ Language, Types, Naming, Structure, Reuse
57
+
58
+ ## Summary
59
+ Fix the two Criticals before merging: together they let any signed-in user rewrite any page
60
+ through a query built from form input. The Warnings are small and local. Nothing here needs a
61
+ design discussion.
62
+ ```
63
+
64
+ ## Wording: the same finding, badly and well
65
+
66
+ - Bad: "Security could be improved in the restore action."
67
+ No location, no mechanism, no rule, no fix.
68
+ - Bad: "**pages/restore-revision.ts:14**: consider adding a permission check." Advice, not a
69
+ fix; the reader still has to work out which check and where it lives.
70
+ - Good: Critical 1 above. Location, what goes wrong, the rule and the lesson, and the exact call
71
+ with a sibling that already does it.
72
+
73
+ ## The fix round
74
+
75
+ Without `--fix`, the skill asks once: "Fix Critical and Warning findings" (recommended), "Fix
76
+ Critical only", "Let me pick", "Leave it as a report". The user takes the recommendation. Each
77
+ finding is fixed with a small edit; the suggestion is left alone. The skill runs the gates and
78
+ appends:
79
+
80
+ ```markdown
81
+ ## Fixes applied
82
+ | Finding | Change | Files |
83
+ |---|---|---|
84
+ | Critical 1 | `assertCanEdit` before the write; new test "refuses a reader of the space" | pages/restore-revision.ts, pages/restore-revision.test.ts |
85
+ | Critical 2 | query through the builder with `eq(revisions.id, revisionId)` | pages/restore-revision.ts |
86
+ | Warning 1 | `revision.restoreLabel` in messages/en.ts | pages/RestoreButton.tsx, messages/en.ts |
87
+ | Warning 2 | `formatDateTime` from lib/dates.ts | pages/RevisionList.tsx |
88
+ | Warning 3 | renamed, exact assertions, cross-page refusal case | pages/restore-revision.test.ts |
89
+
90
+ Left as is: Suggestion 1 (taste). Gates: typecheck ✓ lint ✓ test ✓ (1 204 tests).
91
+ Not committed and not pushed: the PR author commits.
92
+ ```
93
+
94
+ ## When the verdict is NEEDS DISCUSSION
95
+
96
+ Had the PR restored a revision by overwriting the page in place, while the PR description said
97
+ "restoring creates a new revision so nothing is lost", the code would match neither reading
98
+ cleanly. The report would then end with:
99
+
100
+ ```markdown
101
+ **Verdict: NEEDS DISCUSSION** (should a restore create a new revision, as the PR description says,
102
+ or overwrite the current one, as the code does? The history view and the audit log depend on the answer.)
103
+ ```
104
+
105
+ and the fix question would not be asked until that is settled. In `--auto` the safer reading
106
+ (create a new revision, nothing is lost) becomes the review's working assumption and is recorded
107
+ under `## Decisions (auto)`. The code change it implies is not mechanical, so it is reported,
108
+ not applied.