markdown

Query the wiki and render the answer as portable, GitHub-flavored markdown saved under vault/output/. Trigger when the user asks to "export X as markdown", "produce a markdown brief", "save the answer

SKILL.md

GitHub

LLM Wiki — Markdown export

Run a query against vault/wiki/, render the answer as portable markdown, and write it to vault/output/<slug>.md. The result is plain GitHub-flavored markdown — no [[wikilinks]], no Dataview blocks, no Obsidian callouts — suitable for pasting into a PR body, an email, or a non-Obsidian doc tool.

This skill is the publish-side counterpart to /claude-wiki-pages:query. Query stays in the conversation; markdown lands on disk.

When to invoke

  • The user explicitly asks to export, save, or render an answer as markdown ("export this as markdown", "save to the output folder").
  • The user invokes /claude-wiki-pages:markdown directly.
  • An agent (claude-wiki-pages-analyst-agent Compile mode) chains this skill as a step.

Do NOT invoke when the user just wants an answer in the chat — use /claude-wiki-pages:query for that.

Do NOT invoke for synthesis notes (cross-topic analyses live under wiki/_synthesis/) — use /claude-wiki-pages:synthesize.

Reading contract

Same order and scope as /claude-wiki-pages:query:

  • vault/CLAUDE.md — the schema. Read first.
  • vault/wiki/index.md — the top-level catalog.
  • vault/wiki/<topic>/<topic>.md — per-folder MOCs (folder notes; legacy _index.md where still present).
  • vault/wiki/<topic>/*.md — candidate typed pages, plus pages reached by following [[wikilinks]] (one hop) when the answer needs them.
  • vault/wiki/_synthesis/*.md — prior syntheses, if relevant.
  • vault/wiki/_sources/*.md — source summaries, when provenance matters.

Rendering contract

Convert wiki-flavored markdown to portable markdown:

  • Wikilinks — replace [[Page Title]] with [Page Title](../wiki/<path>/<slug>.md) (relative path from vault/output/) when the target page resolves. If the target does not resolve, drop the link syntax and keep the plain text — never emit a dangling [[link]].
  • Callouts — convert > [!note] Title and similar to a regular blockquote with the title bolded (> **Title** on the first line, then > body… on the next).
  • Dataview blocks — strip fenced ```dataview blocks entirely.
  • Block IDs — strip Obsidian ^block-id markers.
  • Embeds — ![[image.png]] becomes ![image](../wiki/_attachments/image.png) when the asset exists; otherwise drop the embed.
  • Preserve — headings, ordered/unordered lists, tables, fenced code blocks, inline code, regular markdown links.
  • ## Sources grounding ledger — KEEP. When the query answer carries the tail ## Sources section (the numbered grounding ledger from the query answer contract), the portable export keeps it. Its wikilinks are flattened like every other wikilink per this rendering contract ([[Page]] → [Page](../wiki/<path>/<slug>.md)); the raw source paths stay as plain paths. The ledger is part of the auditable answer, not Obsidian-only syntax.

Keep the source query, citations, and confidence visible in the output so the reader can audit the claims.

Writing contract

Exactly one new file:

vault/output/<slug>.md

<slug> is kebab-case of the question, truncated to 60 characters, or the explicit name the user supplied.

The file MUST carry this frontmatter:

---
generated_by: markdown
source_query: "<original question, single line>"
generated_at: <YYYY-MM-DD>
sources:
  - "[[Source Page A]]"
  - "[[Source Page B]]"
---

Body shape:

# <Title derived from the question>

<direct answer in 1–3 paragraphs, with inline links to wiki pages where they resolve>

## Supporting pages
- [Page A](../wiki/<topic>/page-a.md) — one-line why this page matters
- [Page B](../wiki/<topic>/page-b.md) — …

## Caveats
- contradictions, low-confidence claims, gaps

## Sources

1. [Page A](../wiki/<topic>/page-a.md) — raw/<path-to-underlying-source>.md
2. [Page B](../wiki/<topic>/page-b.md) — raw/<path>.md, raw/<other-path>.md

---
*Generated by `/claude-wiki-pages:markdown` on <YYYY-MM-DD>. Sources: [[Source Page A]], [[Source Page B]].*

Plus one log append to vault/wiki/log.md:

## [YYYY-MM-DD] markdown | <question summary> → output/<slug>.md

If the target file exists, ask the user before overwriting.

This skill MUST NOT:

  • Mutate any wiki page or any file under vault/raw/.
  • Write outside vault/output/ (except the single log append).
  • Fabricate citations. Every page named in sources: must exist; every resolved link in the body must point to a real file under vault/wiki/.
  • Emit [[wikilinks]] in the rendered body. Wikilinks are allowed only in the sources: frontmatter list (for provenance) and in the trailing attribution line.

Workflow

  1. Schema. Read vault/CLAUDE.md.
  2. Query. Apply the query reading contract; gather the evidence and the candidate citations.
  3. Resolve. For every wikilink target the answer would cite, locate the actual file path under vault/wiki/ and compute the relative path from vault/output/.
  4. Render. Build the portable-markdown body per the rendering contract. Strip Obsidian-only syntax.
  5. Slug. Derive <slug> from the user's question (or accept an explicit --name). Confirm overwrite if the file already exists.
  6. Write. Create vault/output/<slug>.md with the required frontmatter and body.
  7. Log. Append the markdown entry to vault/wiki/log.md.

Completion signal

Print, on separate lines:

Wrote: vault/output/<slug>.md
Logged: markdown | <truncated question>

If the user supplied an explicit --name, echo that name in the log entry in place of the truncated question.