Development
Key points

Key points

  1. 1Developers read documentation to get something done, so docs should be organized around their needs: learning, completing a task, looking up a fact, or understanding a design.
  2. 2The README and a short quickstart that ends in one working result do more for adoption than any other pages.
  3. 3Code examples must be complete, realistic and tested, because a broken example costs a developer more time than no example.
  4. 4Keeping documentation in the same repository and review process as the code is the most reliable way to stop it drifting out of date.

Why good documentation goes unread

Most unread documentation has one of three problems.

  1. It mixes purposes. A page that tries to teach a beginner, answer an expert's question and explain the architecture serves none of them. The beginner gets lost in detail and the expert cannot find the fact they need.
  2. It is hard to scan. Long paragraphs, vague headings and undefined jargon force a reader to read everything to find anything.
  3. It is wrong. Fern's guide to API documentation describes the cost: when documentation is incomplete, outdated or hard to navigate, developers waste time troubleshooting authentication failures, misinterpreting response schemas, and opening support tickets for questions the docs should have answered. Once a reader has been burned by an outdated page, they stop trusting the rest.

Each of the sections below addresses one of these.

The four kinds of documentation

The most useful single idea in technical writing is that documentation comes in distinct kinds. The Diátaxis framework identifies four distinct needs, and four corresponding forms of documentation: tutorials, how-to guides, technical reference and explanation. It proposes organizing documentation around those needs.

Diátaxis's primer describes each one.

KindPurposeReader's situationExample
TutorialA lesson that builds skill through doingLearning, new to the product"Build your first integration"
How-to guideDirections for a real-world goalWorking, already competent"How to rotate API keys"
ReferenceAccurate technical descriptionWorking, looking something upEndpoint parameters, config options
ExplanationContext and background, the whyStudying, wants to understand"How our caching works"

The distinctions are practical. The primer describes a tutorial as a lesson in which the instructor is responsible for the learner's safety and success, while a how-to guide addresses an already-competent user and is concerned with work rather than study. Reference material is neutral and should mirror the structure of the thing it describes, so a method that belongs to a class appears under that class in the docs.

The most common mistake the framework warns about is overloading tutorials with explanation. The primer's advice is to give the learner the most minimal explanation, such as one sentence on why a step uses HTTPS, and link to an in-depth article for later.

Tom Johnson's overview of Diátaxis on I'd Rather Be Writing summarizes the premise: each content type serves a different user need, and keeping them separated lets each be structured for its own goal. How-to guides, for example, take a recipe shape with prerequisites and ordered steps.

GitHub's documentation guide suggests using the framework as an audit: check whether a tool you use has a reference page, whether there are enough tutorials for contributors to get started, and whether how-to guides explain some of the common tasks people need to accomplish.

Start with the README and a quickstart

The README is the front door. For many projects it is the only page most people ever read. A University of California, Berkeley library guide lists what it should contain at minimum: a brief description of the project, installation instructions, and a short example.

A README that serves developers usually has these sections, in this order.

  1. Project name and summary: one or two sentences on what it does and who it is for.
  2. Install: the exact command.
  3. Quick start: the smallest complete example that produces a visible result.
  4. Documentation: links to tutorials, how-to guides, reference and explanation.
  5. Contributing: how to run the project locally and submit a change.
  6. License.

The quickstart deserves the most care. Fern's guide recommends starting with quickstart guides that walk developers through authentication setup and a single working API call, because that first success builds confidence before advanced features. Fern calls the measure "time to first call", how long a developer takes to make a first successful request. Test it yourself: give the quickstart to someone who has never used the product and time how long it takes them to get a result.

A good quickstart:

  • Lists prerequisites up front, such as an account, a key and a runtime version.
  • Uses copyable commands, one per block, with no placeholder the reader must guess.
  • Ends with a visible result, such as output in a terminal or a response body.
  • Links to the next step, usually a tutorial or the most common how-to guide.

Write for scanning not reading

Developers scan. GitHub's guide gives practical advice for helping them.

  • Use plain language. It suggests checking for acronyms or technical terms some of your audience will not know, and either swapping them for simpler language or defining them in the document.
  • Use headings and a table of contents so readers can see where information lives, and use templates with common headings so pages are structured the same way.
  • Be consistent with styling. If important terms are bold in one document, make them bold in the others.

A few more habits make pages faster to use.

  • Put the answer first. Start a how-to guide with the goal and the steps, not the history of the feature.
  • Write headings that say what is below them. "Rotate an API key" is better than "Keys".
  • One idea per paragraph, one action per step. Numbered steps should each contain a single thing to do.
  • Show expected output after commands so readers know whether a step worked.
  • Name things consistently. If the product calls it a workspace, never call it a project in the docs.

Examples that work when pasted

Code examples are the most-used part of developer documentation and the part most likely to be wrong. Fern recommends examples that reflect real integration patterns, including error handling, environment variable usage for credentials, and pagination logic, instead of minimal snippets that leave out what production code needs.

Compare two examples for the same call.

