科研 Skill
知识库图谱构建查询
wiki-graph
Builds and queries a knowledge wiki as a graph, exporting a visualization plus neighbor, path, and bridge queries. Use to analyze the structure of project knowledge.
SKILL.md
Wiki Graph
Make the implicit wiki graph explicit, then answer structure questions from it. This is the structure-analysis sibling of two other wiki skills:
wiki-lint— is the wiki well-formed? (frontmatter, broken links, orphans)semantic-wiki-review— are the claims sound and consistent? (LLM content audit)wiki-graph— what shape does the knowledge have? (hubs, bridges, clusters, confidence)
The graph is computed deterministically by scripts/wiki-to-graph.py; this skill runs it and interprets the result. It never invents edges — every claim about the graph traces back to graph.json.
Announce at start: "Using wiki-graph to build and analyse the knowledge graph."
When to use
- "Build / show me a knowledge graph", "map the wiki", "graph view of my research"
- "Which entity bridges / connects my sources?" → bridges
- "What are the main themes / sub-topics / clusters in my literature?" → communities
- "What are the most central / connected pages?" → god nodes
- "Find surprising connections" / "where are the weak links or gaps?"
- "How many relations are inferred vs grounded?" → inference-rate
- "Export the wiki to Gephi / yEd" → hand over
graph.graphml - After a bulk ingest or a
wiki-lintpass, to see how the structure changed
NOT for: frontmatter/wikilink validation (use wiki-lint), contradiction/claim audit (use semantic-wiki-review), or drafting prose (use drafting-manuscript).
Checklist
- Locate the script —
scripts/wiki-to-graph.pyin the project root (from the template). If it is missing, offer to copy it from the template (or scaffold the project); if Python/PyYAML are unavailable, take the fallback below. - Lint first (recommended) — broken wikilinks become dangling edges and skew the picture. If
wiki-linthas not run recently, suggest it; note any override. - For a targeted question — query the live graph (recomputed from the
.mdon each call, so always current; deterministic — do not eyeball JSON):python scripts/wiki-to-graph.py neighbors <slug> [--depth N] [--relation TYPE]… path <a> <b>— shortest connection between two pages… god-nodes [--top-n N]·… bridges·… communities [--min-size N]·… stats·… reportcommunitiesare labelled with their most-connected member's title (deterministic, no LLM);reportprints the fullGRAPH_REPORT.mdto stdout… relations [--type cites|contradicts|builds-on|…] [--confidence inferred] [--node <slug>]… timeline <slug>— the sources around one page (usually a concept or a synthesis) in publication order, each with its typed stance toward the page and toward the earlier sources in the list; ends with aSuperseded by:line when a source says the position no longer stands. Use it for "how did the debate on X develop", "who answered whom", "is this still the state of research"… search <term>— find a node by id/title- Node tokens may be a unique substring (fuzzy-resolved); add
--jsonto any query for machine-readable output.
- For an overview or the visual — build the exports —
python scripts/wiki-to-graph.pywritesgraph.html(interactive, self-contained),graph.json,graph.graphml, andGRAPH_REPORT.mdintoknowledge/_meta/graph/.GRAPH_REPORT.mdis a deterministic prose summary (overview, god nodes, bridges, labelled communities, asserted relations, suggested questions) — the static, git-diffable sibling ofgraph.html; hand it to the user for a no-browser read, or get just the text on stdout withpython scripts/wiki-to-graph.py report. - Answer grounded in the output (query result or
graph.json— see "Reading the output"); never from memory. With no specific question, give the overview: god nodes, bridges, inference-rate, dangling/orphan signal. - Be honest about confidence and gaps (see "Honesty rules"). If the user asks about a connection that is not in the graph, say so — and offer to add a
relationsentry or a wikilink rather than asserting it. - Offer the viz — for an interactive look, point the user to
knowledge/_meta/graph/graph.html(opens in any browser, no install; filter/search/click). For heavy layout or community detection,graph.graphmlopens in Gephi/yEd. - Persist an insight (optional, with consent) — if the analysis yields a standalone finding the user wants to keep, write a
knowledge/synthesis/<slug>.mdpage withstatus: draft,author: llm. Never self-promote toreview/stable. - Log the run in
knowledge/_meta/log.md: date,graph, question (or "overview"), node/edge counts, headline finding.
MCP shortcut: if the project registers the wiki-graph MCP server (via .mcp.json → scripts/graph_mcp.py), call its graph_neighbors / graph_path / graph_god_nodes / graph_bridges / graph_communities / graph_relations / graph_timeline / graph_search / graph_stats tools directly instead of the Bash CLI. It is the same engine (the tools shell out to wiki-to-graph.py --json), so results are identical and equally live.
Process Flow
digraph wiki_graph {
"Locate script" [shape=box];
"Script available?" [shape=diamond];
"Fallback: manual read" [shape=box];
"Lint recommended" [shape=box];
"Build graph (run script)" [shape=box];
"Read graph.json" [shape=box];
"Specific question?" [shape=diamond];
"Answer question from data" [shape=box];
"Overview: god_nodes + bridges + inference-rate" [shape=box];
"Persist insight?" [shape=diamond];
"Write synthesis page (status: draft)" [shape=box];
"Log run" [shape=box];
"Done" [shape=doublecircle];
"Locate script" -> "Script available?";
"Script available?" -> "Fallback: manual read" [label="no"];
"Script available?" -> "Lint recommended" [label="yes"];
"Fallback: manual read" -> "Specific question?";
"Lint recommended" -> "Build graph (run script)";
"Build graph (run script)" -> "Read graph.json";
"Read graph.json" -> "Specific question?";
"Specific question?" -> "Answer question from data" [label="yes"];
"Specific question?" -> "Overview: god_nodes + bridges + inference-rate" [label="no"];
"Answer question from data" -> "Persist insight?";
"Overview: god_nodes + bridges + inference-rate" -> "Persist insight?";
"Persist insight?" -> "Write synthesis page (status: draft)" [label="yes"];
"Persist insight?" -> "Log run" [label="no"];
"Write synthesis page (status: draft)" -> "Log run";
"Log run" -> "Done";
}
Reading the output
graph.json has stats, nodes, edges, god_nodes, bridges.
- god_nodes — pages ranked by total degree (incident edges). The most-connected pages. High degree signals a hub, not automatically importance — a generic entity can rack up links. Read it as "where the wiki converges", then judge.
- bridges — entities that join ≥2 source clusters which share no other entity. These are the load-bearing connectors: remove one and parts of the literature fall apart. Often the most analytically interesting nodes.
- edges — each has
relation_type(wikilinkfor plain links;cites/contradicts/builds-on/ … for typedrelations),confidence, an optionalbecauserationale, andweight(how many times a wikilink recurs). Filter byrelation_typeto answer e.g. "show me the contradictions"; thebecausetext explains why an edge exists. - stats.relations_total / relations_inferred_or_ambiguous — the inference-rate. A high share means many edges are model-asserted rather than grounded in the sources; surface this honestly (it mirrors the SOFT-GATE override-rate as an audit signal).
- stats.dangling — edges pointing to non-existent pages were dropped. A non-zero count means the wiki references things it hasn't ingested → route to
wiki-lint/ingest-source.
Honesty rules
- No invented edges. Only report connections present in
graph.json. If asked about a link that isn't there, say it isn't — don't infer it into existence in your answer. - Flag inferred/ambiguous edges when they carry an argument. Don't present an
inferredrelation as if it wereextracted. - Degree ≠ importance. Name what high degree actually means (hub of links) and let the user judge significance.
- Don't write to
input/. Insights go toknowledge/synthesis/(with consent), never into the immutable input layer. - Don't self-promote. Any synthesis page you create is
status: draft; only the user promotes.
Python-free fallback
If python3 / pyyaml / the script are unavailable (e.g. Cowork without a shell):
- Do a best-effort manual read: list the wiki pages, and for a small wiki count incoming wikilinks per page to approximate god nodes.
- State the limitation clearly: bridges and the inference-rate are impractical to compute by hand and are not reported in fallback mode.
- Recommend installing Python + PyYAML (or running the script elsewhere) for the full analysis, and hand over
graph.graphmlonce it can be generated.
Never fake precise counts in fallback mode — approximate, and say so.
示例提示词
帮我把这个研究项目的知识库导出成交互式图谱并查找关键桥接节点。
所属插件
安装该插件会一并获得同领域的 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.
常见问题
知识库图谱构建查询能做什么?
Builds and queries a knowledge wiki as a graph, exporting a visualization plus neighbor, path, and bridge queries. Use to analyze the structure of project knowledge。
如何安装知识库图谱构建查询?
在科搭 Codar 左侧点击「插件」,在「组件」页签搜索「知识库图谱构建查询」并安装;在 Claude Code 或 Codex 中可以发送本页的安装提示词,或下载 Skill 包后解压到 ~/.claude/skills 或 ~/.codex/skills。
知识库图谱构建查询需要哪些权限?
该科研 Skill没有声明额外权限;执行具体操作时仍由 Agent 按自身规则请求确认。
知识库图谱构建查询经过官方审核吗?
是。SpeedSkills 收录的每个版本都会记录内容摘要与权限声明,当前版本已通过安全审核。