科研 Skill
知识库结构校验
wiki-lint
Validates a wiki’s structural integrity: frontmatter completeness, broken links, orphaned pages, status. Use before drafting or finishing to catch structural errors.
SKILL.md
Wiki Lint
Run the wiki linter and act on its findings. Mandatory gate before drafting-manuscript and finishing-a-research-project; useful after bulk ingest or whenever the wiki has grown.
Announce at start: "Using wiki-lint to validate the knowledge tree."
If not met: tell the user which classes of issues remain (errors / warnings /
orphans), ask for a short reason to proceed anyway (e.g. "orphan is intentional
— it's the index page"), and write the reason into
knowledge/_meta/gate-overrides.log. Errors should as a rule be fixed rather
than overridden — the override is an audit trail, not a substitute.
When to use
- Before
drafting-manuscript(soft gate) - Before
finishing-a-research-project(soft gate) - After
ingest-sourcebatch runs (≥ 3 new sources) - When user says "clean up the wiki", "lint", "check the wiki"
- Periodically when the project is long-running
Checklist
- Locate the lint script —
scripts/lint-wiki.pyin the project root (from template) - Run it —
python scripts/lint-wiki.py. If Python or PyYAML or the script itself is missing, take the Python-free fallback path below. - Parse output into categories: errors, warnings, orphans
- Fix errors inline (missing frontmatter fields, broken wikilinks, invalid
typevalues) - Assess warnings — stale pages, status inconsistency, empty sections — decide with user: fix / defer / ignore
- Read the
=== Research chronology ===section —CHRONO-ORDER(aresponds-to/supersedes/revisesedge pointing from an earlier source to a later one) fails the run: move the edge to the later page, or setorig_yearif a date is wrong.ANACHRONISMandSUPERSEDED-CITEDare advisory: the first is fixed by moving the edge, the second is a question for the author — is the older source cited as history or as the current state?
- Read the
- Review the open review flags — the
=== Review flags ===section lists openreview_flags(content findings fromsemantic-wiki-review). These do not fail the exit code, but they gate drafting (seedrafting-manuscript): decide with the user per flag — fix the underlying issue and setstate: resolved, or leave it open and let drafting log an override. Do not clear a flag by deleting it. - Check authority-ID coverage — the
=== Authority-ID coverage (entities) ===section reports how many entities carry agnd_id/idai_gazetteer_id/wikidata_qidand lists the untagged (--verbose). Advisory only. For persons and places, resolve and add the ID (viadao-paper-searchresolve_author/resolve_site) — it is the join key for cross-project linkage (wiki-global-graph.py overlap); datasets / methods / software may legitimately have none. Work the untagged list rather than letting it accumulate. - Handle orphans — pages with no incoming wikilinks: decide link-in, delete, or mark as root
- Re-run lint until exit 0 on errors
- Log the run in
knowledge/_meta/log.mdwith summary (N errors fixed, N warnings deferred, N open flags) - Dispatch
wiki-lintersubagent (optional) for large wikis — seeagents/wiki-linter.md
See also: scripts/wiki-to-graph.py is the sibling tool for structure analysis (not validation) — it exports the wiki as a graph (graph.json / graph.graphml) and reports god_nodes (most-connected pages) and bridges (entities joining otherwise-unconnected sources). Useful after a lint pass to spot hubs and weak links; it reads the same relations frontmatter the linter validates.
Python-free fallback
For users on Cowork or any environment without a shell — or any project where python3 / pyyaml / scripts/lint-wiki.py are simply not available — the skill performs frontmatter validation inline.
Trigger the fallback automatically when:
scripts/lint-wiki.pydoes not exist in the project, OR- the Bash tool is not available, OR
- running the script returns a "command not found" error for
python3orpython, OR - the user explicitly says "lint without Python" or "use the inline check"
Tell the user upfront:
"Running wiki-lint in fallback mode (no Python). This checks frontmatter but skips wikilink resolution and orphan detection — those would cost too many tokens on a full wiki scan. For a complete check, install Python+PyYAML and use the
scripts/lint-wiki.pyscript. Recommended for projects above ~20 pages."
Fallback procedure:
- Read
schema/knowledge-frontmatter.schema.jsonfrom the project root. If absent, read the plugin's copy (the plugin ships one). - List every
knowledge/**/*.mdfile (excluding files prefixed_example-). - For each file: parse the YAML frontmatter (the block between the first two
---lines) and validate against:requiredfields exist and are non-emptytypeis one ofentity | concept | source | synthesisstatusis one ofdraft | review | stableauthoris one ofhuman | llm | mixedcreatedandupdatedmatch the ISO date pattern^\d{4}-\d{2}-\d{2}$- if
type: source, thenbibkeyis present - if
wikidata_qidis present, it matches^Q\d+$ - if
idai_gazetteer_idis present, it matches^\d+$
- Report any failures in the same format as the Python script:
MISSING: <path> — required field '<field>' is missing/INVALID: <path> — <field>='<value>' (allowed: …). - Print a status summary: total pages, draft/review/stable distribution.
- Surface open
review_flags— these live in frontmatter, so the fallback can list them cheaply (page,kind,detail). Report count + list, exactly as the script's=== Review flags ===section does; they are advisory (gate drafting, not this check). - Explicitly skip wikilink resolution and orphan detection. State this in the output so the user knows what's not covered.
What the fallback does NOT do:
- Broken-wikilink detection (would need to read every page's body, then cross-reference — O(N²) in tokens).
- Orphan-page detection (same reason).
- Gate-override-rate reporting (the override log lives in the project; the fallback could read it but the Python script's output format is more concise).
If those checks are needed and Python isn't an option, dispatch the wiki-linter subagent (agents/wiki-linter.md) — it has a fresh context budget and can afford the full scan once per session.
Process Flow
digraph lint {
"Locate lint script" [shape=box];
"Run lint-wiki.py" [shape=box];
"Parse output" [shape=box];
"Errors present?" [shape=diamond];
"Fix errors inline" [shape=box];
"Warnings: fix / defer / ignore" [shape=box];
"Orphans: link / delete / mark root" [shape=box];
"Re-run lint" [shape=box];
"Exit 0 on errors?" [shape=diamond];
"Log run summary" [shape=box];
"Done" [shape=doublecircle];
"Locate lint script" -> "Run lint-wiki.py";
"Run lint-wiki.py" -> "Parse output";
"Parse output" -> "Errors present?";
"Errors present?" -> "Fix errors inline" [label="yes"];
"Errors present?" -> "Warnings: fix / defer / ignore" [label="no"];
"Fix errors inline" -> "Warnings: fix / defer / ignore";
"Warnings: fix / defer / ignore" -> "Orphans: link / delete / mark root";
"Orphans: link / delete / mark root" -> "Re-run lint";
"Re-run lint" -> "Exit 0 on errors?";
"Exit 0 on errors?" -> "Fix errors inline" [label="no"];
"Exit 0 on errors?" -> "Log run summary" [label="yes"];
"Log run summary" -> "Done";
}
What lint-wiki.py Checks
(per the template's scripts/lint-wiki.py)
- Frontmatter present + required fields (
title,type,created,updated,status,author) type∈ {entity, concept, source, synthesis}status∈ {draft, review, stable}author∈ {human, llm, mixed}- Dates are ISO (
YYYY-MM-DD) - Wikilinks
[[...]]resolve to existing files - No duplicate page titles within a section
- Orphan detection (pages with zero incoming wikilinks)
- Structured
relationsblocks resolve + the inference-rate (share ofinferred/ambiguousedges) - Open
review_flags(content findings fromsemantic-wiki-review) — surfaced only: advisory, they gatedrafting-manuscript, not the lint exit code - Citekeys and bibliography — every citekey matches the
surname-year-shorttitleconvention (it is a cross-project join key); no key defined twice; everybibkey:and every@citationresolves to a real entry; everybibliography:path a manuscript declares exists (Quarto renders a dead bibliography as???and still exits 0) - The shared library, both directions — advisory, and skipped when no library is configured (CI has none):
- every source page's
bibkeyhas a PDF at<library>/pdf/<bibkey>.pdf - every acquired PDF has a source page — "acquired but NOT ingested". A source that was searched for, downloaded and then forgotten is invisible to every other check: the wiki looks healthy, and drafting has nothing to reach back into. Across 17 live wikis this was true of 146 sources; one project had 48 of its 55 PDFs never ingested. The fix is
ingest-source— the PDFs are already there.
- every source page's
Common Fixes
| Error | Fix |
|---|---|
missing frontmatter field: status | Add status: draft (or proper value) |
broken wikilink: [[finkelstein-2003]] | Either create knowledge/sources/finkelstein-2003.md via ingest-source, or correct the slug |
invalid type: Person | Change to entity (types are: entity, concept, source, synthesis) |
created is not ISO date | Reformat to YYYY-MM-DD |
orphan: knowledge/entities/foo.md | Add an incoming link from a relevant source/synthesis page |
Red Flags
| Thought | Reality |
|---|---|
| "Lint is bureaucracy, skip it" | SOFT-GATE before drafting and finishing. The override gets logged. |
| "I'd notice broken wikilinks while reading" | No — when rendered they vanish silently. They're only visible to the linter. |
| "Orphans are fine, just internal notes" | Orphan means unreachable. Link them in or delete them. |
| "I can ignore all warnings" | Every warning needs a decision, not silence. |
Key Principles
- Fail loud, fix fast — errors block, warnings demand a decision
- One lint run = one log entry — traceability
- Orphans are a smell — often a sign of missing synthesis
- Lint BEFORE draft — never after the fact
- Subagent for bulk fixes — don't burn the main context on large wikis
示例提示词
帮我检查知识库里有没有断链、孤立页面或元数据缺失的问题。
所属插件
安装该插件会一并获得同领域的 62 个 Skill / MCP。
同插件的其他科研 Skill
- 学术文献获取下载Auto-downloads open-access PDFs for graded sources and writes a manual worklist for paywalled items. Use after literature-review, before ingest-source.
- 单篇文献入库管理Adds one verified PDF to a shared bibliography library, computing its citation key and keywords. Use to register a single document outside the full workflow.
- 数字人文计算方法Surveys computational DH methods: text mining, NLP, corpus linguistics, archive standards, GIS, network analysis, and OCR. Use for an overview of available DH tools.
- 考古地理信息系统分析Runs archaeological GIS analysis with GeoPandas: catchment analysis, viewshed, kernel density, spatial statistics. Use for mapping archaeological site locations.
- 论证结构提取可视化Extracts and visualizes argument structure: Toulmin reconstruction, support/attack graphs, circularity detection. Use to diagram an argument’s logical structure.
- 考古遗物类型学分析Performs artifact analysis: typological classification, ceramic attribute coding, lithic reduction analysis. Use when classifying excavated artifacts statistically.
- 引文与出处核查Checks citations, quotations, page numbers, and bibliography entries for accuracy and source fit. Use before submission to verify source-supported claims.
- 研究选题构思设计Explores research intent, field state, methodology, and ethics, then writes an approved design doc. Use before starting a new research question or chapter.
- 术语译名一致性检查Audits a manuscript for terms, translations, abbreviations, and names whose forms must stay stable. Use when terminology drift could undermine an argument.
- 计算语用学分析Runs computational pragmatics: speech act classification, implicature detection, discourse coherence, politeness analysis. Use for language-use-and-meaning studies.
- 文献综述学术对话构建Turns verified sources into a structured scholarly conversation among positions, not a chronological summary. Use when synthesizing literature into a debate narrative.
- 语料库语言学分析Performs corpus analysis with NLTK/spaCy: collocation, keyword analysis, KWIC concordance, word2vec, diachronic trends. Use for quantitative text-corpus research.
- 数字档案馆资源检索Queries digital archive REST APIs: Europeana, Chronicling America, Internet Archive, HathiTrust, DPLA, OAI-PMH. Use when searching or harvesting heritage metadata.
- 学术手稿章节撰写Drafts a chapter or article section by section from synthesized wiki content, agreeing each section’s argument first. Use to turn stable research synthesis into prose.
- 研究项目漂移状态检测Checks a shared source library and registered projects for drift: un-indexed PDFs, unmerged keywords, bibkey collisions. Use to audit a multi-project research setup.
- EMI课堂语料转写分析Segments and annotates classroom transcripts, coding language choice and discourse function with anonymised output. Use to quantify classroom talk or translanguaging.
- 人工智能伦理分析Analyzes AI ethics: algorithmic fairness metrics, bias auditing, value alignment, moral philosophy reasoning. Use to evaluate an AI system’s ethical dimensions.
- 研究计划任务执行Executes a ready research plan task by task, gating acquisition before ingest and dispatching analysis. Use after writing-research-plan to run the planned work.
- 研究项目结项清单Runs the final completion checklist: rendering, bibliography, wiki, data, reproducibility, archiving. Use when a manuscript is finalized and ready to publish.
- 形式逻辑自动推理Applies formal logic tools: Z3 SMT solver, modal logic S5, SAT encoding, Lean4 proof verification. Use to formalize or mechanically check a logical argument.
- 研究问题凝练构建Turns a broad topic or intuition into a precise, contestable, researchable question. Use at the start of a project when no defensible question yet exists.
- 历史地理信息系统分析Performs historical GIS work: georeferencing old maps, digitizing boundaries, temporal territory overlays, population interpolation. Use for historical spatial analysis.
- 历史语言学比较分析Analyzes historical linguistics in Python: sound correspondences, cognate detection, phylogenetic trees, Swadesh lists. Use when reconstructing language relationships.
- 历史社会网络分析Builds historical network analyses: correspondence networks, prosopography, temporal community detection, Gephi export. Use to map relationships among historical actors.
常见问题
知识库结构校验能做什么?
Validates a wiki’s structural integrity: frontmatter completeness, broken links, orphaned pages, status. Use before drafting or finishing to catch structural errors。
如何安装知识库结构校验?
在科搭 Codar 左侧点击「插件」,在「组件」页签搜索「知识库结构校验」并安装;在 Claude Code 或 Codex 中可以发送本页的安装提示词,或下载 Skill 包后解压到 ~/.claude/skills 或 ~/.codex/skills。
知识库结构校验需要哪些权限?
该科研 Skill没有声明额外权限;执行具体操作时仍由 Agent 按自身规则请求确认。
知识库结构校验经过官方审核吗?
是。SpeedSkills 收录的每个版本都会记录内容摘要与权限声明,当前版本已通过安全审核。