/wiki-skills:wiki-initfrom wiki-skills
Bootstraps a new LLM-maintained wiki for any knowledge domain — research, codebase documentation, reading notes, or competitive analysis. Guides setup of directory structure, link style, and config.
Ships in wiki-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Bootstrap a new LLM-maintained wiki at a user-specified path.
Check whether a SCHEMA.md already exists nearby. If yes, ask the user if they want to reinitialize or just continue with the existing wiki.
Ask:
Where should the wiki live? (absolute path, e.g. ~/wikis/ml-research)
What is the domain/purpose? (one sentence)
What types of sources will you add? (papers, URLs, code files, transcripts, etc.)
What categories should index.md use?
Sources | Entities | Concepts | AnalysesModules | APIs | Decisions | Flows — see codebase.md in this skill's directory for detailed codebase guidanceHow will you primarily browse this wiki?
[[wiki-link]]-aware viewer) — uses [[slug]] syntax[[slug](pages/slug.md)] syntaxThe choice is recorded in SCHEMA.md as link_style: obsidian or link_style: markdown and applied by every other wiki skill.
<wiki-root>/
├── SCHEMA.md ← conventions + absolute path (how other skills find the wiki)
├── config/
│ └── link-style.md ← cross-reference emit/parse rules (copied from this skill)
├── .gitignore ← local-only / generated artifacts (audit reports, index) excluded from version control
├── bin/ ← helper scripts (copied verbatim from this skill's assets/bin/)
│ ├── generate-index.py ← regenerates wiki/index.md from page frontmatter (stdlib only)
│ ├── render-log.py ← renders the operation log from git history (stdlib only)
│ ├── check-contradictions.py ← pre-commit gate: blocks staged pages flagged as contradicting
│ ├── lint-mechanical.py ← deterministic lint checks; full mode (JSON for wiki-lint) + --staged gate
│ └── hooks/pre-commit ← tracked git hook chaining both gates (wired via core.hooksPath)
├── raw/ ← immutable source documents (you add these, LLM never modifies)
├── wiki/
│ ├── index.md ← GENERATED catalog (gitignored) — never hand-edit; run bin/generate-index.py
│ ├── log.md ← operation log — ONLY for non-git wikis (git wikis use git history)
│ ├── overview.md ← evolving synthesis of everything known
│ └── pages/ ← all wiki pages, flat, slug-named (NO subdirectories)
└── assets/ ← downloaded images, PDFs, attachments
Critical: wiki/pages/ is flat. All pages live here as <slug>.md. No subdirectories. Slugs are lowercase, hyphen-separated.
Copy the chosen link-style rule file into the wiki:
config/link-style-obsidian.md to <wiki-root>/config/link-style.md.config/link-style-markdown.md to <wiki-root>/config/link-style.md.Only one file is copied — the chosen one — and it is renamed to link-style.md in the wiki. Every other wiki skill reads from <wiki-root>/config/link-style.md to know how to emit and parse cross-references.
Ensure <wiki-root>/.gitignore excludes generated and local-only artifacts (audit
reports and the generated index) — if the wiki is or later becomes a git repo, this keeps
disposable artifacts out of version control. Do not clobber an existing .gitignore
— a reinitialized wiki, or a wiki root nested in an existing git repo, may already have
one:
<wiki-root>/.gitignore does not exist, create it with the block below.# Audit reports are regenerated local-only artifacts (wiki-audit). The committed record
# of an audit is the `review:` frontmatter token on the audited page, not the report.
wiki/pages/audit-*.md
# index.md is generated from page frontmatter by bin/generate-index.py — a runtime
# artifact, regenerated on demand. The source of truth is each page's frontmatter.
wiki/index.md
This is the same create-or-append discipline wiki-audit uses to self-heal (Task 4).
SCHEMA.md# Wiki Schema
## Identity
- **Path:** <absolute path to wiki-root>
- **Domain:** <user's domain description>
- **Source types:** <list>
- **Created:** <YYYY-MM-DD>
## Page Frontmatter
Every wiki page must start with:
---
title: <page title>
category: <one of the Index Categories below>
summary: <one-line description — becomes this page's index entry>
tags: [tag1, tag2]
sources: [source-slug1]
created: YYYY-MM-DD
updated: YYYY-MM-DD
---
`category` and `summary` drive index generation (see **Index Generation** below);
`category` must match one of the wiki's Index Categories. `created` is set once when the
page is first written and never changes; `updated` bumps on every edit.
## Cross-References
- **link_style:** <obsidian | markdown — the user's choice from step 1, question 5>
- **link_style_rules:** config/link-style.md
- See `config/link-style.md` for the exact emit and parse rules. Every wiki skill
reads that file to decide how to write new cross-references and how to scan
existing ones.
## Concept Identity
The slug **is** the concept's identity — there is no separate id. A concept is the
page at `wiki/pages/<slug>.md`; everything that links to it uses `[[slug]]`. This only
works if the link graph is trustworthy, so two rules hold everywhere links are written:
1. **Links are verified, never invented.** Before writing any `[[slug]]`, the slug must
resolve to an existing `wiki/pages/<slug>.md` **or** to a page being created in the
same operation. List the existing page set first (`ls wiki/pages/`); never emit a
link to a slug you have not confirmed. A `[[slug]]` that resolves to nothing is a
hallucinated link — the failure this discipline exists to prevent.
2. **Homonyms get qualified slugs.** When a new concept collides with an existing slug
for a *different* sense, qualify both with a discriminator rather than overloading
one page:
- `mercury-planet` / `mercury-element` / `mercury-mythology`
- `transformer-ml` / `transformer-electrical`
Pick the narrowest discriminator that disambiguates. `wiki-lint` warns when slugs
sharing a base token look like an unintended collision.
Consolidating two pages that turn out to be the same concept (merge), or separating one
overloaded page into qualified pages (split), is the job of the `wiki-merge` skill.
## Citations
Cite every non-common-knowledge factual claim. "Common knowledge" = uncontroversial,
undergraduate-level facts in this wiki's domain. Granularity is paragraph or claim,
never per-sentence. If you cannot produce a citation in one of the forms below,
find one, weaken the claim, or drop it.
Format: Markdown footnotes. Two citation kinds, three valid targets.
The slug-target form below follows the `link_style` declared above; the examples
shown here use that style.
**Quote citation** (preferred):
The model uses 8 attention heads.[^1]
[^1]: [[attention-is-all-you-need]] §3.2.2 L142-143 — "We employ h = 8 parallel attention layers" [^1]: [[attention-is-all-you-need](pages/attention-is-all-you-need.md)] §3.2.2 L142-143 — "We employ h = 8 parallel attention layers" ```Synthesis citation (when no single quote captures the claim):
The architecture is fundamentally an encoder-decoder with attention.[^2]
<if link_style: obsidian>
[^2]: [[attention-is-all-you-need]] §3.2-3.4 [synthesis] L138-202 — encoder, decoder, and
attention sections together describe the full multi-head architecture
<if link_style: markdown>
[^2]: [[attention-is-all-you-need](pages/attention-is-all-you-need.md)] §3.2-3.4 [synthesis] L138-202 — encoder, decoder, and
attention sections together describe the full multi-head architecture
L142-143 / L138-202 are line ranges in the raw source file. For a quote they mark
the lines the quote is taken from; for a synthesis they mark the block being summarized.
Three rules for every footnote:
The cited target is one of three forms:
link_style (preferred for sources you've ingested via wiki-ingest)raw/<file> or assets/<file> — a path to a local file (for drive-by
citations where a synthesis page isn't worth creating)<URL> — a live URL, tweet, or ephemeral source (no local copy required)Never cite entity, concept, or analysis pages — those are syntheses, not sources.
A locator is present. Always a semantic locator: §<section>, p.<n>,
[HH:MM:SS] for transcripts, URL anchor for web, or (YYYY-MM-DD) for dated posts.
Plus a line-range when the source is text-addressable. If the resolved raw file is markdown, plaintext, code, or cached HTML, append a line-range token after the semantic locator:
L<start>-<end> — a range, e.g. L142-145L<n> — a single line, e.g. L142L142-145,L201-203 — disjoint rangesThe line range refers to lines in the raw source file resolved from the target
([[slug]] → its **Source:** raw path; or a direct raw/<file>/assets/<file>).
raw/ is immutable, so these line numbers are stable references.
A line-range is required for text-addressable sources and applies to BOTH
citation kinds — a [synthesis] footnote marks the block it summarizes with L…
just as a quote marks the lines it quotes. Exempt (semantic locator only, no
L…): PDFs, transcripts, and live URLs with no local cached copy.
Either a verbatim quote, or the [synthesis] tag plus a description of
what the cited range supports. No third option.
Drive-by citation examples:
[^3]: raw/scaling-laws.pdf p.7 — "loss scales as a power law in compute"
[^4]: https://twitter.com/user/status/123 (2026-04-15) — "<tweet text>"
wiki-audit strong runs a second-opinion pass with a different-provider model and
stamps the audited page with an optional review: frontmatter block:
review:
model: codex # gemini | claude-sonnet
provider: openai # google | anthropic
date: YYYY-MM-DD
status: clean # or: disputed
findings: 2 # present only when status: disputed
status: clean — the reviewer surfaced no disagreement with the normal audit.status: disputed — the reviewer flagged overreach or a contradiction the normal
audit missed; findings: carries the count. The detail lives in the (local-only)
audit report.provider: anthropic (the claude-sonnet fallback) means no different-provider CLI
was available, so the check is same-provider and weaker.This block is optional and is added only by wiki-audit strong. Pages never need it to
be valid.
wiki-ingest runs a cheap contradiction check on the pages each ingest touches, before it
commits. It is a gate, not an annotation: every page that lands in git is clean.
wiki-lint sweep.contradiction-check: failed — <one-line reason naming the counterpart [[slug]] or "internal">
The machine-readable token is the literal contradiction-check: failed. It exists ONLY
while the conflict is unresolved; resolving the conflict removes the line. A committed
page never carries it — there is no passed stamp, no severity history, nothing. Absence
of the flag is the only "clean" state.This flag is also what the Pre-commit Gate below scans staged files for.
On a git wiki, bin/hooks/pre-commit (installed by wiki-init via
git config core.hooksPath bin/hooks) runs two deterministic gates before every commit —
no LLM:
bin/check-contradictions.py — scans the staged content of wiki/pages/*.md,
frontmatter only, and blocks the commit if any page still carries a
contradiction-check: failed flag. Backstop to the skill-level hold in wiki-ingest
step 7b; on a healthy wiki it never fires. Resolve the contradiction and remove the
contradiction-check: line, then re-stage.bin/lint-mechanical.py --staged — scans the staged pages for structural
problems and blocks the commit on any: missing required frontmatter, a broken
[[link]], or a slug collision (a bare slug clashing with a qualified one). Fix the page
and re-stage.core.hooksPath is repo-local config and is not cloned — re-run
git config core.hooksPath bin/hooks once after cloning.git commit --no-verify.Operations: init, ingest, query, update, lint, audit, merge, split
Git wiki — the git history is the operation log. After an operation, the skill
suggests a commit message and commits on your confirmation (skills never auto-commit).
Render the human log on demand with python bin/render-log.py.
The suggested subject line follows the repo's commit convention:
Detect an existing convention first — scan recent git log and any .gitmessage,
commitlint config, or CONTRIBUTING.md. If the repo already has a subject style,
follow it.
Default to Conventional Commits when none is found, choosing the type by operation:
| Operation | Type |
|---|---|
| init | chore |
| ingest | docs |
| update | docs |
| query (saved) | docs |
| lint | fix if fixes applied, else chore |
| audit | fix if fixes applied, else chore |
| merge / split | refactor |
Always append a Wiki-Op: trailer, whatever the subject style — it is what
render-log.py keys on, decoupling the log from the subject convention. Which pages
changed is read from the commit diff, so no Pages: trailer is needed.
docs: summarize Attention Is All You Need
Wiki-Op: ingest
Non-git wiki — fallback to wiki/log.md. Append one entry per operation:
## [YYYY-MM-DD] <operation> | <title>.
wiki/index.md is a generated, gitignored artifact — never hand-edit it. It is rebuilt
from page frontmatter by bin/generate-index.py:
python bin/generate-index.py (or python3) before reading the index, and
after any operation that adds, removes, renames, or re-categorizes a page.category frontmatter, in the order categories are
listed under Index Categories below; within a category it lists pages newest-first
by created. Each entry is - [[slug]] — summary _(created)_.audit-*.md are excluded (gitignored local-only
artifacts). A page with an unrecognized or missing category lands in an
Uncategorized section.<one per line, matching the user's chosen taxonomy>
config/link-style.md —
every skill reads it before writing or scanning linkscontradiction-check: failed flag, removed before commit — committed pages are always clean (see Contradiction Check)git config core.hooksPath bin/hooks after a fresh clone
### 4. Install the `bin/` helper scripts and generate the index
The wiki ships four stdlib-only helper scripts (no dependencies) plus a tracked git hook.
They are **bundled with this skill** at `assets/bin/` — copy them verbatim into
`<wiki-root>/bin/` (do not retype or regenerate them). From this skill's directory:
```sh
mkdir -p <wiki-root>/bin/hooks
cp assets/bin/generate-index.py <wiki-root>/bin/
cp assets/bin/render-log.py <wiki-root>/bin/
cp assets/bin/check-contradictions.py <wiki-root>/bin/
cp assets/bin/lint-mechanical.py <wiki-root>/bin/
cp assets/bin/hooks/pre-commit <wiki-root>/bin/hooks/
chmod +x <wiki-root>/bin/*.py <wiki-root>/bin/hooks/pre-commit
What each one does:
bin/generate-index.py — wiki/index.md is generated from page frontmatter, never
hand-written, so it can never drift from reality. After copying, run it once
(python bin/generate-index.py) so a valid index.md exists.bin/render-log.py — renders the operation log from git history on demand (see the
Operation Log & Commit Convention in SCHEMA.md). Harmless on a non-git wiki — it
just reports that the log lives in log.md.bin/check-contradictions.py — a pre-commit gate (see the Pre-commit Gate and
Contradiction Check sections in SCHEMA.md). It blocks a commit that stages a
wiki/pages/ file still carrying P8's contradiction-check: failed flag. Deterministic,
no LLM. Harmless on a non-git wiki — it no-ops.bin/lint-mechanical.py — the deterministic health checks, two modes. Full mode
(python bin/lint-mechanical.py) emits JSON for wiki-lint's Phase 1 (broken links,
orphans, missing frontmatter, slug collisions, stale-date, missing-concept) plus the
tag-cluster list for its contradiction sweep. Staged mode (--staged) is the second
pre-commit gate: it blocks a commit whose staged pages have missing frontmatter, a broken
link, or a slug collision. No LLM; no-ops outside a git work tree.bin/hooks/pre-commit — the tracked git hook that chains both gates
(check-contradictions.py, then lint-mechanical.py --staged) via uv run (so an
interpreter is guaranteed). It is wired up in step 5.How operations are logged depends on whether the wiki is a git repo. Offer to run
git init if it isn't one already — the git-history log is the better path.
log.md. First install the pre-commit gates
(contradiction flag + structural validity): make the hook executable and point git at the
tracked hooks directory —
chmod +x bin/hooks/pre-commit
git config core.hooksPath bin/hooks
The hook is tracked (committed below), but core.hooksPath is repo-local config that does
not survive a fresh clone — tell the user to re-run the git config line after
cloning. Then suggest the initial commit and make it on the user's confirmation:
chore: initialize <domain> wiki
Wiki-Op: init
wiki/log.md as the fallback operation log:
# Wiki Log
Append-only fallback log (this wiki is not a git repo). Format:
`## [YYYY-MM-DD] <operation> | <title>` — recent: `grep "^## \[" log.md | tail -10`
---
## [<today>] init | <domain>
wiki/overview.md---
title: Overview
tags: [overview, synthesis]
sources: []
updated: <today>
---
# <Domain> — Overview
> Evolving synthesis of everything in the wiki. Updated by wiki-ingest when sources shift the understanding.
## Current Understanding
*No sources ingested yet.*
## Open Questions
*Add questions here as they arise.*
## Key Entities / Concepts
*Populated as pages are created.*
Tell the user:
<path><obsidian | markdown> — see config/link-style.md for the rule. To switch later, replace that file with the other variant from this skill's config/ directory and update link_style: in SCHEMA.md. Existing pages will not be auto-converted.raw/ manually, or run wiki-ingest directly with a URL or file pathwiki-lint periodically to keep the wiki healthypython bin/render-log.pySCHEMA.md is how all other skills locate this wiki — do not move or delete itassets/bin/check-contradictions.py (opens in a new tab)assets/bin/generate-index.py (opens in a new tab)assets/bin/hooks/pre-commit (opens in a new tab)assets/bin/lint-mechanical.py (opens in a new tab)assets/bin/render-log.py (opens in a new tab)codebase.md (opens in a new tab)config/link-style-markdown.md (opens in a new tab)config/link-style-obsidian.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
7 skills in this plugin
/wiki-auditUse when fact-checking a single wiki page against its cited sources — verifies that every footnote actually supports its claim and surfaces uncited factual claims. Run after ingesting a high-stakes page or any time you want confidence in one page's accuracy./wiki-ingestUse when adding a new source to a wiki — a paper, article, URL, file, transcript, or any document. One ingest may touch 10-15 wiki pages./wiki-lintUse when auditing a wiki for health issues — contradictions between pages, orphan pages, broken cross-references, stale claims, missing pages, or coverage gaps. Run after every 5-10 ingests./wiki-mergeUse when two wiki pages turn out to be the same concept under different slugs (merge), or one page overloads several distinct senses of a term and should be separated into qualified slugs (split). Often run on a wiki-lint "merge candidate" or "colliding slug" finding./wiki-queryUse when asking a question against a personal wiki built with wiki-init and wiki-ingest. Do not answer from general knowledge — always read the wiki pages first./wiki-updateUse when revising existing wiki pages because knowledge has changed, a new piece of information updates or contradicts existing content, or the user wants to directly edit wiki content with LLM assistance.npx claudepluginhub kfchou/wiki-skills --plugin wiki-skillsOther plugins' skills for the same job