mdBook Documentation Conventions
Location
The book lives in book/ at the repo root. book/src/SUMMARY.md is the source of truth for page structure — always check it before adding or moving pages.
Running example
All pages use example_kb/ (the Prismatiq Lab fixture) for examples. Never use a hypothetical vault. Refer to the fixture's characters, fields, and edge cases by name when illustrating concepts.
Key reference: example_kb/.plan.md documents every file, field, and edge case in the fixture.
Content rules
Every command output must be real
- Run the command against
example_kb before writing.
- Capture the actual output.
- Paste it into the book. Trim if long, but never invent lines.
- If a command's output changes (new fields, format tweaks), re-run and update the book.
Every code block must be copy-pasteable
- Shell examples must work if the reader clones the repo and runs them from the repo root.
- Use
example_kb as the path argument, not . or a made-up directory.
- Quote arguments correctly for common shells (bash/zsh).
Accuracy over completeness
- Check
docs/spec/commands/ for the authoritative behavior, flags, and error conditions.
- Rewrite for users — the specs are for implementors. Drop internal details (Arrow types, struct names, pipeline steps).
- If unsure whether a behavior is correct, run it and verify before writing.
Tone
- User-facing. The reader has never seen the codebase. No internal architecture, no struct names, no module paths.
- Direct. Lead with what the command does, not how it works internally.
- Concise. Short paragraphs, bullet points, tables. Long prose blocks lose readers.
- No emojis unless explicitly requested.
Page structure
Command pages (commands/*.md)
# command-name
<One-sentence description of what the command does.>
## Usage
\`\`\`bash
mdvs <command> [args] [flags]
\`\`\`
## Flags
<Table: flag, default, description>
## What it does
<Brief explanation — 2-4 paragraphs max. What the user needs to know, not how it works internally.>
## Examples
<2-4 examples with real output from example_kb. Start simple, build to complex.>
Concept pages
Lead with the "what" and "why", then illustrate with example_kb fields. Use tables for type rules, widening matrix, etc. Keep it in one page — don't split tightly coupled concepts across files.
The search guide
The most example-heavy page. Must cover:
- Scalar filters (string, number, boolean)
- Array containment (
array_has, = ANY())
- Array length
- Nested object bracket access
- Field names with special characters (space, quotes)
- Combined filters
Every query must be runnable against example_kb. See scripts/test_array_queries.rs for tested patterns.
Workflow for writing a new page
- Read the relevant spec in
docs/spec/commands/ (if it exists).
- Read
example_kb/.plan.md to pick appropriate examples.
- Run all commands you plan to show. Capture output.
- Write the page.
- Build the book (
mdbook build book/) and check rendering.
Workflow for editing an existing page
- Read the current page.
- Re-run any commands whose output may have changed.
- Edit the page. Update output blocks if stale.
- Build the book and check rendering.
Updating example_kb
If a page needs an edge case that example_kb doesn't have:
- Discuss with the user — new content must fit the Prismatiq Lab story.
- Add the file/field to
example_kb/.
- Update
example_kb/.plan.md with the new edge case.
- Re-run
mdvs update example_kb and mdvs build example_kb --force.
- Then write the book content.
1---2name: book3description: mdBook documentation conventions. Apply when writing, editing, or reviewing pages in book/src/. Covers content rules, example verification, tone, and structure.4---5
6# mdBook Documentation Conventions
7
8## Location
9
10The book lives in `book/` at the repo root. `book/src/SUMMARY.md` is the source of truth for page structure — always check it before adding or moving pages.
11
12## Running example
13
14All pages use `example_kb/` (the Prismatiq Lab fixture) for examples. Never use a hypothetical vault. Refer to the fixture's characters, fields, and edge cases by name when illustrating concepts.
15
16Key reference: `example_kb/.plan.md` documents every file, field, and edge case in the fixture.
17
18## Content rules
19
20### Every command output must be real
21
221. Run the command against `example_kb` before writing.
232. Capture the actual output.
243. Paste it into the book. Trim if long, but never invent lines.
254. If a command's output changes (new fields, format tweaks), re-run and update the book.
26
27### Every code block must be copy-pasteable
28
29- Shell examples must work if the reader clones the repo and runs them from the repo root.
30- Use `example_kb` as the path argument, not `.` or a made-up directory.
31- Quote arguments correctly for common shells (bash/zsh).
32
33### Accuracy over completeness
34
35- Check `docs/spec/commands/` for the authoritative behavior, flags, and error conditions.
36- Rewrite for users — the specs are for implementors. Drop internal details (Arrow types, struct names, pipeline steps).
37- If unsure whether a behavior is correct, run it and verify before writing.
38
39## Tone
40
41- **User-facing.** The reader has never seen the codebase. No internal architecture, no struct names, no module paths.
42- **Direct.** Lead with what the command does, not how it works internally.
43- **Concise.** Short paragraphs, bullet points, tables. Long prose blocks lose readers.
44- **No emojis** unless explicitly requested.
45
46## Page structure
47
48### Command pages (`commands/*.md`)
49
50```markdown
51# command-name
52
53<One-sentence description of what the command does.>
54
55## Usage
56
57\`\`\`bash
58mdvs <command> [args] [flags]
59\`\`\`
60
61## Flags
62
63<Table: flag, default, description>
64
65## What it does
66
67<Brief explanation — 2-4 paragraphs max. What the user needs to know, not how it works internally.>
68
69## Examples
70
71<2-4 examples with real output from example_kb. Start simple, build to complex.>
72```
73
74### Concept pages
75
76Lead with the "what" and "why", then illustrate with `example_kb` fields. Use tables for type rules, widening matrix, etc. Keep it in one page — don't split tightly coupled concepts across files.
77
78### The search guide
79
80The most example-heavy page. Must cover:
81- Scalar filters (string, number, boolean)
82- Array containment (`array_has`, `= ANY()`)
83- Array length
84- Nested object bracket access
85- Field names with special characters (space, quotes)
86- Combined filters
87
88Every query must be runnable against `example_kb`. See `scripts/test_array_queries.rs` for tested patterns.
89
90## Workflow for writing a new page
91
921. Read the relevant spec in `docs/spec/commands/` (if it exists).
932. Read `example_kb/.plan.md` to pick appropriate examples.
943. Run all commands you plan to show. Capture output.
954. Write the page.
965. Build the book (`mdbook build book/`) and check rendering.
97
98## Workflow for editing an existing page
99
1001. Read the current page.
1012. Re-run any commands whose output may have changed.
1023. Edit the page. Update output blocks if stale.
1034. Build the book and check rendering.
104
105## Updating example_kb
106
107If a page needs an edge case that `example_kb` doesn't have:
1081. Discuss with the user — new content must fit the Prismatiq Lab story.
1092. Add the file/field to `example_kb/`.
1103. Update `example_kb/.plan.md` with the new edge case.
1114. Re-run `mdvs update example_kb` and `mdvs build example_kb --force`.
1125. Then write the book content.