wiki-init
Use this skill to initialize or migrate a repo into the wiki + QMD + agent hook pattern.
The user may use natural language. Route intent like this:
- "como esta a estrutura?", "preciso migrar?", "doctor", "qmd esta ok?" -> run .
- "instala", "prepara esse repo", "configura hooks" -> run as dry-run first, then ask the user to confirm the suggested wiki location and index before .
- "migrar para o formato novo" -> run as dry-run first, then ask the user to confirm the suggested wiki location and index before .
- "corrigir qmd", "managed qmd", "patch qmd" -> run , then use or with explicit approval to prepare the managed QMD checkout and wrappers.
Project root
All paths in this skill (
,
,
,
, hook scripts, etc.) are relative to the
project root passed via
, not the agent's current working directory.
- Always pass
--project <absolute-or-relative-path>
to the script — it does not fall back to CWD silently.
- The QMD wrapper commands (
<wrapper> collection add <wiki-path>
) accept absolute paths; prefer absolute paths when the agent CWD might differ from the project root.
- When invoked from a sibling repo (e.g., meta/skills repo while the target project lives elsewhere), confirm the value with the user before .
Workflow
- Run
scripts/wiki-init.ts doctor --project <path>
first.
- Read the report: wiki layout, AGENTS/CLAUDE, harnesses, hooks, cache migration, installed drift, and QMD status.
- For changes, run or without and show the planned file actions plus the suggested topology.
- Ask the user explicitly: local wiki or shared wiki? Do not silently default to a sibling path. Use the harness's structured-question tool (see Prompting).
- Local — wiki lives inside this repo at . Default for standalone projects and private experiments.
- Shared — wiki lives outside this repo (sibling, central knowledge base, monorepo location). When the user picks shared, ask for the absolute or relative path in free-form text; detected siblings (, etc.) are suggestions the user must confirm or replace.
- Confirm the QMD index name with the user (free-form input). Suggest a sensible default (project basename for local, organization or product name for shared) but let the user override.
- Only run with after passing explicit and . The script blocks writes without those flags.
- Re-run after writes.
- prepares the managed QMD checkout under the skill cache (
~/.local/share/skills/qmd/checkouts/qmd
) and points project wrappers at that checkout. It clones https://github.com/tobi/qmd.git
when missing and installs dependencies there.
- If the target project needs an index, initialize QMD with the generated wrapper:
<wrapper> collection add <wiki-path> --name <index> --mask "**/*.md"
, then and .
- Run
scripts/validate-wiki-init.ts
before changing reusable templates or scripts.
Prompting
Follow the project-wide convention in
/
("Skill Prompting Conventions"). Use the harness's structured-question tool —
(Claude Code),
(Codex), or
(OpenCode) — for the decision points below. Use free-form text only where a path or identifier is needed.
| Decision point | Why structured | Suggested options |
|---|
| Wiki location | Branches the whole install: paths, hooks, presets | Local (in-repo ) · Shared (separate path) |
| Cache migration when legacy detected | Hard-to-undo copy operation | Copy now (preserve legacy) · Skip migration |
| Drift remediation when installed files diverge | Triggers | Update all · Show diffs first · Ignore |
| Harness selection (multi-select) when more than one is detected | Avoids configuring agents the user doesn't want | claude · codex · opencode |
After the answer, restate the choice in your own words before running
.
Free-form prompts (no structured tool):
- The shared wiki path
- The QMD index name
- Any custom QMD command ()
- Any field where the user needs to type a value the skill cannot enumerate
What the doctor reports
is the always-safe entry point. It reports:
- wiki_path, qmd_index, recommended topology, and harness coverage.
- Presence of canonical files (, , , MCP/agent configs).
- Markdown drift — tracked files outside the configured wiki path.
- Cache migration — detects a legacy
~/.local/share/essential-skills/qmd
cache and reports whether will copy it to the current ~/.local/share/skills/qmd
location. The legacy directory is preserved (never deleted) for safety.
- Installed drift — for every file the latest templates would generate, compares the on-disk content against the desired content. Reports stale paths (e.g., references to the legacy cache), outdated managed blocks in /, and hooks/configs that fall behind the templates. The recommended fix is
wiki-init update-hooks --write
.
- QMD status — managed checkout location, version, patch report, index status.
- Planned actions — every file the next // run would create or update.
Script
Primary script:
sh
bun skills/wiki-init/scripts/wiki-init.ts doctor --project .
QMD-focused alias:
sh
bun skills/wiki-init/scripts/qmd-doctor.ts --project .
The script is intentionally dry-run by default. It writes only with
.
Common examples:
sh
bun skills/wiki-init/scripts/wiki-init.ts doctor --project /path/to/project
bun test skills/wiki-init/scripts/wiki-init.test.ts
bun skills/wiki-init/scripts/wiki-init.ts migrate --project /path/to/project --wiki ../knowledge-base --index my-index
bun skills/wiki-init/scripts/wiki-init.ts install --project /path/to/project
bun skills/wiki-init/scripts/wiki-init.ts install --project /path/to/project --wiki ../knowledge-base --index my-project --harness claude,codex,opencode --write
Presets
Use
for the supported project shapes: local wiki, central sibling wiki, multi-repo org wiki, and docs-only migration.
Wiki content scaffolding
configures
infrastructure (configs, hooks, MCP, QMD wrapper) but does
not create the wiki content. After
, the agent must create the minimum wiki scaffolding the other wiki skills assume:
<project-root>/wiki/
├── index.md # navigable catalog
├── CONVENTIONS.md # schema, frontmatter, naming, audience separation
├── log.md # append-only operation log
├── business/ # business/product rules (audience: business)
├── apps/ # app-level technical docs (audience: dev)
├── ops/ # operational procedures (audience: ops)
├── data/ # data models and schemas (audience: dev)
└── sources/ # ingested source summaries (one per slug)
<project-root>/raw/
└── index.md # raw source materials inventory
The audience separation and frontmatter conventions are defined by
. Treat that as the source of truth for naming, frontmatter, and content layout when scaffolding.
After scaffolding, initialize the QMD index per step 9 of the workflow.
Boundaries
- Do not auto-ingest wiki content. Hooks only raise signal; the agent decides semantically.
- Do not patch or install QMD globally.
- Prefer a managed project wrapper for QMD over shell aliases or . The wrapper must be accompanied by a provenance manifest recording the managed checkout, upstream repo/ref, wrapped binary, version, patch report, language, and embedding model.
- Keep reusable skill files free of user-specific absolute paths. Local absolute paths may appear only in generated per-machine wrappers/manifests/config after install.
- Keep templates inside this skill directory.