sw-verify
Use when a Superwiki task's work is finished and it has to be closed with evidence, when the user asks what a task did, what it changed or how it was verified, or invokes sw-verify with a task id. sw-implement runs it as the gate before `done`.
mhmtsrfglu · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add mhmtsrfglu/superwiki --skill sw-verify技能说明
name: sw-verify
description: Use when a Superwiki task's work is finished and it has to be closed with evidence, when the user asks what a task did, what it changed or how it was verified, or invokes sw-verify with a task id. sw-implement runs it as the gate before done.
sw-verify
Closes a task with a ## Summary section in its task file: what was planned, what was built, what changed, and the evidence for each "Done when" item. status: done then means verified, and the task file says how.
One rule carries the skill: no verdict without a command run in this session. Name the command that proves the item, run it now, read its exit code and its output, then write the verdict. An earlier run, the implementer's report, a passing test you remember, or "should pass" is not evidence.
A second rule goes with it: the command must be one that could have come out the other way. For each item, say how its command would have failed if the item did not hold. A command that passes whatever the code does proves nothing.
It runs in the session that invokes it: by hand as sw-verify <ID>, or as a step of sw-implement. It is not handed to the implementer; the one who did the work does not also sign it off.
Run commands from the project root.
Steps
-
Read the task:
docs/tasks/<ID>.md. Its "Done when" items areD1toD<n>in the order they are written, n from thedone when:line ofnode docs/.sw/sw.mjs check <ID>, which counts the top-level bullets; entry n of the verification list isD<n>. If the task has a plan, read only its## Approachand## Verification. -
Take the changes from git, never from memory:
- uncommitted work:
git status --porcelain; - work already committed:
git log --name-status --format='%h %s' --grep='^<ID>:', the commits whose message starts with<ID>:; - the short HEAD for the source line:
git rev-parse --short HEAD.
List the files that belong to this task, without its bookkeeping (the task file, its plan,
docs/log.md,docs/index.md, the area guide, a run'sdocs/.sw/run.md). Uncommitted work can sit next to other tasks' changes, so a file belongs to the task when it is both ingit status --porcelainand in the "files changed" of this task's implementer reports, the first report and each fix round's. A session that ran several tasks holds other tasks' reports too; they do not count. Invoked by hand with no report in this session: the whole list, when the tree holds nothing else; otherwise ask the user which files belong to the task. No git repository, or the vault is ignored by git: say so in the section instead of listing files from recollection. - uncommitted work:
-
Pick one command per "Done when" item.
Where the command comes from When the plan's ## Verificationthe task has a plan the commands the implementer reported no plan, and a report is in this session you choose it otherwise, or the listed command does not prove the item A requirement about text (a document mentions something, a file exists, a format is described) is proven by
grep,test -forlint, not by having written the text. A requirement about behaviour (what a program, an endpoint or an agent following a prompt does) is proven by running the thing and observing it: run the program, call the endpoint, or dispatch a fresh agent on the scenario and read what it does. Finding the code or text that should cause the behaviour proves only that the text is there; without a run the item isunverified. A check needs the environment when it starts a service, needs a running stack or changes data. It runs only if the user allowed it: under sw-implement the answer is on that skill's list of such checks; when you verify outside it, ask the user before you run one.For each command, write down how it would have failed if the item did not hold: the exit code, the missing line, the changed count. That is the item's
falsifies:line, and it names the item's own rule, not "the test would fail". If you cannot write it, the command does not prove the item: choose another. When none can fail, the item isunverifiedin step 4.An item marked "(test)" is proven by a test. Take its
red:line from the implementer's reports in this session, the first one's and each fix round's: the run in which that test failed before the code existed. -
Run every command now and read the result. Exit code first, then the line that shows the item holds: the test count, the matching line, the
0 errors.What you have Verdict the command ran in this session, exited as expected, and its output shows the item verifiedthe command ran and shows the item does not hold failedthe command ran and passes, but no state of the thing it checks would have made it fail (see "Common mistakes") unverified, reasonthe command cannot failan item marked "(test)" has no red:line in the reports of this session, or the line saysnoneunverified, reasonno red: lineno command was run: a check that needs the environment and was not allowed, a difference from the item's wording that the user has not decided (run no command for it), nothing that can prove it, or only someone's word unverified, with the reasonthe command proves part of the item unverified, saying which part is openWhen an item is marked "(test)", make one mutation run for the task's central rule, the rule its Goal states. Break that rule in the code on purpose: remove the line that enforces it, or invert its condition. Run the item's test command and read which test went red. Then restore the code and run the command again until it is green. Save a copy of the file before you change it and restore from the copy, then compare the two;
git checkoutandgit restorealso drop the task's uncommitted work. Record in the item's result what was removed