Technical Documentation Examples: 8 Templates to Copy

Raghav Chamadiya11 min read
On this page

Technical documentation examples are easiest to learn from when you see the document type, its reader and a template side by side. Engineering teams write eight of them most often: a README, an architecture overview, a software design document, an architecture decision record (ADR), an API reference, a runbook, an onboarding doc, and code comments. Each has a compact template you can paste into a repository today, plus the part that goes stale first.

I write most of these as plain Markdown files in the repo. That choice does more for quality than any template, because a document in the diff gets reviewed, and a document outside the repo gets forgotten.

What counts as technical documentation?

Technical documentation is any written material that explains how a system is built, used or operated. It splits by reader. Users of an API need a reference. A new hire needs a reading order. The engineer paged at 3 a.m. needs a runbook, not an essay.

A useful way to sort the types:

DocumentReaderJobLives in
READMEAnyone who opens the repoGet running in ten minutesrepo root
Architecture overviewNew and senior engineersShow the shape of the systemdocs/architecture.md
Software design documentReviewers before a buildAgree on an approachdocs/design/
ADRFuture maintainersExplain one decisiondocs/adr/
API referenceCallers of your codeSay exactly what an endpoint doesgenerated from code
RunbookOn-call engineerFix a known failuredocs/runbooks/
Onboarding docNew hireReach a first merged changedocs/onboarding.md
Code commentsThe next person editing the fileExplain whythe source file

Scroll the table sideways to see every column.

If you want the longer treatment of the code-level types, see code documentation: types, examples and best practices. This post goes wider and gives you a template for each document.

README example

A README gets a stranger from clone to a running project. The reader is impatient and has no context. Lead with what the project is in one sentence, then the shortest path to running it.

markdown
# project-name

One sentence: what this does and who it is for.

## Run it locally
    make setup
    make dev        # serves on http://localhost:8000

## Run the tests
    make test

## How it fits in
Who calls this service, what it calls. Link to docs/architecture.md.

## Configuration
Every environment variable, with its default.

## Decisions
Link to docs/adr/.

What goes stale first: the commands. A renamed make target or npm run script breaks the "Run it locally" block, and the next new hire finds out before you do.

Architecture overview example

An architecture overview answers "what are the parts and how do they talk?" on one page. It is the document people open second, right after the README. Keep it to the shape of the system. Detail belongs in the design documents.

markdown
# Architecture overview

## Context
What the system is for and who uses it. One diagram.

## Containers
| Part | Responsibility | Talks to |
|---|---|---|
| api | HTTP interface, auth | worker, postgres |
| worker | Background jobs | postgres, queue |

## Key flows
Numbered steps for the two or three flows that matter (a request, a job).

## Boundaries and rules
What may import what. Where data is owned.

## Decisions
Links to the ADRs behind the shape.

The "Context" and "Containers" headings come from the C4 model. The C4 model explained shows how to draw each level.

What goes stale first: the table of parts. A new service or a merged module changes it, and the diagram usually lags longest.

Software design document example

A software design document (SDD, or design doc) proposes an approach before anyone builds it, so reviewers can challenge it while it is cheap. The reader is a reviewer with 15 minutes. If your design doc runs past a few pages, split it.

Here is a software design document sample skeleton. It is the shape most teams converge on:

markdown
# Design: <feature name>

Author: <name>   Status: draft | in review | approved   Date: <yyyy-mm-dd>
Reviewers: <names>

## Summary
Two or three sentences. What we are building and why now.

## Goals and non-goals
Goals: what must be true when this ships.
Non-goals: what we are deliberately not doing.

## Background
What exists today. Link to the architecture overview.

## Proposed design
The approach. Data model, interfaces, the main flow.
Include one diagram if it replaces a page of text.

## Alternatives considered
Each option, and why it lost. This is the section reviewers read first.

## Risks and open questions
What could go wrong. What we do not know yet.

## Rollout and testing
How it ships, how we know it works, how we undo it.

Two parts earn their place. Non-goals stop scope creep in review. Alternatives considered is where design reviews actually happen, because it shows the author looked past the first idea.

A design doc is not a decision record. Once approved, pull the one or two durable choices into ADRs, because the design doc will not be maintained after launch.

What goes stale first: the whole document, within a release or two. Mark its status as "implemented" and link the ADRs, so nobody treats it as current.

