@softure-ai/skills 0.0.0-stage → 0.1.1

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 (34) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -2
  3. package/WORKFLOW.md +308 -0
  4. package/package.json +31 -4
  5. package/rules/AGENTS.md +78 -0
  6. package/scripts/install.mjs +151 -0
  7. package/scripts/uninstall.mjs +49 -0
  8. package/skills/softure-archive/SKILL.md +100 -0
  9. package/skills/softure-code-review/SKILL.md +124 -0
  10. package/skills/softure-frame/SKILL.md +113 -0
  11. package/skills/softure-impl-review/SKILL.md +150 -0
  12. package/skills/softure-implement/SKILL.md +141 -0
  13. package/skills/softure-init/SKILL.md +131 -0
  14. package/skills/softure-lesson/SKILL.md +99 -0
  15. package/skills/softure-new/SKILL.md +127 -0
  16. package/skills/softure-plan/SKILL.md +157 -0
  17. package/skills/softure-plan/references/progress-format.md +79 -0
  18. package/skills/softure-plan-review/SKILL.md +152 -0
  19. package/skills/softure-prd/SKILL.md +132 -0
  20. package/skills/softure-research/SKILL.md +165 -0
  21. package/skills/softure-roadmap/SKILL.md +128 -0
  22. package/skills/softure-rule-review/SKILL.md +121 -0
  23. package/skills/softure-shape/SKILL.md +128 -0
  24. package/skills/softure-worktree/SKILL.md +888 -0
  25. package/skills/softure-worktree/scripts/wt-integration.sh +59 -0
  26. package/skills/softure-worktree/scripts/wt-open.sh +57 -0
  27. package/skills/softure-worktree/scripts/wt-roadmap.py +301 -0
  28. package/skills/softure-worktree/scripts/wt-status.sh +70 -0
  29. package/skills/softure-worktree/scripts/wt_config.py +109 -0
  30. package/skills/softure-worktree-manager/SKILL.md +553 -0
  31. package/skills/softure-worktree-manager/scripts/wm-launch.sh +52 -0
  32. package/skills/softure-worktree-manager/scripts/wm-report.sh +45 -0
  33. package/skills/softure-worktree-manager/scripts/wm-resume.sh +132 -0
  34. package/skills/softure-worktree-manager/scripts/wm-watch.sh +49 -0
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env node
2
+ // Removes everything install.mjs put into a project, driven by .claude/softure-skills.json.
3
+ // Usage: node node_modules/@softure-ai/skills/scripts/uninstall.mjs [--target <dir>]
4
+
5
+ import fs from "node:fs";
6
+ import path from "node:path";
7
+
8
+ const MANIFEST_PATH = path.join(".claude", "softure-skills.json");
9
+ const BLOCKS = [
10
+ ["<!-- softure-skills:begin (managed by @softure-ai/skills, do not edit) -->", "<!-- softure-skills:end -->"],
11
+ ["# softure-skills:begin (managed by @softure-ai/skills)", "# softure-skills:end"],
12
+ ];
13
+
14
+ function stripBlocks(content) {
15
+ let result = content;
16
+ for (const [begin, end] of BLOCKS) {
17
+ const start = result.indexOf(begin);
18
+ const stop = result.indexOf(end);
19
+ if (start !== -1 && stop > start) {
20
+ result = (result.slice(0, start).trimEnd() + "\n\n" + result.slice(stop + end.length).trimStart()).trim() + "\n";
21
+ }
22
+ }
23
+ return result;
24
+ }
25
+
26
+ const targetIndex = process.argv.indexOf("--target");
27
+ const projectRoot = path.resolve(targetIndex !== -1 ? process.argv[targetIndex + 1] : process.env.INIT_CWD ?? process.cwd());
28
+ const manifestFile = path.join(projectRoot, MANIFEST_PATH);
29
+
30
+ if (!fs.existsSync(manifestFile)) {
31
+ console.log(`[softure-skills] no manifest at ${manifestFile}, nothing to remove`);
32
+ process.exit(0);
33
+ }
34
+
35
+ const manifest = JSON.parse(fs.readFileSync(manifestFile, "utf8"));
36
+ for (const name of manifest.skills) {
37
+ fs.rmSync(path.join(projectRoot, ".claude", "skills", name), { recursive: true, force: true });
38
+ console.log(`[softure-skills] removed ${name}`);
39
+ }
40
+ for (const file of [manifest.rulesTarget, ".gitignore"].filter(Boolean)) {
41
+ const full = path.join(projectRoot, file);
42
+ if (!fs.existsSync(full)) continue;
43
+ const stripped = stripBlocks(fs.readFileSync(full, "utf8"));
44
+ // The installer may have created the file; leave no empty husk behind.
45
+ if (stripped.trim() === "") fs.rmSync(full);
46
+ else fs.writeFileSync(full, stripped);
47
+ }
48
+ fs.rmSync(manifestFile);
49
+ console.log("[softure-skills] uninstalled");
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: softure-archive
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>\"]"
11
+ allowed-tools:
12
+ - Read
13
+ - Glob
14
+ - Grep
15
+ - Edit
16
+ - Write
17
+ - Bash
18
+ - AskUserQuestion
19
+ ---
20
+
21
+ # softure-archive: the change leaves `changes/`, and the record of it stays
22
+
23
+ Contract: `WORKFLOW.md` §3 (paths), §4 (status), §5 (roadmap rows and statuses), §9 (commit).
24
+
25
+ ## Preconditions (check all, report all, then decide)
26
+
27
+ | Check | Hard stop | Soft warning |
28
+ |---|---|---|
29
+ | `git status --porcelain` is empty | yes: commit or stash first; never archive over uncommitted work | |
30
+ | change.md `status` is `impl_reviewed` | | `implemented` (no review) or earlier |
31
+ | plan.md Progress: no open `#### Automated` items | yes: name them | |
32
+ | plan.md Progress: open `#### Manual` items | | yes: they become owner checks (step 4) |
33
+ | `reviews/impl-review.md` has no CRITICAL without a decision | yes | |
34
+ | target `context/archive/<created>-<change-id>/` does not exist | yes | |
35
+
36
+ Interactive: show the warnings and ask once ("Archive anyway" / "Stop"). `--auto`: proceed
37
+ on warnings, stop on hard stops.
38
+
39
+ ## Procedure
40
+
41
+ 1. **Stamp change.md:**
42
+ - `status: archived`;
43
+ - `archived_at: <today>`;
44
+ - `updated: <today>`;
45
+ - one closing line under `## Notes`: `Archived <date>: <outcome in one sentence>.`
46
+ 2. **Move.** Run `git mv context/changes/<id> context/archive/<created>-<id>`, where `<created>`
47
+ is the `created` date from change.md, not today.
48
+ 3. **Update the roadmap** (when change.md has `roadmap_item`, or a row with `` `<id>` `` exists):
49
+ - Choose the row status:
50
+ - `done` when everything is delivered and verified;
51
+ - `done_code (<today>; waiting: <what>)` when the code is finished but something still
52
+ waits. Examples: a release, an open Manual item, a deploy-only check. `--done-code`
53
+ forces this, using the given text.
54
+ - Replace only the **last cell** of the row; leave the other cells alone.
55
+ - Update `- **Status:** …` in the item block under `- **Change ID:**`.
56
+ - Append to `## Done`:
57
+ `- **<ID>** \`<id>\`: <outcome>; archived in \`archive/<created>-<id>/\``.
58
+ - Set frontmatter `updated` to today.
59
+ 4. **Owner checks.** For each open Manual item, add a line under `## Owner decisions and checks`:
60
+ `- [ ] **<ID>**: <item text> (Manual N.M). archive/<created>-<id>/plan.md`. Do the same for
61
+ deferred review findings that target the owner.
62
+ 5. **Fix links.** `grep -rn "changes/<id>" context/ docs/ AGENTS.md CLAUDE.md` and rewrite each
63
+ hit to `archive/<created>-<id>`. Links inside the archived folder are relative and stay valid.
64
+ 6. **Verify** that the old folder is gone, the new one exists, the roadmap row has exactly one
65
+ match, and no dangling `changes/<id>` links remain.
66
+ 7. **Commit** with `chore(archive): close <change-id>`, staging only the touched paths.
67
+
68
+ ## --auto
69
+
70
+ Proceed on soft warnings. Record each one in the archive commit body and in the roadmap owner
71
+ checks. Pick `done_code` whenever any Manual item is open or the change affects deployment
72
+ (migrations, env vars, infrastructure).
73
+
74
+ ## Inside a worktree
75
+
76
+ Archive **on the change branch**, before the merge. The roadmap edits will then conflict
77
+ textually with other merged changes; that is expected. `softure-worktree` resolves them row by
78
+ row during the merge. Do not touch rows of other items.
79
+
80
+ ## Checklist
81
+
82
+ - [ ] No uncommitted files before and after.
83
+ - [ ] `status: archived`, `archived_at` set.
84
+ - [ ] Folder name uses the `created` date.
85
+ - [ ] Roadmap row last cell, item block status, `## Done` and `updated` all changed.
86
+ - [ ] Open Manual items listed for the owner.
87
+ - [ ] No dangling links.
88
+ - [ ] One commit, conventional message.
89
+
90
+ ## Anti-patterns
91
+
92
+ - Ticking Manual items to make archiving clean. They go to the owner list instead.
93
+ - Archiving with a red gate "to clean up later".
94
+ - Rewriting history in the archived plan. It is a record and stays as it was executed.
95
+ - Marking `done` when a release is still needed. That is `done_code`.
96
+
97
+ ## Handoff
98
+
99
+ `softure-worktree` continues with syncing the main branch and the READY report. Standalone, the
100
+ change is closed. Suggest `softure-lesson` if the review proposed lessons that were not recorded.
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: softure-code-review
3
+ description: >
4
+ Review a diff, a pull request or a set of paths against the project's own conventions:
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".
10
+ argument-hint: "[<change-id> | <pr-number> | <branch> | <path>...] [--fix] [--auto]"
11
+ allowed-tools:
12
+ - Read
13
+ - Glob
14
+ - Grep
15
+ - Edit
16
+ - Write
17
+ - Bash
18
+ - AskUserQuestion
19
+ ---
20
+
21
+ # softure-code-review: hold the code to the rules the project already wrote down
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.
25
+
26
+ ## Scope resolution
27
+
28
+ | Argument | What gets reviewed |
29
+ |---|---|
30
+ | none | `git diff` (staged + unstaged); if empty, `git diff <mainBranch>...HEAD` |
31
+ | `<change-id>` | `git diff <mainBranch>...HEAD` on the change branch; report saved to `context/changes/<change-id>/reviews/code-review.md` |
32
+ | `<pr-number>` | `gh pr diff <n>` and `gh pr view <n>` |
33
+ | `<branch>` | `git diff <mainBranch>...<branch>` |
34
+ | paths | the files as they are now |
35
+
36
+ `mainBranch` comes from `context/workflow.json`. Default to `main` and then `master`,
37
+ whichever exists.
38
+
39
+ ## Rule sources, in priority order
40
+
41
+ 1. Project `AGENTS.md` / `CLAUDE.md`, outside the SOFTURE managed block. Project rules win.
42
+ 2. The SOFTURE managed block (`<!-- softure-skills:begin … -->`).
43
+ 3. `context/foundation/lessons.md`: cite as `L-NNN`.
44
+ 4. Architecture tests and lint config in the repo. When a rule is already enforced by a test
45
+ or linter, run it instead of eyeballing.
46
+
47
+ Read all of them before reading the code. Note which rules are relevant to the touched paths.
48
+
49
+ ## Procedure
50
+
51
+ 1. Resolve the scope and list the changed files. Skip generated files: lockfiles, migration
52
+ snapshots, build output.
53
+ 2. For each file, read enough surrounding code to judge the change in place. "Too long" and
54
+ "impure" are only meaningful relative to what the function does and who calls it.
55
+ 3. Walk the categories. A category with nothing to report is stated as clean.
56
+ - **Language:** any non-English code, identifier, comment, commit message or log text
57
+ outside message dictionaries is a violation (the mandatory language rule in AGENTS.md).
58
+ - **Correctness:** logic errors, unhandled states, off-by-one, time zones, async without
59
+ error handling.
60
+ - **Boundaries:** input validation, authorization, SQL parameterization, secrets, leaked
61
+ internals in responses.
62
+ - **Data:** migrations, invariants enforced in the database, transactions, N+1 queries.
63
+ - **Types:** `any` without justification, unchecked casts of external data, optional-field
64
+ soup instead of a discriminated union.
65
+ - **Structure:** single responsibility, parameter count, nesting, dead code, duplication of
66
+ something that already exists (search before flagging).
67
+ - **Naming:** descriptive, verb-first functions, boolean prefixes, file named after its main export.
68
+ - **Tests:** behaviour-named, isolated, specific assertions, edge and error paths.
69
+ - **UI:** accessibility (labels, roles, focus), user-visible text through the project's
70
+ message layer, design tokens instead of raw values.
71
+ - **Reuse:** a SOFTURE module or an existing helper that already does this (WORKFLOW §10).
72
+ 4. Classify each finding:
73
+ - **Violation**: breaks a cited rule, or is a correctness or security defect.
74
+ - **Suggestion**: an improvement without a rule behind it. Label it as taste.
75
+ 5. Write the report. With `--fix` (or the user's approval), apply violations in small edits,
76
+ run the gates from workflow.json, and report what changed. Never commit unless asked. Inside
77
+ a change, the caller commits.
78
+
79
+ ## Output
80
+
81
+ ```markdown
82
+ # Code review: <scope>
83
+
84
+ Rules read: AGENTS.md, softure block, lessons L-001…L-0NN · Files: N · Gates: ✓/✗ (when run)
85
+
86
+ ## Violations
87
+ 1. **path:line**: <what is wrong>. Rule: <AGENTS.md "Security" / L-014>. Fix: <concrete change>.
88
+
89
+ ## Suggestions (taste)
90
+ 1. **path:line**: <idea>. No rule behind it; take or leave.
91
+
92
+ ## Clean categories
93
+ Naming, Types, …
94
+
95
+ ## Summary
96
+ One paragraph: the most important thing to fix and the overall risk.
97
+ ```
98
+
99
+ Print the report in the chat. When a change-id is given, also write it to `reviews/code-review.md`.
100
+
101
+ ## --auto
102
+
103
+ Apply every violation that has a local, mechanical fix. Leave suggestions unapplied. Record
104
+ what was applied and what was left. Ask nothing. Escalate only a security violation whose fix
105
+ changes behaviour visible to users.
106
+
107
+ ## Checklist
108
+
109
+ - [ ] Every violation cites a rule or is a concrete correctness/security defect.
110
+ - [ ] Suggestions are labelled as such.
111
+ - [ ] Existing helpers and SOFTURE modules checked before flagging duplication.
112
+ - [ ] Gates run after any applied fix.
113
+
114
+ ## Anti-patterns
115
+
116
+ - Inventing house style mid-review.
117
+ - Burying one real bug under twenty nits. Order findings by impact.
118
+ - Flagging code outside the diff, unless the change makes it wrong.
119
+ - Rewriting working code to the reviewer's taste under `--fix`.
120
+
121
+ ## Handoff
122
+
123
+ Patterns that keep coming back across reviews belong in `softure-lesson`. Rules that
124
+ contradict each other go to `softure-rule-review`.
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: softure-frame
3
+ description: >
4
+ Challenge WHAT is being built before anyone plans HOW. Works on an idea (before the PRD)
5
+ or on a change after research: restates the problem, generates alternative framings,
6
+ offers kill / shrink / reframe / proceed options, and records the decision in `frame.md`
7
+ of the change, or in a section of shape-notes. Use when the request smells like a
8
+ solution in search of a problem, when research found a cheaper path, or when scope keeps
9
+ growing. Triggers: "is this the right thing to build", "challenge this", "frame it",
10
+ "does this even make sense", "can we do this cheaper".
11
+ argument-hint: "[change-id | idea] [--auto]"
12
+ allowed-tools:
13
+ - Read
14
+ - Glob
15
+ - Grep
16
+ - Write
17
+ - Edit
18
+ - AskUserQuestion
19
+ ---
20
+
21
+ # softure-frame: challenge what to build
22
+
23
+ ## Purpose
24
+
25
+ A good plan for the wrong thing is still waste. This skill spends a few minutes trying to
26
+ make the work **smaller, different or unnecessary** before planning locks it in. It ends
27
+ with an explicit decision, not a discussion.
28
+
29
+ ## Inputs
30
+
31
+ One of two modes:
32
+ - **Change mode:** `context/changes/<change-id>/change.md` must exist, and should have
33
+ `research.md`. Without research, say that framing is weaker without it and offer to run
34
+ `softure-research` first (recommended), unless the user wants to frame now.
35
+ - **Idea mode:** an idea or `context/foundation/shape-notes.md`.
36
+
37
+ Also read `context/foundation/prd.md` and `roadmap.md` when present, because the frame must
38
+ respect their goals.
39
+
40
+ ## Procedure
41
+
42
+ 1. **Restate.** Write the request as *problem → desired outcome → proposed solution*, in
43
+ three lines. If you cannot separate problem from solution, that is the first finding.
44
+ 2. **Test the premise.** Answer briefly, using evidence from research and the code:
45
+ - What happens if we do nothing for three months?
46
+ - Is the problem real and frequent, or a single anecdote?
47
+ - Does something in the codebase, a SOFTURE module (`@softure-ai/*`, WORKFLOW §10) or a
48
+ configuration change already solve most of it?
49
+ - What is the smallest change that would prove or disprove the value?
50
+ 3. **Generate 3 to 5 framings**, each as one line plus the cost difference:
51
+ - *Proceed* as asked.
52
+ - *Shrink*: the 20% that delivers 80%.
53
+ - *Reframe*: solve the underlying problem differently (process, copy, default value,
54
+ existing feature).
55
+ - *Reuse*: adopt an existing module or library instead of building.
56
+ - *Kill or defer*, with the reason.
57
+ 4. **Recommend one** and give the deciding argument, then ask a single question with the
58
+ options. Never offer "I'm not sure" as an option; if the user is unsure, the recommendation
59
+ stands.
60
+ 5. **Record** the decision (template below).
61
+ - Change mode: write `frame.md` in the change folder and update `change.md` → `## Intent`
62
+ if the outcome changed.
63
+ - Idea mode: add or replace a `## Frame` section in shape-notes.md.
64
+ 6. **Route:**
65
+ - Proceed / shrink / reuse → `softure-plan` (change mode) or `softure-prd` (idea mode).
66
+ - Kill / defer → leave the change in `changes/` with a `## Notes` line "deferred by frame:
67
+ <reason>", and ask whether to archive it.
68
+
69
+ ## Output: `frame.md`
70
+
71
+ ```markdown
72
+ # Frame: <change-id>
73
+
74
+ ## Request as stated
75
+ ## Problem → outcome → proposed solution (three lines)
76
+ ## Premise check
77
+ - Do nothing for 3 months: …
78
+ - Evidence: …
79
+ - Already solved elsewhere: …
80
+ - Smallest proof: …
81
+ ## Framings
82
+ | Option | What we build | Cost vs as-asked | Risk |
83
+ |---|---|---|---|
84
+ ## Decision
85
+ <option> — because <deciding argument>. Scope now: … Out of scope now: …
86
+ ## Decisions (auto) (only in --auto)
87
+ ```
88
+
89
+ Write in `workflow.json` → `language`.
90
+
91
+ ## `--auto`
92
+
93
+ Choose the smallest option that still meets change.md's `## Intent`. Never choose *kill*
94
+ in `--auto`: if killing is the best option, record it as the recommendation, choose *shrink*,
95
+ and add a `## Notes` line in change.md for the owner. Do not ask anything.
96
+
97
+ ## Quality bar
98
+
99
+ - [ ] At least one option is materially cheaper than the request.
100
+ - [ ] Each option names its cost difference, not just its features.
101
+ - [ ] The decision is a single option with one deciding argument.
102
+ - [ ] The scope after framing is explicit (in / out).
103
+
104
+ ## Do not
105
+
106
+ - Do not plan, estimate tasks or touch code.
107
+ - Do not reopen decisions the PRD or roadmap made explicitly, unless research contradicts them.
108
+ In that case, say exactly which line is contradicted and why.
109
+ - Do not spend more than one round of questions. Framing is fast by design.
110
+
111
+ ## Handoff
112
+
113
+ `softure-plan <change-id>` (change mode) or `softure-prd` (idea mode).
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: softure-impl-review
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]"
12
+ allowed-tools:
13
+ - Read
14
+ - Glob
15
+ - Grep
16
+ - Edit
17
+ - Write
18
+ - Bash
19
+ - AskUserQuestion
20
+ ---
21
+
22
+ # softure-impl-review: does the code do what the plan promised?
23
+
24
+ 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.
26
+
27
+ ## Inputs
28
+
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`.
34
+ - `context/foundation/lessons.md`: existing rules the code must respect.
35
+
36
+ ## Procedure
37
+
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
81
+
82
+ | Severity | Meaning |
83
+ |---|---|
84
+ | 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. |
86
+ | SUGGESTION | Better, but not wrong. Never blocks. |
87
+
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`.
94
+
95
+ ## Output: `reviews/impl-review.md`
96
+
97
+ ```markdown
98
+ # Implementation review: <change-id>
99
+
100
+ Date: YYYY-MM-DD · Commits: <first>..<last> · Gates: typecheck ✓ lint ✓ test ✓ (N tests)
101
+
102
+ ## Verdict
103
+ Ready / Ready after fixes / Not ready. One paragraph.
104
+
105
+ ## Plan coverage
106
+ | Phase | Commit | Delivered | Notes |
107
+
108
+ ## Findings
109
+ ### F1 [CRITICAL] <title>
110
+ **Where:** path:line · **What:** … · **Why it matters:** … · **Evidence:** …
111
+ **Decision:** fix now: <what was changed> (<sha>)
112
+
113
+ ## Progress audit
114
+ Items ticked without evidence (should be none after fixes).
115
+
116
+ ## Lessons proposed
117
+ - <rule draft> → softure-lesson
118
+ ```
119
+
120
+ ## --auto
121
+
122
+ - CRITICAL and WARNING findings that have a clear local fix: `fix now`.
123
+ - Fixes that need a product decision: `defer` to the roadmap "Owner decisions and checks"
124
+ list, with the finding ID.
125
+ - SUGGESTIONs: `accept`, unless the fix is under about 10 lines and risk-free.
126
+ - A finding that matches a pattern already seen in lessons.md, or that repeats across changes:
127
+ also `record as lesson`.
128
+ - If a CRITICAL cannot be fixed without leaving the change's scope, stop and escalate
129
+ (WORKFLOW §8.2).
130
+
131
+ ## Checklist
132
+
133
+ - [ ] Gates re-run in this session, results in the report header.
134
+ - [ ] Every `- [x]` has evidence.
135
+ - [ ] Every finding has a decision.
136
+ - [ ] Fix commit references the change-id.
137
+ - [ ] Status is `impl_reviewed`.
138
+
139
+ ## Anti-patterns
140
+
141
+ - Reviewing only the diff hunks. Bugs live in the unchanged lines next to them.
142
+ - "Looks good" with zero findings on a non-trivial change. Look again at the error paths and tests.
143
+ - Rewriting the feature during review. Fixes stay minimal; larger rework goes back to the plan.
144
+ - Unticking or rewording Progress items to make the review pass.
145
+
146
+ ## Handoff
147
+
148
+ - Lessons proposed: run `softure-lesson`.
149
+ - Then `softure-archive <change-id>`. Inside a worktree run, `softure-worktree` continues with
150
+ integration and archive.
@@ -0,0 +1,141 @@
1
+ ---
2
+ name: softure-implement
3
+ description: >
4
+ Execute a reviewed plan phase by phase: write the code and tests for one phase, run the
5
+ project gates, verify the criteria for real, tick ## Progress and commit once per phase.
6
+ Resumes from the first open item. Use after softure-plan-review. Triggers: "implement
7
+ phase N", "continue implementation", "/softure-implement",
8
+ "execute the plan", "next phase".
9
+ argument-hint: "<change-id> [phase N | next] [--auto]"
10
+ allowed-tools:
11
+ - Read
12
+ - Glob
13
+ - Grep
14
+ - Bash
15
+ - Write
16
+ - Edit
17
+ - Agent
18
+ - AskUserQuestion
19
+ ---
20
+
21
+ # softure-implement: execute the plan, prove every box
22
+
23
+ Implementation follows the plan. It does not redesign it. Each phase ends in a single commit
24
+ whose ticked boxes are **true**: they were checked, not assumed. `## Progress` in `plan.md` is
25
+ the only state, so anyone can stop and anyone can resume.
26
+
27
+ ## Required inputs
28
+
29
+ - `context/changes/<id>/plan.md` and `change.md` with `status: plan_reviewed` or `implementing`.
30
+ If the status is `planned`, run `softure-plan-review` first.
31
+ - `context/workflow.json`, which provides the gates and `mainBranch`.
32
+ - `context/foundation/lessons.md`, when present.
33
+ - A clean working tree, apart from files this change owns. Unrelated uncommitted changes:
34
+ in interactive mode, ask; in `--auto`, stop and escalate. Never stash or discard them.
35
+
36
+ ## Procedure
37
+
38
+ 1. **Locate the phase.**
39
+ - `phase N` → that phase.
40
+ - `next` or no argument → the phase holding the first `- [ ]` in an Automated group.
41
+ - Every automated item ticked → go to step 9.
42
+
43
+ Refuse to skip ahead over an unfinished earlier phase unless the user explicitly says so.
44
+
45
+ 2. **Load context fresh.** Re-read the phase section, its Progress items, change.md Constraints,
46
+ relevant research sections, and the lessons whose "Applies to" matches the phase's files.
47
+ Set `status: implementing` (and `updated`) on the first run.
48
+
49
+ 3. **Reconcile plan and code.** Before editing, confirm that the files and symbols the phase names
50
+ exist and look as research described. When they differ:
51
+ - **Small drift** (renamed symbol, moved file, an extra call site): adapt and record it under
52
+ `## Decisions (auto)` in plan.md, or ask in interactive mode.
53
+ - **The approach no longer holds** (a wrong assumption about data, an API that does not exist,
54
+ the Constraints would be violated): stop. Do not improvise a new design. Report what is
55
+ wrong and recommend `softure-plan` (re-plan) for the remaining phases.
56
+
57
+ 4. **Implement with the phase's discipline.**
58
+ - **TDD:** write the failing test first and run it to see it red for the right reason.
59
+ Then implement until green, then refactor.
60
+ - **Test-after:** implement, then write the tests named in the criteria.
61
+
62
+ Follow the project conventions (AGENTS.md / CLAUDE.md). Keep changes inside the phase's
63
+ files. If a necessary file is outside the list, add it and record why.
64
+
65
+ 5. **Run the gates** from `workflow.json` (`typecheck`, `lint`, `test`), all of them, every phase.
66
+ - A red gate is fixed, never skipped.
67
+ - A failure that existed before your change must be proven to pre-exist: check out
68
+ `mainBranch` in a scratch worktree and run the same command. Then report it. Do not silence it.
69
+
70
+ 6. **Verify the criteria for real.**
71
+ - Automated items: run the exact command or test and read its output.
72
+ - Data criteria: read the database (a query against dev or test data), never only the
73
+ rendered UI.
74
+ - Manual items: try to verify them yourself where a machine can stand in for the eye, for
75
+ example screenshots at the stated widths and themes, a recorded request/response, or a DB
76
+ read. Tick such an item with `(verified by agent: <how>)`. Anything that needs the owner's
77
+ judgement stays `- [ ]`.
78
+
79
+ 7. **Commit the phase.**
80
+ - Stage only this change's files and check `git status` before committing.
81
+ - One commit per phase, with message `<type>(<change-id>): <phase title> (p<N>)`, where type
82
+ is `feat`, `fix`, `refactor`, `test`, `docs` or `chore`.
83
+ - Then tick the verified boxes and append ` — <short sha>`. Include the Progress update in the
84
+ same commit by amending before any push, or commit it as a follow-up `docs(<change-id>):
85
+ progress p<N>` if amending is not safe. Never push, tag, release or deploy.
86
+
87
+ 8. **Continue or pause.** In interactive mode, report the phase result and ask whether to continue
88
+ to the next phase. In `--auto`, continue until all phases are done or an escalation is hit.
89
+
90
+ 9. **Finish.** When every Automated item is ticked:
91
+ - set `status: implemented` and update `updated`;
92
+ - list the open Manual items for the owner;
93
+ - recommend `softure-impl-review <change-id>`.
94
+
95
+ ## Progress rules (short form)
96
+
97
+ Use the format in `softure-plan/references/progress-format.md`:
98
+ - tick only verified items;
99
+ - never rename or delete items;
100
+ - add new items with the next free number;
101
+ - mark dropped ones `~~text~~ — dropped: <reason>`.
102
+
103
+ ## Status transitions
104
+
105
+ - `plan_reviewed` → `implementing` at the start of the first phase.
106
+ - `implementing` → `implemented` once every Automated item is ticked.
107
+
108
+ ## `--auto`
109
+
110
+ - Never ask. Run all remaining phases in order.
111
+ - Apply small drift and record it under `## Decisions (auto)` in plan.md.
112
+ - Stage only files you touched for this change.
113
+ - Escalate (stop with a report) when:
114
+ - the approach is invalid (re-plan needed);
115
+ - a gate stays red after a reasonable fix attempt and you cannot prove the failure pre-exists;
116
+ - a destructive or irreversible operation is needed;
117
+ - a secret or access is missing.
118
+
119
+ ## Quality checklist
120
+
121
+ - [ ] Every ticked box was actually checked in this session, by command, query or screenshot.
122
+ - [ ] Gates are green at every phase commit.
123
+ - [ ] The diff is English-only outside message dictionaries (language rule in AGENTS.md).
124
+ - [ ] There is one commit per phase with the WORKFLOW §9 message, and nothing unrelated is staged.
125
+ - [ ] TDD phases show a red test before the implementation.
126
+ - [ ] Drift is recorded. No silent design changes.
127
+ - [ ] Nothing was pushed, tagged, released or deployed.
128
+
129
+ ## Anti-patterns
130
+
131
+ - Ticking a box because the code "should" make it true.
132
+ - "Verifying" a write by looking at the UI, which may show form defaults or a cache.
133
+ - Fixing a red gate by skipping, disabling or loosening the test.
134
+ - `git add -A` with unrelated files in the tree.
135
+ - Quietly redesigning when the plan is wrong, instead of stopping for a re-plan.
136
+ - Bundling several phases into one commit.
137
+
138
+ ## Handoff
139
+
140
+ Next: `softure-impl-review <change-id>`. Open manual items go to the owner. In a roadmap, they
141
+ are listed under "Owner decisions and checks".