Skip to content

Documentation Writing

  • Primary references:
  • Supplementary: Architecture Decision Records (free), Write the Docs guide (free), Docs for Developers (Apress, recommended)
  • Prerequisites: Diagramming & the C4 Model (good docs embed diagrams); for the course chapters, a repository you work in
  • Estimated time: 1 week at 4-6 hrs/week for the reading; 1 to 2 h for your first decision record (course Pass 1), and the runbooks of Pass 11
  • Documentation is code’s interface to humans across time. Treat it like code: version it, review it, test it, deprecate it, own it.
  • Most “bad docs” are actually the wrong type of doc. Diátaxis names four types (tutorial, how-to guide, reference, explanation) and tells you not to mix them. Name the type before you write.
  • Decisions go in decision records: one decision per file, append-only, with the forces, the costs, and the rejected options.
  • Writing clearly is a learnable mechanic, not a talent: short sentences, active voice, lists over prose, one idea per paragraph.
  • A doc that isn’t tested against reality is a liability: it confidently tells the reader something false. (The testing mentality applies to docs.)
  • Take Google’s Technical Writing One (about 2 hrs). Apply its rules to a doc you already own.
  • Classify every doc in a repo you know by its Diátaxis quadrant. Find the one that’s secretly two types fighting each other; split it.
  • In the course, write ADR-0001 for your own system (craft.02, Pass 1), then read the records of a project you use (Rust RFCs, Kubernetes KEPs) and compare. For every document you write later (runbooks, postmortems, the model card), name its type first.

A reader arrives at a document in one of two states (studying vs. working) needing one of two things (practical steps vs. theoretical knowledge). Those two axes give four irreducible documentation types, and the cardinal sin is mixing them: a tutorial that keeps stopping to explain theory loses the beginner; a reference page that tells a story wastes the expert. Name the type first, write to it, and most documentation problems dissolve. The most expensive knowledge to lose is why the system is the way it is: code shows what, tests show what must stay true, and only writing preserves why.

quadrantChart
    title Diátaxis: pick one per document
    x-axis Theoretical --> Practical
    y-axis Studying --> Working
    quadrant-1 How-to guide
    quadrant-2 Reference
    quadrant-3 Explanation
    quadrant-4 Tutorial
TypeReader’s questionVoiceFailure if mixed
Tutorial“Teach me, I’m new”“We will… now you’ll see…”Stops to explain theory; beginner gets lost
How-to guide“I have a goal, give me steps”“To do X: 1, 2, 3”Becomes a tutorial; expert is slowed down
Reference“What exactly is the signature/flag?”Dry, complete, consistentTells a story; facts get buried
Explanation“Why is it built this way?”Discursive, links tradeoffsPretends to be steps; loses the argument

A repo’s docs/ should have a place for each. A single page trying to be all four is the most common documentation smell.

Everything good about source applies to docs:

  • Versioned: docs live in the repo, change in the same PR as the code they describe. A behavior change with no doc change is an incomplete PR.
  • Reviewed: docs go through code review. Reviewers catch “this example no longer compiles.”
  • Tested: run code samples in CI (doctests, cargo test --doc, go test on Example funcs). Lint prose with Vale. Check links. An untested example will drift.
  • Generated where possible: API reference from docstrings/OpenAPI, ER diagrams from schema, CLI help from the parser. Hand-maintained reference rots; generated reference can’t.
  • Deprecated deliberately: mark stale docs, redirect, and delete. Out-of-date docs are worse than none because readers trust them.

Google’s technical-writing rules, distilled to what changes your prose today:

  • One idea per sentence; one topic per paragraph. If a sentence has two ideas, split it.
  • Active voice, present tense. “The worker commits the offset,” not “the offset is committed.”
  • Lead with the conclusion. State the takeaway, then support it (BLUF: bottom line up front). Readers skim.
  • Lists for sequences and sets; tables for comparisons. Prose is the worst format for either: most of this curriculum is tables for exactly this reason.
  • Define terms once, use them consistently. Don’t call it a “worker” here and a “consumer” there unless you mean different things.
  • Cut filler. “In order to” → “to”. “At this point in time” → “now”. Shorter is clearer.
  • Show, then tell. A runnable example earns more trust than a paragraph of description.

4. The documents Staff+ engineers actually own

Section titled “4. The documents Staff+ engineers actually own”
DocumentDiátaxis typePurposeKeep alive by
READMEMix (gateway)Orient a newcomer in <5 min; link out to the restTreat as the front door; see write-readme conventions
Design doc / RFCExplanationArgue why before building; the artifact of thinkingWrite before coding; archive after (decision captured in an ADR)
ADRExplanationOne immutable record per significant decisionAppend-only; supersede, never edit (see §5)
RunbookHow-to guideSteps to operate/recover a system at 3amTest it during a game-day; update after every incident
API referenceReferenceExact signatures, params, errorsGenerate from source
PostmortemExplanationBlameless analysis of an incidentAction items tracked to closure

A design doc captures the thinking; an ADR captures the decision in a tiny, immutable, append-only file so future engineers know why: the most expensive knowledge to lose. One decision per file:

# ADR-014: Bound worker parallelism with Kafka partition count
## Status
Accepted (2026-06-13). Supersedes ADR-009.
## Context
Order throughput is rising. We considered adding worker replicas freely,
but a Kafka consumer group caps useful parallelism at the partition count.
## Decision
Set the `orders` topic to 12 partitions and cap the worker HPA at 12 replicas.
Scale partitions (not just replicas) when sustained lag exceeds target.
## Consequences
+ Predictable scaling story; no idle workers.
- Repartitioning is operationally heavy; we must forecast 12-18 months ahead.
- Ordering is per-partition only; documented for downstream consumers.

The rule: ADRs are immutable. You don’t edit ADR-009 when you change your mind: you write ADR-014 that supersedes it. The history of why the architecture is what it is becomes a readable log. This is the textual twin of the embedded, living diagram from topic 01.

TechniqueWhen to apply
Classify by Diátaxis typeBefore writing any doc: name the type first
Docs in the same PR as codeEvery behavior change
Test code samples in CIAny doc with runnable examples
BLUF / lead with the conclusionEvery doc, email, and PR description
Tables over proseAny comparison or enumerated set
ADREvery significant, hard-to-reverse decision
Runbook + game-dayAny system you’re on-call for
Blameless postmortemAfter every incident
#ModuleChapterKindPass
1craft.02Architecture decision recordspractice1
2craft.10Runbooks and Diataxis docspractice11
ConceptConnected TrackHow
Docs-as-code, deprecationSoftware CraftsmanshipGoogle’s documentation chapter is the canonical source
Runbooks, postmortemsObservabilityYou can only write a runbook for what you can observe
Runbooks and postmortems in the courseIncident Response and ChaosEvery drill ends in a runbook or a postmortem you write
Embedded diagrams in docsDiagramming & C4Good docs are diagram-anchored
Design docs before buildingSystem DesignThe design doc is the deliverable of a design exercise
CompanyHow This AppearsFocus
GoogleDesign docs + readability reviews are core culture; ADRs widespreadDocumentation as engineering
AmazonThe six-page narrative memo replaces slide decksWriting as thinking
StripeIndustry-leading docs and API referenceReference quality, tested examples
AnthropicCareful design docs and writeups for safety-critical workExplanation + rigor
Any Staff+ roleRFCs, ADRs, and postmortems are how you scale influenceWriting leverage