ADR example

An architecture decision record captures one decision: the context that forced it, what you chose, and what follows from it. Michael Nygard proposed the format in 2011, and it is deliberately short. The reader is an engineer a year from now asking "why on earth is it built this way?".

markdown
# ADR 0007: Use a job queue for webhook delivery

## Status
Accepted (2026-11-10). Supersedes ADR 0003.

## Context
Webhook delivery ran inside the request. Slow receivers held
connections open and caused timeouts for unrelated requests.

## Decision
Deliver webhooks from a background worker fed by a queue.
Retry with backoff for 24 hours, then drop and log.

## Consequences
Requests no longer wait on receivers. Delivery is at-least-once,
so receivers must be idempotent. We now operate a queue.

Three ADR examples of the kind that earn a file: picking a database, choosing a sync or async boundary, and banning a dependency. Skip choices that are easy to reverse. One decision per file, numbered, never edited after acceptance except to change its status.

The glossary entry for architecture decision records defines the format, and how to capture the why with ADRs covers when to write one and how to recover decisions nobody recorded.

What goes stale first: the status line. A decision gets superseded and the old record still says "Accepted".

API documentation example

An API reference tells a caller exactly what an endpoint accepts, returns and fails with. The reader is mid-integration and wants to copy a working request. Show the call, the response, and the errors, in that order.

markdown
## POST /v1/orders

Create an order. Requires a bearer token with the `orders:write` scope.

### Request
    curl -X POST https://api.example.com/v1/orders \
      -H "Authorization: Bearer $TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"sku": "A-100", "quantity": 2}'

| Field | Type | Required | Notes |
|---|---|---|---|
| sku | string | yes | Must exist in the catalog |
| quantity | integer | yes | 1 to 100 |

### Response 201
    {"id": "ord_123", "status": "pending", "total_cents": 4200}

### Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_quantity | quantity outside 1 to 100 |
| 404 | unknown_sku | sku not in catalog |
| 429 | rate_limited | retry after the `Retry-After` header |

Do not write this by hand if you can avoid it. Generate the reference from an OpenAPI spec or from the docstrings in your code, and write only the guides and examples around it. The OpenAPI specification is the common format, and the generators for each language are listed in the code documentation guide.

What goes stale first: error codes and defaults. They change in code reviews that never touch the docs.

Runbook example

A runbook is a step-by-step response to one known failure, written for someone tired and under pressure. The reader is on call. Every word that is not a command or a decision costs them time, so write it that way.

markdown
# Runbook: queue backlog above threshold

Alert: `queue_depth_high`   Owner: platform   Last tested: <date>

## Impact
Webhook delivery is delayed. No data loss.

## Check
1. Open the queue dashboard. Is depth still rising?
2. `kubectl logs deploy/worker --tail=100` : repeated errors?

## Fix
- Workers crash-looping: roll back the last deploy. `make rollback`
- Receiver timing out: pause that receiver. `make pause RECEIVER=<id>`
- Depth rising, workers healthy: scale workers. `make scale N=8`

## Escalate
If depth is still rising after 20 minutes, page the platform lead.

## After
Write the incident note. Update this runbook if a step was wrong.

The "Last tested" field matters more than it looks. A runbook nobody has run in a year is a guess.

What goes stale first: commands and dashboard names. They are the parts the on-call engineer will paste, so they are the parts that hurt when wrong.

Onboarding doc example

An onboarding doc gives a new engineer a reading order and a first task, so they stop asking where to start. The reader has laptop access and no map. Order the links by what they need in week one, and end with a real first change.

markdown
# Onboarding: your first week

## Day 1: get it running
1. Follow the README in repo-name.
2. Run the tests. If anything fails, tell #eng-help.

## Day 2: learn the shape
Read in this order:
1. docs/architecture.md
2. docs/adr/ (start with the five most recent)
3. The module you will work in: src/orders/README.md

## Who owns what
| Area | Owner | Ask about |
|---|---|---|
| orders | Priya | pricing rules |
| infra | Sam | deploys, queue |

## First change
Pick a labelled `good-first-issue`. Open the PR by Friday.

For the longer version of this, with how to generate the reading order from the code, see the codebase documentation guide.

What goes stale first: the owners table. People move teams and the table keeps the old names.

