wiki-stats
Produce a statistics and health dashboard for a markdown wiki folder, covering page counts by type, link density, hub and orphan pages, recent activity from log.md, and source coverage. Read-only. Use when asked how big or how healthy a wiki is, or what to work on next.
- License 许可
- MIT
- 最近更新
- 2026-11-09
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- wiki-stats
- description
- Produce a statistics and health dashboard for a markdown wiki folder, covering page counts by type, link density, hub and orphan pages, recent activity from log.md, and source coverage. Read-only. Use when asked how big or how healthy a wiki is, or what to work on next.
03 SKILL.md 正文
Wiki Stats
When to use
Use this skill when the user asks how large the wiki is, how connected it is, what changed
recently, or what to work on next. It only reads files and never edits the wiki. It needs a
folder of markdown pages; log.md, raw/, and frontmatter are used when present and
skipped when absent.
Steps
-
Locate the wiki root. Use
wiki/if it exists, otherwise the folder the user named. SetWIKIto that path. If a siblingraw/folder exists, setRAWto it. -
Count pages by type. Prefer the frontmatter
typeand fall back to the parent folder:for f in $(find "$WIKI" -name '*.md' -not -name 'index.md' -not -name 'log.md' -not -name 'overview.md'); do t=$(sed -n '/^---$/,/^---$/p' "$f" | awk -F': *' '$1=="type"{print $2; exit}') echo "${t:-$(basename "$(dirname "$f")")}" done | sort | uniq -c | sort -rn -
Measure link density. Count wikilinks per page and overall:
total=$(grep -rhoE '\[\[[^]]+\]\]' "$WIKI" --include='*.md' | wc -l | tr -d ' ') pages=$(find "$WIKI" -name '*.md' -not -name 'index.md' -not -name 'log.md' | wc -l | tr -d ' ') echo "links=$total pages=$pages avg=$(awk "BEGIN{printf \"%.1f\", $total/($pages?$pages:1)}")"If the wiki uses standard markdown links, count
](...*.md)instead. -
Find hubs and orphans. Rank pages by inbound links:
for f in $(find "$WIKI" -name '*.md' -not -name 'index.md' -not -name 'log.md'); do stem=$(basename "$f" .md) n=$(grep -rlF "[[$stem" "$WIKI" --include='*.md' | grep -v "index.md" | grep -vc "/$(basename "$f")$") printf '%s\t%s\n' "$n" "$stem" done | sort -rn > /tmp/wiki-inbound.tsv head -5 /tmp/wiki-inbound.tsv # hubs awk -F'\t' '$1==0' /tmp/wiki-inbound.tsv # orphans -
Summarize recent activity from
log.mdif it exists. Entries follow## [ISO-timestamp] operation | title:grep -E '^## \[' "$WIKI/log.md" | sed -E 's/^## \[[^]]+\] ([a-z-]+).*/\1/' | sort | uniq -c | sort -rn grep -E '^## \[' "$WIKI/log.md" | tail -5Report operations by type, the five most recent entries, and days since the last
ingestentry. -
Check source coverage when
RAWis set. Every raw file should have a summary page:find "$RAW" -type f -not -path '*/assets/*' | wc -l find "$WIKI/sources" -name '*.md' 2>/dev/null | wc -lCompute coverage as summaries divided by raw files. List raw files whose stem does not appear anywhere under
$WIKI/sources/. -
Present the dashboard with these sections in order: Page Counts, Link Health, Top Hubs, Orphans, Recent Activity, Source Coverage, Suggested Next Steps. Keep each section short. Base the suggestions on the numbers: un-ingested sources suggest ingesting them, orphans suggest cross-referencing or pruning, a long gap since the last ingest suggests finding new sources, and low link density suggests running
lint-wiki.
What good output looks like
Wiki stats for wiki/
Page Counts 42 pages — 18 entities, 15 concepts, 7 sources, 2 comparisons
Link Health 203 wikilinks, 4.8 per page, 0 broken
Top Hubs acme-corp (14), retrieval-latency (9), vector-databases (8)
Orphans 2 — old-pricing-model, meeting-2025-03-notes
Recent Activity 31 ingest, 12 query, 4 lint; last ingest 3 days ago
Source Coverage 7 of 9 raw files summarized (78%) — missing: q3-report.pdf, podcast-ep-12.md
Next: ingest the 2 uncovered sources, then run lint-wiki to link the 2 orphans.
When a command fails
grep: log.md: No such file: there is no log. Skip the Recent Activity section and say so.find: raw: No such file: no raw folder. Skip Source Coverage and say so.- Division shows
avg=0.0with a nonzero page count: the wiki uses markdown links, not wikilinks. Recount withgrep -rhoE '\]\([^)]+\.md\)'. - Filenames with spaces break the
for f in $(find ...)loops. Rerun withfind "$WIKI" ... -print0 | while IFS= read -r -d '' f; do ...; done.
04 同仓库更多 Skills
reindex
Rebuild the index.md of a markdown wiki folder from the pages on disk, grouped by page type and sorted by title, and verify that every wikilink resolves. Use when the index is stale, missing, or out of order, or after pages were renamed or moved.
lint-wiki
Health-check a markdown wiki folder (an LLM Wiki or any folder of interlinked .md pages). Finds broken wikilinks, orphan pages, pages missing from the index, and malformed frontmatter, fixes the mechanical issues, and reports the rest. Use when asked to lint, audit, or health-check a wiki, or after a batch of ingestions.