// Incomplete: works only in a demo
const res = await fetch("https://api.example.com/v1/orders");
const orders = await res.json();
// Complete: what a developer can actually ship
const res = await fetch("https://api.example.com/v1/orders?limit=50", {
  headers: { Authorization: `Bearer ${process.env.EXAMPLE_API_KEY}` },
});
if (!res.ok) {
  const problem = await res.json();
  throw new Error(`${res.status} ${problem.title}: ${problem.detail}`);
}
const { data: orders, next_cursor } = await res.json();

The second shows authentication, where the key comes from, what an error looks like and how pagination continues. Those are the questions a developer would otherwise ask.

Examples rot as the product changes. Fern's guide recommends automated testing that executes documented requests against staging environments and checks that responses match the documented schemas. Even a simple script that extracts code blocks and runs them in CI will catch most broken examples before readers do.

Reference documentation for APIs

Reference is the documentation developers return to every day. Stoplight's API documentation guide describes the types of API docs as a continuum from facts to context: a reference describes the endpoints of an API, guides put those pieces together, and examples solve a specific common problem.

For each endpoint, Fern's guide lists what the reference must cover: the method and path, every parameter with its type, whether it is required and its valid values, and responses with status codes, schemas and example payloads for both success and error. Around the endpoints, the reference needs:

  • Authentication: supported methods, where to get credentials, how to send them, and how tokens expire and refresh.
  • Errors: every error code with what causes it and how to fix it.
  • Rate limits: quotas, time windows and the headers that show remaining capacity.
  • Pagination and versioning: how to page through lists and how changes are introduced.

Generate the endpoint reference from a machine-readable description where possible. Fern describes OpenAPI as the most widely adopted specification format for REST APIs, and a single specification can drive the reference pages, client libraries and tests. Generated reference stays accurate because it changes when the specification changes. Write tutorials, how-to guides and explanation by hand around it.

Docs as code keeps documentation current

The most reliable way to keep documentation correct is to treat it like code. Write the Docs defines docs as code as writing documentation with the same tools as code: issue trackers, version control, plain text markup, code reviews and automated tests. It lists a benefit that matters more than any tool: you can block merging new features that do not include documentation, which pushes developers to document features while they are fresh.

The UK Government Digital Service described the same approach for its technical documentation. Its writers manage content in GitHub so documentation is versioned and matches the way our developers work with code, and anyone can submit a pull request against the docs. The team noted that working this way gives the whole team shared ownership of the content.

A practical docs-as-code setup:

  1. Keep docs in the same repository as the code, or in a sibling repository with the same review rules.
  2. Write in Markdown or another plain text format.
  3. Add a documentation item to the pull request checklist, and review docs changes with the code.
  4. Build the docs site in CI, check links and test code examples.
  5. Publish automatically when changes merge.
  6. Record an owner and a last-reviewed date on each page, and review stale pages on a schedule.

Coding agents now read documentation as often as people do, and they follow it literally. Clear, task-shaped docs help both audiences. Quanta Intelligence skills apply the same idea, packaging how-to knowledge in a structure an agent can load and follow.

FAQ

FAQ

What is the Diátaxis framework?

It is a way of organizing technical documentation into four kinds based on what the reader needs: tutorials for learning, how-to guides for completing tasks, reference for looking up facts, and explanation for understanding. Keeping the four separate lets each page be written for one purpose. Many open source and commercial projects use it to structure their docs.

What should a good README include?

At minimum, a short description of what the project does, installation instructions and a small working example. Most also benefit from links to fuller documentation, contribution instructions and license information. The example should produce a visible result so readers know it worked.

How do I stop documentation from going out of date?

Keep it next to the code, review it in the same pull requests, and make documentation part of the definition of done for a feature. Generate reference pages from an API specification and test code examples in CI. Give each page an owner and review old pages on a schedule.

How long should a tutorial be?

Long enough to reach one meaningful, working result, and no longer. Cut explanation that the learner does not need to finish, and link to explanation pages instead. If a tutorial needs many sections, split it into a series where each part ends in something that works.

Should developers or technical writers write the docs?

Both, ideally. Developers know the details and can write first drafts close to the code, while writers bring structure, consistency and the reader's perspective. A docs-as-code workflow makes it easy for both to contribute and review the same pages.

Sources

Sources

  1. https://buildwithfern.com/post/api-documentation-best-practices-guide
  2. https://diataxis.fr/
  3. https://diataxis.fr/start-here/
  4. https://idratherbewriting.com/blog/what-is-diataxis-documentation-framework
  5. https://github.blog/developer-skills/documentation-done-right-a-developers-guide/
  6. https://guides.lib.berkeley.edu/how-to-write-good-documentation
  7. https://stoplight.io/api-documentation-guide
  8. https://www.writethedocs.org/guide/docs-as-code/
  9. https://technology.blog.gov.uk/2017/08/25/why-we-use-a-docs-as-code-approach-for-technical-documentation/
About the author

About the author

Antonio Evans
Antonio Evans

Antonio Evans is the founder of Quanta Intelligence and a fractional CTO who builds HIPAA-ready AI systems for health and life-science companies. Before that he was technical co-founder of FriendsEAT for twenty years, CEO of Socialdraft, and a data engineer at IBM. Antonio lives with his dog Santino in Lisbon, Portugal.

All articles