Code comments and docstring examples

A good comment explains why. The code already shows what. The reader is the next person editing this file, and they need the reason a line looks strange before they "fix" it.

python
# Bad: restates the code.
# Loop over users and send email.
for user in users:
    send_email(user)

# Good: records the reason.
# WHY: send serially. The mail provider rate-limits at 10/s and
# a burst gets the whole account throttled for an hour.
for user in users:
    send_email(user)

A docstring is the other half: it states the contract of a function so callers do not read its body.

python
def refund(order_id: str, amount_cents: int) -> Refund:
    """Refund part or all of an order.

    Raises OrderNotFound if the order does not exist.
    Raises RefundTooLarge if amount_cents exceeds the unrefunded total.
    Idempotent: calling twice with the same arguments refunds once.
    """

What goes stale first: a docstring that lists parameters. Someone adds an argument and leaves the docstring alone. Document behavior and errors, not the signature the type system already states.

How do you keep technical documentation current?

Keep documents in the repository, next to the code, and check them the way you check tests. Docs outside the repo have no diff, no reviewer and no CI. Docs inside it can be wired into the pull request.

Four habits cover most of the drift:

  1. Put docs in the same pull request as the change. Add a line to the PR template: "Docs updated or not needed."
  2. Give every document an owner and a date. The runbook's "Last tested" line is the model.
  3. Mark superseded documents. A design doc marked "implemented" and an ADR marked "superseded" stop misleading people.
  4. Check references automatically. A path, a link, a heading anchor, a command: each is a claim the repository can confirm or refute. A docs-as-code setup runs these checks in CI, and the documentation as code guide covers the workflow. The wider problem is covered in stale documentation and how to fix it.

How repowise keeps these documents current

repowise covers three of the pieces above from the code itself.

The wiki. At index time repowise builds a wiki with a page per source file, per selected public symbol, per subsystem and per API surface, plus a repository overview and an onboarding collection. It updates incrementally on each commit. Most of it is rendered from the code's structure with no model, so it is the part of your documentation that cannot drift. You can read one on a real repository at fastapi/fastapi, or see the wiki feature.

Decision records. repowise reads the reasoning your team already wrote (ADR files, # WHY: comments, commit messages, pull request bodies) and serves it back when you or an agent edit the files it governs. Agents record their own decisions as they make them. See decisions.

Doc drift. repowise doc-drift checks five kinds of claim in your Markdown against the repository: paths, links between documents, links to headings, commands and symbol names. In CI the path, link, heading and command checks need no index and no model:

bash
repowise doc-drift --check --format github

It exits non-zero when a document refers to something the code no longer has, and annotates the pull request. Details are in the doc drift docs. The README's stale make target and the runbook's renamed script are exactly the kind of thing it catches.

FAQ

What are examples of technical documentation?
Common examples are a README, an architecture overview, a software design document, an architecture decision record, an API reference, a runbook, an onboarding guide and code comments or docstrings. Each serves a different reader, so most projects need several short documents instead of one large one.
What are the four types of documentation?
A widely used split is tutorials, how-to guides, reference and explanation, from the Diataxis framework. Tutorials teach, how-to guides solve a task, reference lists facts, and explanation gives background. The eight documents above map onto these: a runbook is a how-to, an API reference is reference, an ADR is explanation.
What goes in a software design document?
A summary, goals and non-goals, background, the proposed design, alternatives considered, risks and open questions, and a rollout and testing plan. The alternatives section is the one reviewers rely on most, because it shows the author weighed other options.
What is the difference between a design document and an ADR?
A design document proposes an approach for a feature before it is built and is reviewed once. An ADR records a single decision after it is made and stays in the repository as history. Teams usually extract the durable choices from an approved design document into ADRs.
What are the 7 C's of technical writing?
The usual list is clear, concise, concrete, correct, coherent, complete and courteous. It comes from the 7 Cs of communication, a checklist usually traced to Cutlip and Center's 1952 book on public relations, which technical writing courses later adopted. For documentation in a repository, correct is the one that decays: a path, command or error code that was right at merge and wrong six months later.
How do I stop technical documentation going stale?
Keep it in the repository, update it in the same pull request as the code, and check it in CI. Paths, links, heading anchors and commands can be verified automatically, which catches the most common breakage before a reader finds it.