|
| 1 | +# Documentation Writing Guide |
| 2 | + |
| 3 | +Guidelines for writing dstack documentation, README, and marketing content. |
| 4 | + |
| 5 | +## Writing Style |
| 6 | + |
| 7 | +- **Don't over-explain** why a framework is needed — assert the solution, hint at alternatives being insufficient |
| 8 | +- **Avoid analogies as taglines** (e.g., "X for Y") — if it's a new category, don't frame it as a better version of something else |
| 9 | +- **Problem → Solution flow** without explicit labels like "The problem:" or "The solution:" |
| 10 | +- **Demonstrate features through actions**, not parenthetical annotations |
| 11 | + - Bad: "Generates quotes (enabling *workload identity*)" |
| 12 | + - Good: "Generates TDX attestation quotes so users can verify exactly what's running" |
| 13 | + |
| 14 | +## Procedural Documentation (Guides & Tutorials) |
| 15 | + |
| 16 | +### Test Before You Document |
| 17 | +- **Run every command** before documenting it — reading code is not enough |
| 18 | +- Commands may prompt for confirmation, require undocumented env vars, or fail silently |
| 19 | +- Create a test environment and execute the full flow end-to-end |
| 20 | + |
| 21 | +### Show What Success Looks Like |
| 22 | +- **Add sample outputs** after commands so users can verify they're on track |
| 23 | +- For deployment commands, show the key values users need to note (addresses, IDs) |
| 24 | +- For validation commands, show both success and failure outputs |
| 25 | + |
| 26 | +### Environment Variables |
| 27 | +- **List all required env vars explicitly** — don't assume users will discover them |
| 28 | +- If multiple tools use similar-but-different var names, clarify which is which |
| 29 | +- Show the export pattern once, then reference it in subsequent commands |
| 30 | + |
| 31 | +### Avoid Expert Blind Spots |
| 32 | +- If you say "add the hash", explain how to compute the hash |
| 33 | +- If you reference a file, explain where to find it |
| 34 | +- If a value comes from a previous step, remind users which step |
| 35 | + |
| 36 | +### Cross-Reference Related Docs |
| 37 | +- Link to prerequisite guides (don't repeat content) |
| 38 | +- Link to detailed guides for optional deep-dives |
| 39 | +- Use anchor links for specific sections when possible |
| 40 | + |
| 41 | +## Security Documentation |
| 42 | + |
| 43 | +### Trust Model Framing |
| 44 | + |
| 45 | +**Distinguish trust from verification:** |
| 46 | +- "Trust" = cannot be verified, must assume correct (e.g., hardware) |
| 47 | +- "Verify" = can be cryptographically proven (e.g., measured software) |
| 48 | + |
| 49 | +**Correct framing:** |
| 50 | +- Bad: "You must trust the OS" (when it's verifiable) |
| 51 | +- Good: "The OS is measured during boot and recorded in the attestation quote. You verify it by..." |
| 52 | + |
| 53 | +### Limitations: Be Honest, Not Alarmist |
| 54 | + |
| 55 | +State limitations plainly without false mitigations: |
| 56 | +- Bad: "X is a single point of failure. Mitigate by running your own X." |
| 57 | +- Good: "X is protected by [mechanism]. Like all [category] systems, [inherent limitation]. We are developing [actual solution] to address this." |
| 58 | + |
| 59 | +Don't suggest mitigations that don't actually help. If something is an inherent limitation of the technology, say so. |
| 60 | + |
| 61 | +## Documentation Quality Checklist |
| 62 | + |
| 63 | +From doc-requirements.md: |
| 64 | + |
| 65 | +1. **No bullet point walls** — Max 3-5 bullets before breaking with prose |
| 66 | +2. **No redundancy** — Don't present same info from opposite perspectives |
| 67 | +3. **Conversational language** — Write like explaining to a peer |
| 68 | +4. **Short paragraphs** — Max 4 sentences per paragraph |
| 69 | +5. **Lead with key takeaway** — First sentence tells reader why this matters |
| 70 | +6. **Active voice** — "TEE encrypts memory" not "Memory is encrypted by TEE" |
| 71 | +7. **Minimal em-dashes** — Max 1-2 per page, replace with "because", "so", or separate sentences |
| 72 | + |
| 73 | +### Redundancy Patterns to Avoid |
| 74 | + |
| 75 | +These often say the same thing: |
| 76 | +- "What we protect against" + "What you don't need to trust" |
| 77 | +- "Security guarantees" + "What attestation proves" |
| 78 | + |
| 79 | +Combine into single sections. One detailed explanation, brief references elsewhere. |
| 80 | + |
| 81 | +## README Structure |
| 82 | + |
| 83 | +### Order Matters |
| 84 | +- **Quick Start before Prerequisites** — Lead with what it does, not setup |
| 85 | +- **How It Works after Quick Start** — Users want to run it first, understand later |
| 86 | +- Cleanup at the end, Further Reading last |
| 87 | + |
| 88 | +### Don't Duplicate |
| 89 | +- Link to conceptual docs instead of repeating content |
| 90 | +- If an overview README duplicates an example README, cut the overview |
| 91 | +- One detailed explanation, brief references elsewhere |
| 92 | + |
| 93 | +### Remove Unrealistic Sections |
| 94 | +- If most users can't actually do something (e.g., run locally without special hardware), don't include it |
| 95 | +- Don't document workflows that require resources users don't have |
| 96 | + |
| 97 | +### Match the Workflow to the User |
| 98 | +- Use tools your audience already knows (e.g., Jupyter for ML practitioners) |
| 99 | +- Prefer official/existing images when they exist — don't reinvent |
| 100 | +- Make the correct path the default, mention alternatives briefly |
| 101 | + |
| 102 | +## Code Examples |
| 103 | + |
| 104 | +### Question Every Snippet |
| 105 | +- Does this code actually demonstrate something meaningful? |
| 106 | +- Would a reader understand what it does without the prose? |
| 107 | +- `do_thing(b"magic-string")` means nothing — show real use or remove it |
| 108 | + |
| 109 | +### Diagrams |
| 110 | +- Mermaid over ASCII art — GitHub renders it nicely |
| 111 | +- Keep diagrams simple — 3-5 nodes max |
| 112 | +- Label edges with actions, not just arrows |
| 113 | + |
| 114 | +## Conciseness |
| 115 | + |
| 116 | +### Less is More |
| 117 | +- 30 lines beats 150 if it says the same thing |
| 118 | +- Cut sections that don't help users accomplish their goal |
| 119 | +- Tables for reference, prose for explanation — don't over-table |
| 120 | + |
| 121 | +### Performance and Benchmarks |
| 122 | +- One memorable number + link to full report |
| 123 | +- Don't overwhelm with data the reader didn't ask for |
| 124 | + |
| 125 | +### Reader-First Writing |
| 126 | +- Ask "what does the reader want to know?" not "what do I want to say?" |
| 127 | +- If a section answers a question nobody asked, cut it |
| 128 | + |
| 129 | +## Maintenance |
| 130 | + |
| 131 | +### Consistency Checks |
| 132 | +- After terminology changes, grep for related terms across all files |
| 133 | +- Use correct industry/vendor terminology (e.g., "Confidential Computing" not "Encrypted Computing") |
| 134 | + |
| 135 | +### Clean Up Old Files |
| 136 | +- When approach changes, delete orphaned files (old scripts, Dockerfiles) |
| 137 | +- Don't leave artifacts from previous implementations |
0 commit comments