Technical Writing and Documentation Questions
The craft of producing durable, reference-quality written artifacts and keeping them accurate: READMEs and quick-start guides, design docs, RFCs and technical proposals, runbooks and deployment guides, model cards, datasheets and data dictionaries, bug reports and reproducible examples, postmortem write-ups, handoff documents, pull request descriptions, code comments, release notes, experiment reports, and knowledge-base articles. Covers structure and information design, writing for a specific audience and for future readers (including plain language and accessibility), templates and style standards, docs-as-code workflows with CI checks, testing of examples and snippets, documentation review and quality checks, versioning and freshness checks on the documents you own, keeping sensitive data out of docs, and measuring whether documentation works. Architecture decision records, API reference docs, PRDs and PR/FAQs, and live presentations are covered elsewhere.
Design a documentation audit for one engineering group to keep its diagrams, runbooks and API docs accurate. How often, who owns it, and what counts as passing?
Sample Answer
Direct answer
I would run a lightweight, mostly automated audit with three parts: continuous checks in CI, a sample-based human review by each owning team (cadence set per artifact type in the table below: each release for API docs, quarterly for tier-1 diagrams, at least every six months for tier-1 runbooks), and an annual full sweep of everything. Each artifact has a named owner, and "passing" means specific, testable criteria per artifact type, not "someone looked at it".
Scope and ownership
- An inventory first: a table listing every diagram, runbook (step-by-step instructions for handling a known operational task or alert) and API doc, with owner, tier (how critical the service is), and last-verified date.
- Owner: the team that owns the service owns its docs; one rotating "doc steward" per team runs the audit, and the engineering manager is accountable for the result. An unowned doc is archived or assigned, never left.
How often
| Artifact | Continuous (CI or alerts) | Human review |
|---|---|---|
| API docs | Contract test (an automated check that the real service behaves as the doc says): the OpenAPI spec (a machine-readable description of the API) is checked against the running service on each merge in CI (the automated checks that run on every change) | Each release |
| Diagrams | Generate from infrastructure-as-code (deployment config files that declare what is deployed) where possible; otherwise diff against deployed resources | Quarterly for tier-1 services, annually for the rest |
| Runbooks | Link and command checker; alert-to-runbook link present | Executed in a game day (a scheduled rehearsal where the team practises an incident and follows the runbooks for real) at least every six months for tier-1 |
What counts as passing (concrete criteria)
- API docs: spec validates, contract test green, and a new developer can make a first successful call from the docs alone (tested with someone who has not used it).
- Diagrams: every box and arrow on a tier-1 diagram matches deployed reality on a spot check; the diagram shows a "verified on" date.
- Runbooks: a person who did not write it completed the procedure in a rehearsal without asking for help, and every alert page links to one.
- Overall: no tier-1 artifact past its verification date, and every defect found has a ticket with an owner.
One artifact against its criteria (illustrative)
Runbook "restart the queue consumer", tier-1. Check 1: linked from the alert page? Yes. Check 2: a teammate who did not write it followed it in a game day. Step 3 said consumerctl restart, but the command had been renamed to consumerctl reload, and the teammate had to ask for help. Result: fail. Ticket opened for the owner, fix merged, teammate re-ran it unaided, verified date updated.
Worked example (illustrative)
Team of 12 services, about 40 artifacts. Q3 audit: the steward samples 10 artifacts, weighted by risk: 5 of the 6 tier-1 artifacts plus 5 of the other 34 (the stratified split described under pitfalls), rather than 10 picked evenly. Three fail: a diagram missing a queue added in July, a runbook whose restart command was renamed, and one API endpoint undocumented. Each becomes a ticket; the team closes them within two weeks and the audit is recorded in one summary line: "10 sampled, 3 failed, 3 fixed".
Trade-offs and pitfalls
- A pure-manual audit dies within two quarters; automate everything checkable and reserve people for judgement (does this runbook actually work).
- Do not measure "percent of docs updated": that rewards touching docs. Measure defects found by the audit and defects found in production incidents; the second should fall.
- Sampling is cheaper than reviewing everything, but stratify by risk (sample more from the critical group instead of picking evenly; for example, 5 of 6 tier-1 artifacts plus 5 of 34 others, rather than 10 chosen at random), otherwise you audit the easy, low-traffic docs.
Design a docs-as-code workflow for a large engineering organisation. How are diagrams, Markdown pages and runbooks validated, built and published alongside code changes, and what blocks a merge?
Sample Answer
Direct answer
I would give every repository one shared documentation pipeline that runs on each pull request (PR, a proposed code change reviewed before merge), plus CI (continuous integration, automated checks on every change): lint the Markdown, check that diagrams parse, build the site in strict mode so broken links fail, run the code samples, and run a "docs gate" that checks required files exist and that code changes come with doc changes. Those checks block the merge. Subjective checks (writing style, page age) only warn. A preview site is built for reviewers, and the real site publishes on merge.
Start here, add later. The core starter set is four checks: the strict site build (catches broken links), Markdown lint, CODEOWNERS, and the docs gate. Diagram parsing, shellcheck, Vale, runbook game days and a docs portal are optional extras that larger organisations add once the basics are trusted.
Pipeline
flowchart LR
A[PR opened] --> B[Fast checks: lint, links, diagrams]
B --> C[Build site strict]
C --> D[Run code samples]
D --> E[Docs gate: required files]
E --> F{All required checks green?}
F -- yes --> G[Merge allowed]
F -- no --> H[Merge blocked]
C --> P[Preview site for reviewers]
What each piece validates
| Piece | Check | Blocks merge? |
|---|---|---|
| Markdown pages | Lint (markdownlint-cli2, a style checker for Markdown), front matter (metadata at the top of a page) present | Yes |
| Diagrams | Kept as text (Mermaid, a text-based diagram format, or similar) and rendered in CI; a syntax error fails the job | Yes |
| Links and navigation | Site built with mkdocs build --strict (MkDocs is a static site generator), which fails on broken internal links | Yes |
| Runbooks (step-by-step guides for handling an operational situation such as an outage) | Required fields (owner, severity, rollback, last-verified date); shell blocks checked with shellcheck (a checker for shell scripts) | Yes for structure, warn if last-verified is old |
| Code samples in docs | Extracted and executed (see the CI file) | Yes |
| Prose style | A prose style linter such as Vale (flags things like passive voice or banned words) | Warn only |
| External links | Checked nightly | No (flaky by nature) |
| Ownership | CODEOWNERS (a file naming required approvers per path) | Yes |
A rule of thumb: block only on checks that are objective and rarely wrong. A gate that produces false alarms teaches people to bypass it.
The CI file (illustrative; it parses as valid YAML)
This is a GitHub Actions workflow (GitHub's built-in CI system). Reading it top to bottom: on: pull_request means run on every pull request; jobs are groups of work; runs-on picks the machine type; steps run in order; uses calls a prebuilt action (here, checking out the code); run executes a shell command. Any failing step fails the job, which blocks the merge.
name: docs
on:
pull_request:
jobs:
docs-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Markdown lint
run: npx --yes markdownlint-cli2 "docs/**/*.md" "services/**/*.md"
- name: Diagrams parse
run: |
for f in $(find docs -name '*.mmd'); do
npx --yes -p @mermaid-js/mermaid-cli mmdc -i "$f" -o "/tmp/$(basename "$f").svg"
done
- name: Build site, broken links fail
run: |
pip install mkdocs-material
mkdocs build --strict
- name: Code samples run
run: python3 tools/check_docs.py docs
- name: Required docs exist
run: python3 tools/docs_gate.py
Large organisations put this in a shared, versioned reusable workflow (a CI workflow defined once and called from many repositories) owned by a platform team, so a rule change is made once. Each service owns its content through CODEOWNERS. A docs portal (one website that collects every repository's built docs) can aggregate each repository's built pages, so readers see one site.
Blocking a deploy when required documents are missing (machine learning example)
For services that ship models, I would fail the deployment stage if the model card (a page describing what the model is for, its data and limits), an inference example and lineage metadata (where its training data came from) are missing. The same script also enforces "doc changes travel with code changes". It ran against this small fixture, a folder named repo (only these files exist; every other required file is absent):
repo/services/scoring/README.md
repo/services/scoring/docs/model_card.md
repo/services/billing/README.md
repo/services/billing/runbooks/restart.md
scoring is an ML service, so it needs a README plus three model docs; only the README and model_card.md exist, so inference_example.md (a runnable sample of calling the model) and lineage.md are reported. billing needs a README and a non-empty runbooks folder, and has both, so it reports nothing. The script:
import pathlib, sys
REQUIRED = { # files every service must have, by service type
"all": ["README.md"],
"ml": ["docs/model_card.md", "docs/inference_example.md", "docs/lineage.md"],
"runbook": ["runbooks"], # a directory with at least one runbook
}
SERVICE_TYPES = {"scoring": ["all", "ml"], "billing": ["all", "runbook"]}
def missing_docs(root):
out = []
for svc, kinds in SERVICE_TYPES.items():
for kind in kinds:
for rel in REQUIRED[kind]:
p = pathlib.Path(root, "services", svc, rel)
if not (p.is_dir() and any(p.iterdir()) if rel == "runbooks" else p.is_file()):
out.append(f"services/{svc}/{rel}")
return out
def docs_travel_with_code(changed, pr_body):
"""Return services whose code changed without any doc change (or an explicit opt-out)."""
if "docs-not-needed:" in pr_body:
return []
code, docs = set(), set()
for f in changed:
parts = f.split("/")
if len(parts) >= 3 and parts[0] == "services": # >= 3 so services/billing/README.md counts as a doc change
(docs if parts[2] in ("docs", "runbooks") or f.endswith(".md") else code).add(parts[1])
return sorted(code - docs)
if __name__ == "__main__":
print("missing required docs:", missing_docs("repo"))
print("code without docs, PR 1:", docs_travel_with_code(
["services/billing/src/retry.py", "services/scoring/src/model.py", "services/scoring/docs/model_card.md"], ""))
print("code without docs, PR 2:", docs_travel_with_code(["services/billing/src/retry.py"], "docs-not-needed: pure refactor"))
Output:
missing required docs: ['services/scoring/docs/inference_example.md', 'services/scoring/docs/lineage.md']
code without docs, PR 1: ['billing']
code without docs, PR 2: []
In PR 1, billing code changed without any doc change, so the gate fails; scoring passes because its model card changed. PR 2 carries an explicit docs-not-needed: reason, which is allowed but visible to reviewers. A service-level file such as services/billing/README.md has only three path parts, so the depth test must be >= 3: with a stricter > 3 test a pull request that changed billing code and its README would be wrongly reported as having no doc change, and a top-level Dockerfile would never be counted as code.
Runbooks and their tests live beside the infrastructure code
- Unit level: lint structure and check every command block parses (
shellcheck), on every pull request. - Integration level: a scheduled job executes the runbook's steps against an ephemeral staging environment (a temporary copy of the production setup, created for the test and torn down afterwards) and runs the verification command in the runbook. Nightly, not per pull request, because it is slow.
- Chaos-style level (deliberately breaking things to see how the team copes): in a game day (a scheduled exercise in a safe environment), inject a real failure in staging, have an engineer follow only the runbook, and record whether service recovered. Run it on a schedule and after major changes.
- Change coupling: a change to the infrastructure code that a runbook covers requires a runbook change or an explicit reason.
Trade-offs
- Gates add friction. Keep the required set small, keep it fast, and give an audited escape hatch (a sanctioned, recorded way to bypass the rule:
docs-not-needed:with a reason) so people are not tempted to disable the check. - Running samples in CI needs sandboxing and time limits, or one slow example blocks everyone.
- Central pipeline versus per-team freedom: central rules keep quality uniform, but teams need a way to add their own checks.
- A required file can be an empty stub. The gate checks presence; a reviewer, guided by CODEOWNERS, checks quality.
Your codebase has thin documentation and new hires take weeks to become productive. Propose a prioritised documentation plan for the first three months, including how you decide which documents to fix first and how you measure the effect.
Sample Answer
Direct answer
Do not try to document everything. Spend the first weeks finding the few documents that, if they existed, would remove the most repeated questions and the most days from a new hire's ramp-up, write those first, and measure onboarding time before and after. Plan in three months: discover and fix the top items (month 1), fill the core set with owners (month 2), and make upkeep routine and measured (month 3).
How to decide what to fix first
- Ask the people who just joined (the last three or four hires): where did you get stuck, what did you ask twice, which question did you answer for the next person? Their answers are better evidence than a guess.
- Mine repeated questions in the team chat channel and support threads, and note which systems get the most "how do I..." asks.
- Score each candidate by (how many people it blocks) times (how often) times (how painful when missing) divided by (effort to write). Write the highest scores first.
Worked example (rate people, frequency and pain 1 to 5, effort in days): setup README 5 x 3 x 5 = 75, divided by 2 days = 37.5; "how we ship" guide 3 x 4 x 5 = 60, divided by 3 = 20; architecture overview 4 x 3 x 4 = 48, divided by 5 = 9.6; a rarely used legacy billing-job page 1 x 1 x 5 = 5, divided by 4 = 1.25. Order: README, ship guide, architecture, billing page last. - Default first set for a codebase: a README that gets a laptop to a running app, an architecture overview, a "how we ship" guide, then service pages.
Three-month plan (with owners and check-ins)
| Period | Deliverables | Owner | Check-in |
|---|---|---|---|
| Days 1-30 | Interview 4 recent hires; rank the gaps; ship the setup README and "first-week checklist"; baseline measurement | Doc lead (the person driving this, possibly a new hire) | Weekly 15 minutes with the engineering manager |
| Days 31-60 | Architecture overview, service pages for the top services, runbooks for the top alerts; each doc gets a named owner | Each service's owning team | Bi-weekly review; demo to a fresh hire |
| Days 61-90 | Upkeep: PR template prompt, "last verified" dates, a quarterly review; retire dead pages; second measurement | Engineering manager | End-of-plan review of the metrics |
The 30/60/90 framing (goals for days 30, 60 and 90) also suits a new hire paying down doc debt (the pile of missing or stale documentation that builds up like unpaid bills): they are the ideal tester, because they discover the gaps as they hit them, and each fix is a visible deliverable.
Optional variant: if the newcomer joins an AI project, first two weeks (short checklist)
- A README that runs the project end to end.
- A model card (a short document stating what the model is for, how it was trained and evaluated, and its limits).
- A data schema (columns, meaning, source, freshness).
- An experiment reproducibility guide (which code, data snapshot, environment and seeds reproduce the baseline result).
The payoff is fewer interruptions for senior people and a faster first useful contribution.
Public versus internal split (optional, secondary to the core plan)
Internal docs (runbooks, architecture, incident history) are for engineers and can be blunt. Public engineering content (blog posts, API docs, talks) should reflect the real platform, so derive it from the internal source of truth and review it for accuracy, rather than writing a separate, prettier version that drifts. Example: the internal runbook says "restart with svcctl reload, then check the queue depth dashboard"; the public API guide keeps the same reload behavior and error codes but drops internal hostnames and the dashboard link. Each part gets its own owner and timeline, and its own metrics.
How to measure the effect
- Ramp time (how long until a new hire is productive): days from start date to first merged PR, and to first on-call shift (their first turn being the engineer who responds to alerts). Compare hires before and after.
- Questions to mentors counted for each new hire (or the fraction of onboarding questions answered by a link).
- Docs feedback: a simple "did this help" at the bottom of each page, and a survey of each new hire at week 4.
- Treat before/after comparisons with caution: hires differ in seniority, so compare like with like and report the count of hires.
Pitfalls
Writing many pages nobody needs; giving no owners, so they rot; and reporting page counts as success.
How would you wire documentation builds into CI/CD for a Python project documented with Sphinx and a JavaScript library documented with JSDoc? Cover validating the build, running doc tests, publishing to a static host, and separating internal from public docs.
Sample Answer
Direct answer. One CI/CD (continuous integration and continuous delivery, meaning automated build, check and release steps triggered by each change) pipeline with a build-and-verify job that fails on any warning, doc tests and link checks in the same job, a publish job that only runs on the main branch, and internal docs built and hosted separately from public docs, never filtered after the fact.
Start with this minimal pipeline; the rest is refinement. Core: build docs with warnings as errors, run the doc tests, publish only from main. Add link checking, internal/public separation and previews once that works.
Terms. Sphinx takes reStructuredText (a plain-text markup format, .rst) and Python docstrings and produces an HTML documentation site. JSDoc reads specially formatted comments in JavaScript source and produces an API reference site. Cross-references are links between documented items, which break when something is renamed. A doctest runs an example written as >>> code and checks the printed result. linkcheck fetches every link and reports dead ones. An artifact is a build output the CI system stores and passes to the next job. A CDN (content delivery network) caches your site on servers near readers. SSO (single sign-on) lets people log in with their company account. An allowlist is a list of exceptions you deliberately permit.
1. Validating the build
- Sphinx (Python):
sphinx-build -W --keep-going -b html docs site/python.-Wturns warnings (broken cross-references, malformed reStructuredText) into errors, and--keep-goingreports all of them at once rather than the first only. Add-b linkcheckfor dead links. - JSDoc (JavaScript):
npx jsdoc -c jsdoc.public.json --pedantic -d site/js.--pedanticmakes JSDoc errors and warnings fatal. Addeslint-plugin-jsdocto lint comment tags in the normal lint step.
2. Doc tests
- Python: the Sphinx
doctestextension executes>>>examples embedded in docs and docstrings:sphinx-build -b doctest docs docs/_doctest(I ran this, and it reported the example passed). - JavaScript: JSDoc does not run examples. I keep runnable examples in real test files (Jest or similar) and reference or copy them into
@example, so a documented snippet cannot drift from working code.
3. Publishing to a static host
Upload the built site/ folder as an artifact and deploy it on merge to main (GitHub Pages shown; the same idea works with Amazon S3 static hosting plus a CDN, or Netlify). Pull requests build and check but do not publish, and may upload a preview.
name: docs
on:
pull_request:
push:
branches: [main]
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/setup-node@v4
with:
node-version: 22
- run: pip install -r docs/requirements.txt
- run: npm ci
- run: sphinx-build -W --keep-going -b html docs site/python
- run: sphinx-build -b linkcheck docs docs/_linkcheck
- run: sphinx-build -b doctest docs docs/_doctest
- run: npx jsdoc -c jsdoc.public.json --pedantic -d site/js
- uses: actions/upload-pages-artifact@v3
with:
path: site
deploy-public:
if: github.ref == 'refs/heads/main'
needs: build-docs
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment: github-pages
steps:
- uses: actions/deploy-pages@v4
Walk-through of the workflow. on: runs it for every pull request and every push to main. Job build-docs checks out the code, installs Python and Node, then runs the same commands as above in order: build the Python docs (fails on any warning), check links, run doc tests, build the JavaScript docs (fails on pedantic errors), and upload the finished site/ folder as the artifact. Job deploy-public waits for build-docs (needs), runs only on main (if), and is the only place with permission to publish (pages: write). Pull requests therefore verify but never publish.
The YAML parses (checked with a YAML parser); I did not run it on GitHub. Check that the action versions are the current majors when you copy it.
4. Separating internal from public docs
- Sphinx: wrap internal content in
.. only:: internaland build public with no tag, internal with-t internal. I built both: the public HTML did not contain the internal section, the internal build did. - JSDoc: mark internals
@private(excluded by default) and build internal with a second config plus--private. - Separate outputs and hosts: the public artifact goes to the public site; the internal build goes to a host behind login (SSO, single sign-on). Never publish the internal build and hide parts with CSS.
- Add a CI check that greps the public output for a marker string used in internal pages, so a mistake fails the build.
Trade-offs. Strict -W can block a release for a trivial warning: fix warnings promptly, do not turn the flag off. Link checks fail on flaky third-party sites: run them on a schedule as well and allowlist known-flaky hosts. Two builds double CI time, which is cheap compared with a leaked internal page.
How would you tell whether your team's documentation is working? Which signals would you collect, how would you collect them, and which popular measure would you distrust?
Sample Answer
Direct answer
I would judge documentation by what happens after someone reads it: do they find what they need, act on it, and stop asking people? So I collect a few behavioural signals (search that fails, questions that repeat, ramp time for new hires), one or two opinion signals (a page rating and a short survey), and I would distrust raw page views, which go up when docs are good and also when they are confusing.
Signals and how to collect them
| Signal | What it tells you | How to collect |
|---|---|---|
| Search abandonment (searches with no click) divided by all searches | People cannot find the answer | Docs site search logs, weekly |
| "Avoidable ticket" share: support tickets or team-chat questions whose answer was already in the docs, divided by all tickets | Docs exist but are not found or not trusted | Tag tickets at closing; sample if volume is high |
| Time to first successful task for new hires (days to first merged PR, first deploy) | End-to-end usefulness | Onboarding tracker |
| Page feedback ("helpful: yes/no" plus a comment box) | Quality on that page, qualitatively | Widget on each page |
| Freshness: share of tier-1 pages (pages for the most critical services) verified in the last 90 days | Trustworthiness | Metadata "last verified" |
| Time to resolve incidents (MTTR, mean time to resolve) where a runbook (step-by-step procedure for an alert) existed versus not | Link to a real outcome | Incident tool, by tag |
MTTR by runbook tag, with made-up numbers: incidents with a runbook took 45, 30 and 60 minutes (mean 135/3 = 45); incidents without one took 90, 120 and 75 (mean 285/3 = 95). The 50-minute gap is a hint, not proof, since the incident types may differ.
Worked example (illustrative data, run it)
# Tiny, made-up docs-effectiveness data (illustrative). Each row is one week.
weeks = [
# (page_views, searches, searches_with_no_click, tickets, tickets_where_answer_was_in_docs)
(900, 200, 90, 40, 14),
(1500, 210, 60, 33, 9), # after rewriting the top pages
]
for i, (views, searches, no_click, tickets, in_docs) in enumerate(weeks, start=1):
print(f"week {i}: views={views}",
f"| search abandonment={no_click / searches:.0%}",
f"| avoidable tickets={in_docs / tickets:.0%} ({in_docs}/{tickets})")
# Onboarding signal: days from start date to first merged pull request
before = sorted([21, 24, 19, 30, 26])
after = sorted([14, 16, 12, 20, 15])
median = lambda xs: xs[len(xs) // 2]
print("median days to first merged PR:", median(before), "->", median(after))
Output:
week 1: views=900 | search abandonment=45% | avoidable tickets=35% (14/40)
week 2: views=1500 | search abandonment=29% | avoidable tickets=27% (9/33)
median days to first merged PR: 24 -> 15
Reading it: after rewriting the top pages, search abandonment fell from 45% (90 of 200 searches) to 29% (60 of 210), avoidable tickets from 35% (14 of 40) to 27% (9 of 33), and the median time to first merged PR from 24 to 15 days. Note that page views rose too; on their own, views could not have told us whether that was good.
Which popular measure I distrust: page views
Views measure traffic, not usefulness. A confusing page produces repeat visits and more views. A great page that answers in one glance also produces views but no follow-up. Other gameable ones are "number of pages written" and "words". Guard by pairing every activity measure with an outcome measure (views with search abandonment; docs written with avoidable tickets).
Quantitative versus qualitative KPIs (key performance indicators, the few numbers you track to judge success) and the response when one drops
Quantitative: the rates above. Qualitative: free-text feedback, and watching a new hire try a task. When a KPI drops, look at the pages contributing most, read the comments, run a 20-minute test with someone who has not seen the page, then fix and re-measure a few weeks later. Also link the improvement to an outcome such as incident time to resolve: compare incidents where the runbook was used with those where it was not.
Pitfalls
Small samples (say which counts are behind a percentage), changing two things at once, and treating a correlation as proof. Say the numbers back a claim about direction, not exact cause.
Unlock Full Question Bank
Get access to all 46 Technical Writing and Documentation interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.