How to Write Documentation With AI Without Inventing Things

· 6 min read

You supply the kind of document and the real facts, the assistant drafts and hunts for gaps, and you run every step and check every claim before anyone relies on it. Written up from memory, a draft can contain an option or endpoint that does not exist (our inference), so the material has to come from you.

For reading code, see using AI to understand code you did not write. Nobody on our side has run an assistant on these documents; we read each cited page on 5 December 2026; any may have changed.

Which kind of document am I writing?

Diátaxis, a published framework, says on its Start here page that there are "fundamentally four identifiable kinds of documentation, that respond to four different needs": tutorials, how-to guides, reference and explanation. Pick by what your reader needs: to learn, get a task done, look something up or understand why (our shorthand). Three common documents:

  • README. Write the Docs' How to write software documentation gives a README template and advice on showing the problem solved, installing, getting support and the license.
  • Runbook or playbook. Google SRE: What it Means Being On-Call? uses the word playbook for instructions on responding to automated alerts; some SREs at Google advocate keeping entries general, others step-by-step ones.
  • API reference. Diátaxis Reference says software can generate some of it, keeping it faithful to the code, but that generated reference alone is not enough.

What should I give the assistant, and what stays out?

Give it what it cannot guess:

  • Your notes and runs. Give it an outline in your own order, one sentence on the reader and their goal, and each command as typed with the output and errors you saw.
  • The reference. Give it the real --help output or, for an API, its description file, such as one in the OpenAPI Specification format. Treat an endpoint or field missing from it as unconfirmed until you find it in the code or a real response.

Ask for a draft only from those, marking every statement it cannot trace to them. The marking can be wrong, so check every sentence.

Replace secrets, customer details and private names with descriptive placeholders such as DEPLOY_TOKEN. Google's Format placeholders page says to use uppercase with underscore delimiters and to explain a placeholder where you first use it, so keep each placeholder in the published text, explain what goes there and never publish the real value. Treat a secret you already pasted into a chat as exposed and revoke it (our inference); see the AI assistant privacy checklist. Customer-data rules vary with where you work and live; this is not legal advice, so check your own.

What does AI invent when it writes documentation?

It can invent anything with the usual shape of an answer: an option, a setting, an endpoint, a default, a version, even a license or support route that only you can state (our inference); why AI makes things up covers the cause. Write the Docs' Documentation principles say to consider incorrect documentation worse than missing documentation. Reasons are a risk too: Diátaxis Explanation covers design decisions and history, and a drafted rationale may not be the real one (our inference).

What does a wrong documentation step look like?

The notes and the draft below are ours, not assistant output; the commands were real runs in throwaway folders on one Linux machine with GNU coreutils 9.4. The notes say: build into out/, copy it to a dated folder, point a link named current at it, open current/index.html. A fluent draft might read, for steps 2 and 3:

cp -r --verify out releases/2026-12-01

ln -s releases/2026-12-01 current

  • A made-up option. Step 2 printed "cp: unrecognized option '--verify'" and exited with status 1. Running the step catches it, as would comparing the step with pasted cp --help output.
  • A step that passes once. With step 2 corrected to a plain cp -r out releases/2026-12-01, the first deploy worked. On the second, with current already a link to a release folder, ln -s releases/2026-12-05 current exited 0 and printed nothing, yet readlink current still printed releases/2026-12-01, current/index.html still held the old text, and a stray link named 2026-12-05 sat inside releases/2026-12-01.

Running ln -sfn releases/2026-12-05 current repointed the link, and current/index.html held the new text; we removed the stray link by hand. The POSIX ln page says the links are made inside a directory when the final operand names an existing one; the Linux manual page for ln describes -n as treating the link name as a normal file if it is a symbolic link to a directory. The POSIX page lists only -f, -L, -P and -s, and we ran nothing on macOS or BSD, so check ln --help on your readers' system.

The repaired step follows the order on Google's Procedures page for a complex step, minus its optional command explanation. Point the link at the new release.

ln -sfn releases/RELEASE_DATE current

Replace RELEASE_DATE with the folder you just made. Nothing is printed.

Result: readlink current prints releases/ followed by that name.

How do I check every step before publishing?

  • Start clean, then run it twice. A fresh folder or machine stops your leftovers hiding a missing prerequisite, and the second run starts from what the first left, as the stray link shows. The twice rule is our own.
  • Check the result, not the exit code. Write what a reader should see, such as a link target or a page, under each step; the Diátaxis Tutorials page says to show actual example output, or even the exact expected output.
  • Let a machine run the examples. Python's doctest checks that interactive sessions in documentation work as shown, and the Rust page on documentation tests says rustdoc can run examples as tests.
  • Run the build and a link check. Write the Docs' Testing your documentation calls a successful build the easiest automated check and working links a great place to start; neither shows that a step behaves as written.
  • Keep a check log. Write a dated note beside the document: what you ran, on which versions, what changed and who checked. The SRE page above says playbook details go out of date as production changes.

Can AI find the gaps in my draft?

It can list them, but listing is not following the steps. Paste the draft into a fresh chat with a prompt such as: "Read this as someone doing the task for the first time. Do not rewrite it. List every missing prerequisite, step with no expected result, undefined term, instruction open to two readings, and step with no way to undo it."

The example notes never say how to go back if current points at a broken release; we have not tried whether an assistant surfaces that gap. For applications built on models, OWASP's 2026 entry on misinformation advises "structured outputs with mandatory fields" against omission failures; asking a drafting prompt for fixed fields (prerequisites, steps, expected result, rollback) is our adaptation. The Tutorials page says a tutorial "will have flaws and gaps, however carefully it is written", so have someone follow the steps.

Where NAMELESS stands

We are still training NAMELESS, our own model on its own architecture. It is not available and has no launch date; extremely fast answers and stronger logic and reasoning are goals, not results. Join the waitlist for news.

Keep reading

All posts