Skill3.5k repo starsupdated today
wiki-setup
**wiki-setup** initializes or repairs an Obsidian wiki vault by creating a .env configuration file and establishing the vault directory structure. Use this skill when starting a new personal knowledge management system, recovering from configuration issues, or setting up semantic search integration with QMD tools for enhanced document discovery and querying capabilities.
Install in Claude Code
Copygit clone --depth 1 https://github.com/Ar9av/obsidian-wiki /tmp/wiki-setup && cp -r /tmp/wiki-setup/.skills/wiki-setup ~/.claude/skills/wiki-setupThen start a new Claude Code session; the skill loads automatically.
Definition
SKILL.md
# Obsidian Setup — Vault Initialization
You are setting up a new Obsidian wiki vault (or repairing an existing one).
## Step 1: Create .env
If `.env` doesn't exist, create it from `.env.example`. Ask the user for:
1. **Where should the vault live?** → `OBSIDIAN_VAULT_PATH`
- Default: `~/Documents/obsidian-wiki-vault`
- Must be an absolute path (after expansion)
2. **Where are your source documents?** → `OBSIDIAN_SOURCES_DIR`
- Can be multiple paths, comma-separated
- Default: `~/Documents`
- Local git repo clones (public or private, any host) can be listed here too — clone
the repo locally first, then add its path. See "Ingesting Git Repositories" in
`wiki-ingest/SKILL.md` for how repo sources are handled.
3. **Want to import Claude history?** → `CLAUDE_HISTORY_PATH`
- Default: auto-discovers from `~/.claude`
- Set explicitly if Claude data is elsewhere
4. **Have QMD installed?** → `QMD_WIKI_COLLECTION` / `QMD_PAPERS_COLLECTION` / `QMD_TRANSPORT`
- Optional. Enables semantic search in `wiki-query` and source discovery in `wiki-ingest`.
- Default to `QMD_TRANSPORT=mcp` unless the user wants the agent to call the local `qmd` CLI directly.
- If using CLI mode, set `QMD_CLI_SEARCH_MODE=quality` by default; suggest `balanced` if reranking is too slow.
- If unsure, skip for now — both skills fall back to `Grep` automatically.
- Install instructions: see `.env.example` (QMD section).
- **If `QMD_WIKI_COLLECTION` is set, verify the collection excludes `_raw/`.** The wiki
collection and papers collection must stay disjoint — `wiki-query` cites them as
separate layers (compiled knowledge vs. raw staging), and `OBSIDIAN_VAULT_PATH` contains
`_raw/`, so a plain `qmd collection add <vault>` silently merges the two.
Read `~/.config/qmd/index.yml`, find the entry for `$QMD_WIKI_COLLECTION`, and check its
`ignore` list includes `_raw/**` (and ideally `log.md`, which has no semantic value). If
the collection doesn't exist yet, create it (`qmd collection add "$OBSIDIAN_VAULT_PATH"
--name <collection-name>`), then add the `ignore` block to `index.yml` by hand — `qmd`
has no `--ignore` flag and refuses a second `collection add` on a path that already has
one, so editing the YAML is the only way to scope it. Run `qmd update` after editing.
If the collection already exists without the `ignore` block, tell the user their
wiki collection is indexing `_raw/` (including `_raw/_archived/` drafts left behind by
`wiki-ingest`) and offer to add the `ignore` block and re-run `qmd update`.
5. **Token budget warning threshold?** → `WIKI_TOKEN_WARN_THRESHOLD`
- Default: `100000` (warn when full-wiki read would cost > 100K tokens)
- Set to `0` to disable the warning entirely
- `wiki-status` shows a token footprint table and emits this warning automatically
6. **Enable staged writes?** → `WIKI_STAGED_WRITES`
- Default: unset / `false` (pages written directly to their final location)
- Set to `true` for team wikis, high-stakes domains, or any vault where the human wants final say on every LLM-written page
- When enabled: all new/updated pages land in `_staging/` first; run `/wiki-stage-commit` to review and promote them
- `wiki-status` shows a "Staged writes pending" count when files are waiting
After resolving config, assign the global config directory with the exact
`obsidian_wiki_config_dir` algorithm from the Config Resolution Protocol in
`.skills/llm-wiki/SKILL.md`. Create the shared writing profile only when it does not
already exist. Preserve an existing `$GLOBAL_CONFIG_DIR/WRITING.md`; never overwrite it
and do not ask additional writing-style questions.
Use `OBSIDIAN_WIKI_REPO` when it was loaded from config. When it is absent, derive the
absolute repository/data root from this loaded skill's absolute path, distinguishing the
packaged `<root>/skills/wiki-setup/SKILL.md` layout from the source
`<root>/.skills/wiki-setup/SKILL.md` layout. Then check both canonical template layouts:
- Packaged install: `<root>/skills/llm-wiki/references/WRITING.md`
- Source checkout: `<root>/.skills/llm-wiki/references/WRITING.md`
```bash
GLOBAL_CONFIG_DIR="$(obsidian_wiki_config_dir)"
mkdir -p "$GLOBAL_CONFIG_DIR"
SKILL_FILE="<absolute path of this loaded wiki-setup/SKILL.md>"
SKILL_DIR="$(cd "$(dirname "$SKILL_FILE")" && pwd)"
if [ -n "${OBSIDIAN_WIKI_REPO:-}" ]; then
WIKI_ROOT="${OBSIDIAN_WIKI_REPO%/}"
else
case "$SKILL_DIR" in
*/.skills/wiki-setup) WIKI_ROOT="${SKILL_DIR%/.skills/wiki-setup}" ;;
*/skills/wiki-setup) WIKI_ROOT="${SKILL_DIR%/skills/wiki-setup}" ;;
*) echo "Cannot derive writing-profile template root from $SKILL_DIR" >&2; exit 1 ;;
esac
fi
WRITING_TEMPLATE=""
for candidate in \
"$WIKI_ROOT/skills/llm-wiki/references/WRITING.md" \
"$WIKI_ROOT/.skills/llm-wiki/references/WRITING.md"
do
if [ -f "$candidate" ]; then
WRITING_TEMPLATE="$candidate"
break
fi
done
[ -n "$WRITING_TEMPLATE" ] || { echo "Writing profile template not found under $WIKI_ROOT" >&2; exit 1; }
WRITING_PROFILE="$GLOBAL_CONFIG_DIR/WRITING.md"
if [ ! -e "$WRITING_PROFILE" ]; then
cp "$WRITING_TEMPLATE" "$WRITING_PROFILE"
fi
```
## Step 2: Create Vault Directory Structure
```bash
mkdir -p "$OBSIDIAN_VAULT_PATH"/{concepts,entities,skills,references,synthesis,journal,projects,_archives,_raw,_staging,.obsidian}
```
- `.obsidian/` — Obsidian's own config. Creates vault recognition.
- `projects/` — Per-project knowledge (populated during ingest).
- `_archives/` — Stores wiki snapshots for rebuild/restore operations.
- `_raw/` — Staging area for unprocessed drafts. Drop rough notes here; `wiki-ingest` will promote them to proper wiki pages and move the originals into `_raw/_archived/` (created on first use).
- `_staging/` — Review queue for LLM-written pages when `WIKI_STAGED_WRITES=true`. Pages here are not visible in Obsidian's graph until promoted via `/wiki-stage-commit`.
#