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.
You have a research-style Jupyter notebook and need to turn it into a production-ready tutorial for engineers. What is your plan for the code, the environment, the tests and the written narrative?
Sample Answer
Direct answer. A research notebook is a lab notebook: it records exploration, hidden state and dead ends. A tutorial is a product: it must run from scratch, teach one path, and keep running. My plan moves the logic out of the notebook into tested code, freezes the environment, makes the notebook itself a tested artifact, and rewrites the narrative around one learning goal.
Start with the core four; the rest is polish. Core: (1) the restart-and-run-all audit, (2) extract logic into tested code, (3) pin the environment, (4) run the notebook in CI. Optional extras you can add later: nbstripout, jupytext, a devcontainer, scheduled dependency refreshes.
Terms. A kernel is the background Python process that holds a notebook's variables and runs its cells. A lockfile lists the exact version of every dependency so everyone installs the same thing. A fixture is a small fixed input used by a test. pytest is Python's standard test runner. A diff is the line-by-line comparison shown in code review; raw notebooks store outputs and metadata inside the file, so their diffs are noisy.
1. Code
- Audit first. Run "Restart kernel and run all". Notebooks usually fail here because of out-of-order cells, deleted variables or hard-coded local paths. The failures are the to-do list.
- Extract logic into a small importable package (
tutorial/data.py,tutorial/model.py) with functions that have docstrings. The notebook then calls the code and explains it, instead of holding 80-line cells. - Remove dead ends (cells that did not lead anywhere), or turn the informative ones into a short "what we tried" aside.
- Kill hidden state and magic values: set random seeds in one cell, replace absolute paths with relative ones, and load a small bundled or downloadable sample dataset, so the tutorial runs in minutes on a laptop.
2. Environment
- Pin dependencies in a lockfile (for example generated with
uv lockorpip-tools), and state the Python version. - Provide one command to set up (
make setupor a devcontainer / Dockerfile), and test it on a clean machine or container. If the tutorial needs a GPU, say so at the top and offer a small CPU path. - Document secrets and data access explicitly: no credentials inside the notebook.
3. Tests
- Unit tests (pytest) for the extracted functions, including one tiny-input test whose expected output you can verify by hand.
- Execute the notebook in CI (continuous integration, automated checks on every change) with a plugin such as
nbmake(pytest --nbmake tutorial.ipynb). A notebook that fails to run top to bottom fails the build. - Clean outputs before commit with
nbstripoutso diffs are readable, or pair the notebook with a text version usingjupytext. - Assert loosely on results: check shapes, ranges and "loss decreases", not exact floats that vary across hardware.
4. Narrative
- Pick one learning outcome ("by the end you can fine-tune X on your data") and delete everything that does not serve it.
- Structure: goal and prerequisites, setup, then short steps where each has why, code, and what you should see. Include the expected output so a reader knows they are on track.
- End with common errors, exercises, and links to the deeper research notebook for those who want the full story.
Worked mini-example. A 200-cell churn-modelling notebook with 3 dead-end model experiments becomes: a churn/ package with load_data, build_features, train (unit tested on a 20-row fixture); a 25-cell tutorial notebook; and a CI job that runs pytest and pytest --nbmake on every pull request.
Before and after, one cell. Before, inside the notebook (hard-coded path, hidden filter, hidden state):
rows = load_rows("/Users/me/Downloads/churn.csv")
rows = [r for r in rows if r["tenure"] > 0]
for r in rows:
r["ratio"] = r["spend"] / r["tenure"]
After, the logic lives in churn/features.py:
def build_features(rows):
"""Add spend-per-month ratio; drop rows with zero tenure (no history yet)."""
return [dict(r, ratio=r["spend"] / r["tenure"]) for r in rows if r["tenure"] > 0]
with a test in tests/test_features.py that a reader can verify by hand:
from churn.features import build_features
def test_ratio_and_zero_tenure_dropped():
rows = [{"spend": 30.0, "tenure": 3}, {"spend": 10.0, "tenure": 0}]
out = build_features(rows)
assert [r["ratio"] for r in out] == [10.0]
(30 / 3 = 10, and the zero-tenure row is dropped rather than dividing by zero.) The notebook cell shrinks to rows = build_features(load_rows(DATA_PATH)) plus a sentence explaining why zero-tenure customers are excluded. I executed the function and this test; it passes.
Trade-offs. Tests cost maintenance, so test the code paths a learner depends on, not every cell. Pinning gives reproducibility today but needs a scheduled dependency refresh (a monthly CI run) so the tutorial does not rot. Rewriting for clarity loses some research nuance, which is why I link the original notebook rather than delete it.
A schema change is planned for a table that many downstream systems consume. What do you write, who do you tell, and how do you make the migration steps hard to misread?
Sample Answer
Direct answer
I write a short change notice that states exactly what changes, when, and what each consumer must do, plus a numbered migration plan where every step names one owner, one command, the expected result and the rollback. I tell the owners of every downstream consumer directly (not just a channel post), found from lineage tooling (a catalog that records which tables and jobs feed which others) and query logs, and I choose a compatible way to change the table so most consumers have nothing urgent to do. The method is the standard expand / contract pattern: first expand (add the new column beside the old one), then let every consumer migrate at its own pace, and finally contract (remove the old column). A consumer is any job, dashboard or service that reads the data; the producer is whatever writes it.
What I write
A condensed notice, before the breakdown of its parts (illustrative):
Subject: orders.total (dollars) replaced by orders.total_cents, old column removed 2026-11-02 (UTC)
Why: consumers that read dollar amounts as floating point drift by fractions of a cent when they sum many rows, and integer cents are exact.
What changes: sales.orders gains total_cents (integer, cents). total stays until 2026-11-02, then is dropped.
Who must act: anyone selecting `total`. Switch to total_cents and multiply/divide by 100 where needed.
Dates: expand 2026-09-29 | migrate by 2026-10-26 | contract 2026-11-02
Verify: SELECT count(*) FROM sales.orders WHERE round(total*100) <> total_cents; -- expect 0
Rollback: until 2026-11-02, revert your query to total. After that, restore from the 2026-11-01 snapshot.
Contact: #commerce-data-help. Reply to this thread to acknowledge.
The parts, one by one:
A one-page notice with these parts:
| Part | Example content |
|---|---|
| Summary in the title | "orders.total (dollars) replaced by orders.total_cents (integer), old column removed 2026-11-02" |
| Why | Floating-point drift when downstream tools sum dollar amounts as decimals-in-floats (the column itself is exact numeric(10,2)); integer cents are exact in every tool. |
| Before and after | A two-column table of old and new schema, with types. |
| Compatibility class | Additive (safe) or breaking (rename, type change, drop). This one is breaking for the old column, so it is done in phases. |
| Timeline with absolute dates | Expand 2026-09-29, migrate by 2026-10-26, contract 2026-11-02 (with time zone). |
| Steps per consumer type | Batch, streaming, dashboards. |
| Rollback and contact | Who to call, what "undo" means at each phase. |
Who I tell
- Build the consumer list from lineage tooling, warehouse query logs (who selected this table in the last 90 days), dashboards, and scheduled jobs. Nobody's memory is a complete list.
- Message each owning team directly and ask for an acknowledgement. Track acknowledgements in a checklist in the notice, and chase the missing ones.
- Post once in the shared channel and send a calendar hold for the cut-over date.
- For consumers I cannot identify, the deprecation window is the safety net: the old column stays until the date, and I check query logs before the final drop.
Making the steps hard to misread
- One action per numbered step, with the exact command, the expected output and a "done when" line.
- Dates are absolute (2026-10-26, UTC), never "next sprint" or "soon".
- Old and new names sit side by side in a table, and the notice uses one term per concept.
- Every step has a verification query and a rollback line.
Worked example (run on Postgres 16)
Phase 1 expands: add the new column as a generated column, so the database keeps it equal to the old one and nobody has to write both. Old readers keep working, new readers can start:
DROP SCHEMA IF EXISTS sales CASCADE; CREATE SCHEMA sales;
CREATE TABLE sales.orders (order_id bigint PRIMARY KEY, total numeric(10,2) NOT NULL);
INSERT INTO sales.orders VALUES (1, 19.99), (2, 5.00);
-- Step 1 (expand): add the new column, derived from the old one, so nothing can drift
ALTER TABLE sales.orders
ADD COLUMN total_cents integer GENERATED ALWAYS AS (round(total * 100)::integer) STORED;
-- Step 2 (verify): old readers and new readers both work, and agree
SELECT order_id, total, total_cents FROM sales.orders ORDER BY order_id;
SELECT count(*) AS mismatches FROM sales.orders WHERE round(total * 100) <> total_cents;
Output:
order_id | total | total_cents
----------+-------+-------------
1 | 19.99 | 1999
2 | 5.00 | 500
(2 rows)
mismatches
------------
0
(1 row)
Phase 2 (dates in the notice): each consumer switches from total to total_cents and confirms. Phase 3 contracts: make the producer write the new column, then drop the old one. I ran it in this order and it worked. The three statements do this: DROP EXPRESSION turns the generated column into an ordinary stored column that keeps its current values (a generated column cannot be written by the producer, and it depends on total, so dropping total first would be refused); SET NOT NULL restores the rule that every row must have a value, which the ordinary column no longer enforces on its own; then total can be dropped safely:
ALTER TABLE sales.orders ALTER COLUMN total_cents DROP EXPRESSION;
ALTER TABLE sales.orders ALTER COLUMN total_cents SET NOT NULL;
ALTER TABLE sales.orders DROP COLUMN total;
Compatibility guarantees for streaming and batch consumers
- Batch consumers (scheduled jobs and dashboards reading the table) break on renamed or dropped columns and on
SELECT *that assumes column position. Promise: added columns are non-breaking for anyone who names their columns; nothing is removed before the announced date. - Streaming consumers read a continuous flow of messages (in Kafka-style systems, stored in a named log called a topic), often described by a schema registry (a service that stores each message format and checks new versions against the old). Its compatibility modes are BACKWARD (readers on the new schema can read old messages), FORWARD (readers on the old schema can read new messages) and FULL (both). Tiny example: adding
total_centswith a default of 0 is compatible, because a new reader fills the default when reading an old message and an old reader ignores the extra field in a new message. A rename oftotaltototal_centsis a remove plus an add: old messages lacktotal_centsand new messages lacktotal, and neither reader has a default for the missing field, so it is breaking under all modes. So I publish both fields during the overlap. - Streaming has one more trap: a stream keeps its history, unlike a table that shows only the current state. Old messages stay in the topic, so a consumer that replays (re-reads from the start) sees both formats and must handle both.
Trade-offs and pitfalls
- A long dual-running period is safer but costs storage and confusion. Set it by the slowest consumer you cannot force, and put the date in writing.
- A silent "small" fix to a column type is the classic outage. Anything that changes meaning or type is breaking, even if the name is the same.
- Dropping the old column on the date without checking query logs turns an announcement into an incident.
You are about to run a large backfill. What do you document before, during and after it, how do you tell stakeholders, and how would you automate the after-the-fact checks?
Sample Answer
Direct answer
A backfill (re-computing or loading historical data for a past period) needs three short records (concrete examples of each follow, using the 1 to 3 August demo below): a plan before, a progress log during, and a results record after. I would tell stakeholders three times only: a heads-up before (what numbers may change, when, who to ask), a note at each state change during (started, paused, finished), and a before/after summary at the end. The after-the-fact checks run automatically and compare the target with the source, partition by partition.
Before: the plan
- Purpose and scope: which table, which date range, why the data is wrong today.
- Method: process one partition (one day's slice of the table, which can be replaced on its own) at a time, and make each partition idempotent (running it twice gives the same result), typically by replacing the whole partition.
- Expected outcome: row counts and totals from the source of truth (the system whose numbers everyone agrees are correct), written down before the run so the result cannot be graded after the fact.
- Safety: a dry run on one partition, a throttle (a deliberate speed limit so it does not starve production), a run window away from peak hours or finance close (the days when the finance team finalises the month's figures), and a rollback (a backup or shadow table, meaning a full copy you can swap back in).
- Named owner, and a stop rule ("stop if any check fails or the run exceeds X").
During: the progress log
A progress log (a plain table, not the finance ledger) with one line per partition: start time, end time, rows written, result. It is what lets you resume after a crash without guessing where you were.
Concrete examples for the demo below (per-day figures are the counts the script's seed produces):
PLAN (written before the run)
Table: daily_revenue, 2026-08-01 to 2026-08-03, one partition per day, replace whole partition.
Expected from src_orders: 08-01 = 5 orders / 12346 cents; 08-02 = 4 / 11384; 08-03 = 4 / 10253.
Stop rule: stop on any failed check. Owner: commerce-data.
PROGRESS LOG (during)
partition start end rows result
2026-08-01 22:00 22:01 1 ok
2026-08-02 22:01 22:02 1 ok
2026-08-03 (crashed before start; resume here)
After: the results record
Actual against expected, which checks passed, anomalies, any downstream job that must be re-run, and a changelog entry (a dated line saying what was restated and why). Close the loop with the ticket. Example:
RESULTS
Actual == expected for all 3 partitions (13 orders, 33983 cents). No anomalies.
Re-run needed: weekly_revenue dashboard extract.
Changelog 2026-09-28: daily_revenue restated for 2026-08-01..03 (missing orders added).
Stakeholders
| When | Who | Message |
|---|---|---|
| Before | Owners of dashboards and reports on this table, finance or exec consumers, on-call | "Numbers for 1 Aug to 30 Sep will be restated between 22:00 and 04:00. Expect partial data in dashboards. Contact X." |
| During | Same list, only on state changes | Started, paused, resumed, done. Not a running commentary. |
| After | Same list plus anyone who reported the old numbers | "Restated. Old vs new for the affected range, and which published figures changed." |
Automated after-checks (runnable)
The checks compare each partition's row count and sum with the source, insist on exactly one target row per day, and flag rows outside the range. The demo simulates a crash before day 3, then a resume, then a harmless re-run of day 1:
import random, sqlite3
db = sqlite3.connect(":memory:")
db.executescript("""
CREATE TABLE src_orders (order_id INTEGER PRIMARY KEY, order_date TEXT, amount_cents INTEGER);
CREATE TABLE daily_revenue (order_date TEXT, orders INTEGER, revenue_cents INTEGER);
""")
rng = random.Random(7) # pinned seed: same data on every run
days = ["2026-08-01", "2026-08-02", "2026-08-03"]
oid = 1
for d in days:
for _ in range(rng.randint(4, 6)):
db.execute("INSERT INTO src_orders VALUES (?,?,?)", (oid, d, rng.randint(500, 5000)))
oid += 1
def backfill_day(d): # idempotent: replace the whole partition
db.execute("DELETE FROM daily_revenue WHERE order_date = ?", (d,))
db.execute("INSERT INTO daily_revenue SELECT order_date, COUNT(*), SUM(amount_cents) "
"FROM src_orders WHERE order_date = ? GROUP BY order_date", (d,))
def run_checks(days):
failures = []
for d in days:
s = db.execute("SELECT COUNT(*), COALESCE(SUM(amount_cents),0) FROM src_orders WHERE order_date=?", (d,)).fetchone()
t = db.execute("SELECT COUNT(*), COALESCE(SUM(orders),0), COALESCE(SUM(revenue_cents),0) "
"FROM daily_revenue WHERE order_date=?", (d,)).fetchone()
if t[0] != 1: failures.append(f"{d}: expected 1 target row, found {t[0]}")
elif (t[1], t[2]) != s: failures.append(f"{d}: source {s} != target {(t[1], t[2])}")
stray = db.execute("SELECT COUNT(*) FROM daily_revenue WHERE order_date NOT IN (%s)"
% ",".join("?" * len(days)), days).fetchone()[0]
if stray: failures.append(f"{stray} rows outside the backfill range")
return failures
for d in days[:2]: backfill_day(d) # simulated crash: day 3 never runs
print("after partial run:", run_checks(days))
backfill_day(days[2]) # resume
backfill_day(days[0]) # re-running a finished day must be harmless
print("after resume:", run_checks(days))
Output:
after partial run: ['2026-08-03: expected 1 target row, found 0']
after resume: []
The pinned seed makes the data identical on every run. The check after the crash catches the missing day; after the resume everything reconciles, and re-running a finished day changes nothing, which is what idempotent means in practice.
Trade-offs and pitfalls
- If the check is computed from the same source and the same logic as the backfill, it will agree with a wrong backfill. Add one independent reconciliation, for example daily totals from the accounting system's ledger (its official record of revenue), plus a spot check of a few individual records.
- Full-table sums on huge tables cost real compute. Check per partition and sample the rest.
- Do not announce "complete" until the checks have passed; announce "loaded, verifying".
Build a minimal reproducible example for a data-skew problem in a join over a large orders table. What data, query and expected-versus-actual result do you include, and what do you strip out to keep it minimal?
Sample Answer
Direct answer
Data skew means a few key values hold most of the rows. A distributed join (a join run across many machines, for example in Spark) sends all rows with the same key to one worker, so with skew one partition (that worker's slice of the data) gets far more of the work. The whole job then waits on that one worker. A key holding most of the rows is called a hot key. A minimal reproducible example (the smallest data and query that still shows the problem, which anyone can run) needs a tiny synthetic table with the same key distribution as the real one, the join query, and a measured expected-versus-actual.
What I include
- Data: an orders table and a customers table, generated with a fixed seed. Only the join key matters, so the only real property to preserve is its frequency shape: here one customer holds about 90% of orders.
- Query: the join with the aggregate.
- Expected versus actual: expected, rows per partition roughly equal (largest close to the average); actual, one partition holds most rows.
import sqlite3, random
random.seed(42)
db = sqlite3.connect(":memory:")
db.execute("CREATE TABLE customers (customer_id INTEGER PRIMARY KEY, region TEXT)")
db.execute("CREATE TABLE orders (order_id INTEGER PRIMARY KEY, customer_id INTEGER, amount INTEGER)")
# 50 customers; customer 0 is a bulk reseller that places 90% of the 1,000 orders
db.executemany("INSERT INTO customers VALUES (?, ?)",
[(i, "EU" if i % 2 else "US") for i in range(50)])
rows = []
for order_id in range(1000):
cid = 0 if random.random() < 0.9 else random.randint(1, 49)
rows.append((order_id, cid, random.randint(5, 100)))
db.executemany("INSERT INTO orders VALUES (?, ?, ?)", rows)
print("orders per customer, top 3:")
for r in db.execute("""SELECT customer_id, COUNT(*) AS n FROM orders
GROUP BY customer_id ORDER BY n DESC LIMIT 3"""):
print(" ", r)
# A distributed join sends each join key to one worker. Real engines use a hash partitioner
# (a function that maps a key to a partition number); key % 4 is a simple stand-in.
sizes = [0] * 4
for (cid,) in db.execute("SELECT customer_id FROM orders"):
sizes[cid % 4] += 1
print("rows per partition:", sizes)
print("largest / average:", round(max(sizes) / (sum(sizes) / 4), 2))
joined = db.execute("""SELECT c.region, SUM(o.amount) FROM orders o
JOIN customers c ON c.customer_id = o.customer_id
GROUP BY c.region ORDER BY c.region""").fetchall()
print("join result:", joined)
Output:
orders per customer, top 3:
(0, 895)
(31, 6)
(39, 5)
rows per partition: [921, 18, 30, 31]
largest / average: 3.68
join result: [('EU', 2357), ('US', 50949)]
Reading it: customer 0 has 895 of 1,000 orders (89.5%). With 4 partitions, partition 0 gets 921 rows (customer 0 plus others that share partition 0), which is 3.68 times the average of 250 (921 / 250), close to the worst possible ratio of 4 (the maximum, reached when all rows land on one of the 4 partitions, since that partition then holds 4 times the average). Expected is about 1.0.
What I strip out
- Rows: 1,000 instead of millions. Skew is about proportions, not size.
- The other columns and tables that the join does not touch, and personal data (real customer IDs become integers). Synthetic means generated data, not a copy of the real table.
- Unrelated filters, unrelated jobs, and cluster-specific configuration.
How I know the strip-down is safe
After each removal I re-run the check and confirm the ratio is still far above 1. If removing something makes it disappear (for example, spreading the hot key), that part was essential and goes back in. Running this on the same data gave real numbers. The second line comes from adding this to the script above, which scatters the hot key's orders by mixing each order id into the key before partitioning:
spread = [0] * 4
for order_id, cid, _ in rows:
spread[(cid * 31 + order_id) % 4] += 1
print(spread, round(max(spread) / 250, 2)) # [234, 256, 261, 249] 1.04
keys only (drop amount and the customers table): ratio 3.68 -> safe removal
hot key spread (each order id mixed into its key): rows per partition [234, 256, 261, 249], ratio 1.04 -> skew gone, so the hot key is essential
Honest limits
The customer_id % 4 rule is a stand-in for the engine's real partitioner, so on the real engine I would add the engine name and version, the partition count, and the slow task's duration against the median, since those cannot be derived from the toy.
Pitfalls
- Uniform random data, which never reproduces skew.
- Keeping real data, which is large, sensitive and slow to share.
- Reporting only "the job is slow" without the per-partition evidence.
In your own words, what makes a piece of technical documentation good? Walk me through how you would judge a document you have just inherited from a colleague.
Sample Answer
Direct answer
Good technical documentation lets a specific reader finish a specific task correctly without asking the author. So I judge it on four things: is it aimed at a clear reader and task, is it true today, can the reader find what they need fast, and can they verify it by doing what it says. Everything else (polish, length, diagrams) is secondary.
How I would judge an inherited document, in order
- Name the reader and the job. Who was this written for (a new hire, an on-call engineer, an analyst) and what should they be able to do afterwards? If I cannot tell, that is the first defect. Different deliverables serve different readers: a README (the front-page file of a code repository) gets someone running the thing, a slide deck persuades a decision-maker in one sitting, and an API reference is scanned by a developer looking up one parameter. A good document fits its reader, so judging "good" without naming the reader is meaningless.
- Check it is current. Compare the last-edited date to the last meaningful change in the system. Look for a named owner. Spot-check five concrete claims (a command, a config name, a diagram box) against reality.
- Run it. Follow the steps literally in a clean environment. Every place I have to guess or ask someone is a bug in the document.
- Test findability. Can I answer three realistic questions in under two minutes using only headings, the table of contents and search? Are there prerequisites up front and a clear "if this fails, do this"?
- Decide: keep, fix, or retire. Fix the top few defects, delete what is wrong or duplicated elsewhere, and add an owner and a review date. A stale document that looks authoritative is worse than none.
Worked example
I inherit a README for a nightly ingestion service. It has a 40-line "Overview" of the team's history but "Setup" says only "install dependencies and run main". Step 1: the reader is a new engineer who needs to run it locally. Step 2: the document names an environment variable that no longer exists in the code. Step 3: following it literally fails at the second command. Step 4: the failure-handling section is missing. Verdict: fix. I move setup to the top, correct the variable, add a "known failure: expired credentials, how to renew" entry, cut the history to two lines, and record myself as owner with a quarterly review.
Trade-offs and pitfalls
- Length is not quality: a short accurate page beats a long stale one.
- Do not judge only prose style. A beautifully written document with a wrong command fails its reader.
- Do not rewrite everything on inheritance. Fix what blocks the main task first, then improve iteratively.
Unlock Full Question Bank
Get access to all 28 Technical Writing and Documentation interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.