Nguyen Le Phong

Why I Love Writing Documentation

A short note in the repo can answer the question nobody can answer at 9 p.m. before a release.

It's 9 p.m., the release is nearly out, and someone in the channel asks why a payment setting has to stay disabled in production. The code doesn't say. The ticket doesn't say. The person who made the call left the team months ago. Then someone finds a half-page note in the repo: "Keep this off until the bank finishes moving its callback URL. Check with the partner team before turning it on." Five minutes later the release ships, the setting stays off, and everyone goes home.

Two engineers check a document and a laptop during a late release and find the production context they needed.
With the note in the repo, the late-night question takes five minutes.

That note is my favorite kind of documentation, and it's why I actually enjoy writing docs. A good doc is a message to a tired person in the future, sometimes yourself, that saves them an evening. This post covers what the research says about docs, why small beats big, how writing a doc sharpens your own thinking, and a few habits that stop docs from going stale.

Good docs help every other practice land

Nobody gets applause in a sprint review for a README. Missing docs show up everywhere, though. A new teammate spends their first weeks asking the same questions the last new teammate asked. An incident waits while people search old Slack threads. A decision gets reopened because nobody remembers the tradeoff. A workaround becomes permanent because the reason for it is gone.

Google's DORA research program measured this. In their 2022 State of DevOps data, teams with above-average documentation quality got far more out of every technical practice the study covered, from continuous integration to trunk-based development. DORA's own summary: "we see documentation quality driving the implementation of every single technical practice we studied" (DORA: Documentation quality). Docs sit underneath everything else. They're how a practice spreads from the two people who set it up to the rest of the team.

Small, current docs beat big manuals

Some of the most useful docs are tiny: a README that explains how to run the project, a decision record on why the team picked one queue over another, a troubleshooting note for a flaky integration, one example request and response, a migration checklist, a single line that says "don't remove this flag until these three customers have moved."

Google's documentation guide, which they publish openly, makes the same case: "A small set of fresh and accurate docs is better than a large assembly of 'documentation' in various states of disrepair." (Documentation Best Practices). It compares docs to a bonsai tree that needs regular trimming, says flatly that "dead docs are bad", and recommends deleting by default when you clean up.

For decisions, Michael Nygard's architecture decision record from 2011 is still hard to beat (Documenting Architecture Decisions). He describes the problem well: a newcomer who finds a decision without its reasoning can either blindly accept it or blindly change it. His fix is a short file in the repo with five parts (title, context, decision, status, consequences), one or two pages long.

A team lays out a README, a decision record, a troubleshooting note and a checklist across a desk.
The docs people trust are usually short and sit right next to the work.

Writing the doc tests your thinking

This is the part I like most. When you try to explain a design in plain words, the fuzzy parts jump out. If you can't say where a module's boundary is, you may not understand it yet. If you can't say when to use a tool and when to avoid it, the rule probably isn't ready. A doc is a cheap way to find out whether the work makes sense before someone else finds out for you.

Write for someone in a hurry

People rarely read docs for fun. They're trying to get something done, usually with a clock running. They don't need a display of expertise. They need a path:

  • What is this, and when should I use it?
  • How do I run it locally?
  • What tends to go wrong, and where are the logs?
  • Who owns it?
  • Which decision shouldn't I reverse casually, and why?

A page that answers those five is already worth more than most wikis. Code comments follow the same rule. Google's guide says the main job of an inline comment is to give information the code itself can't contain, and that "why" explanations belong there. (For the reader's side of this, see why reading code is harder than writing it.)

Keep docs next to the code

Docs written as a separate project after all the "real work" is done usually fail. Everyone's tired, the context is already fading, and the result is too broad or out of date on day one. The habit that works is smaller. Google's guide is direct about it: change the docs in the same change as the code, and reviewers should check that you did. In practice that means updating the README in the PR that changes setup, adding an example when an API surprises someone, writing the decision record while the tradeoff is fresh, and leaving a note after an incident before the details fade.

Docs do go stale. That's a reason to keep them short and close to the code, to delete pages that no longer help, and to treat examples as a check on whether anyone still understands the system. A small note that's right beats a polished page nobody trusts.

Docs are team memory

There's a people side too. Written answers make beginner questions cheaper to ask, since half of them are already answered. Remote and async teams get context that doesn't only live in meetings. Ownership gets less fragile, because one person's memory stops being a single point of failure. And teammates who don't talk the most in meetings get another way to contribute: making the path clearer for everyone who comes after them.

Three teammates read a documentation page together, sharing context without depending on one person's memory.
When the context lives in a doc, nobody has to wait for the one person who remembers.

Try this week

  • Find one question you've answered twice this month and put the answer in the README.
  • Write a one-page decision record for the last real tradeoff your team made.
  • In your next PR, update the doc your change just made wrong.
  • Delete one page you know is out of date.
  • Add one "why" comment next to the strangest line you touched this week.
What did you think?

Frequently asked questions

Does documentation quality really make a difference?
Google's DORA research says yes. In its 2022 State of DevOps data, teams with above-average documentation quality got much more benefit from every technical practice studied, including continuous integration, continuous delivery and trunk-based development.
What should a good README answer?
What the thing is and when to use it, how to run it locally, what tends to break and where the logs are, who owns it, and which decisions shouldn't be reversed casually. Short and current beats long and stale.
What is an architecture decision record (ADR)?
A short file in the repo that records one decision with its title, context, decision, status and consequences. Michael Nygard proposed the format in 2011 and suggested keeping each record to one or two pages.