sw-lint
Use when the user asks to check, lint, health-check, clean up or audit the Superwiki vault or wiki, after bulk edits or a migration, or invokes sw-lint.
SKILL.mdskills/sw-lint/SKILL.md
GitHubsw-lint
Two passes. The first is a script and costs almost nothing. The second reads pages and costs tokens, so it runs only when the user approves it.
Pass 1: structure (always)
Run
node docs/.sw/sw.mjs lintfrom the project root. Read only its output, not the vault. It exits with code 1 while errors remain; that is expected.Fix broken links first, then run lint again, because one rename produces several findings (
broken-linkin every page that linked the old name, plusnot-in-indexandorphan-pagefor the new one).- A rename is established when exactly one page is reported
not-in-indexororphan-pageand its name is a variation of the broken target. Re-point every[[old]]to[[new]]in the files lint named, includingindex.mdand task files. - Two candidates, or no resemblance: do not guess. Report it.
- A rename is established when exactly one page is reported
Fix what else has one correct answer:
Finding Fix stale-board,missing-boardnode docs/.sw/sw.mjs index: it rewrites the task list inindex.mdfrom the task files. Never edit that list by handnot-in-indexadd - [[page]]: summarytoindex.md, using the page'ssummary:missing-fieldsummarycopy it from the page's line in index.md; if there is none, read the page and write itmissing-fieldtyperead that page, write the field missing-datefill from git log --follow --format=%ad --date=short -- <file>when the project is under git and the date is unambiguousReport the rest and let the user decide. Do not change a task's
statusordepsto silence a finding.Finding Why it needs a human started-before-deps,done-before-deps,dep-cycle,cancelled-depeither the status or the dependency is wrong; only the user knows which done-unverifiedthe task is donebut its## Summaryholds an unverified or failed item. Run sw-verify for it; do not edit a verdict by handmissing-dateyou could not fillno history to take it from, or it hangs on a finding above duplicate-nameone of the pages must be renamed and every link to it re-pointed broken-linkwith no clear target,orphan-plan,unknown-depthe page may be missing or the reference stale orphan-pagemay be fine; may want a link from a related page Run lint again and state the before and after counts.
Pass 2: meaning (ask first)
Offer it with its size: "The wiki has N pages; a semantic review reads them. Run it?" (N from node docs/.sw/sw.mjs status). If approved:
- Read
index.md. Collect follow-ups that ingests deferred: find the last lint entry withgrep -n '^## \[.*\] lint' docs/log.md | tail -1and read the log from that line to the end (the whole log only if there is no lint entry and it is short; otherwisetail -60). - Read the wiki pages. Up to about twenty pages, read them all; beyond that, go group by group (same
type, or linked to each other). Open a file inraw/only to settle whether two pages really contradict each other. Look for:- claims that contradict each other;
- a
decisionpage superseded by a later one without saying so; - concepts named on several pages that have no page of their own;
- pages that should link to each other and do not;
- summaries or titles that no longer match the page;
- each collected follow-up: still needed, or already handled.
- Present the findings as a numbered list with the pages involved, and say which ones you recommend applying now. Apply only what the user agrees to.
Finish
Run
node docs/.sw/sw.mjs lintonce more if you edited anything after the last run.Append to
docs/log.md, in the layout its last entries use:## [YYYY-MM-DD] lint | <N> fixed, <M> open Fixed: <what>. Open: <findings left for the user>. Follow-up: <semantic findings and ingest follow-ups not yet handled>.Carry every unhandled follow-up into this entry: the next lint reads only from here on. Name a page that was renamed or removed in backticks, not as a
[[link]].