ChatGPT Documentation Prompt for Technical Writers
You get documentation a newcomer can follow on the first try: what it is, how to install it, how to use it, with working examples. This prompt is tuned for technical writers working in ChatGPT: it carries your role context, and the steps below cover what changes in ChatGPT. Run every command and code sample, and check that parameter names, defaults and error codes match the current release.
Write documentation for the code or tool below. ## What it is Name: [project or module name] What it does: [one or two sentences] Who reads this: [e.g. developers new to the project, external API users] ## Source material [paste the code, CLI help output, config options, or function signatures] ## Document type [README, API reference, docstrings, or a how-to guide] ## Instructions - Start with what it does and why someone would use it, in two sentences. - Show a working example before explaining every option. - Every command and code sample must match the source material exactly. Do not invent flags, options or defaults. - Use short sections and plain language. - If something important is unclear from the source, list it as a question at the end instead of guessing. ## Output format Markdown with: overview, install, quick start, options or API, examples, and open questions. About my work - Product and audience: [e.g. REST API for developers integrating payments] - Source material: [e.g. paste the OpenAPI spec, PR description, or engineer's notes] - Style guide: [e.g. second person, sentence-case headings, present tense] Context - Reference material: [paste it below, or attach the file]
How to use this prompt
- 1
Open ChatGPT
Start a new chat in ChatGPT and paste the prompt.
- 2
Give it context
Upload or paste the material the prompt works on below the instructions.
- 3
Review and iterate
Reply in the same chat to refine, and quote the part you want changed.
- 4
Save what you repeat
Preferences you want in every chat (tone, audience, format) belong in ChatGPT's custom instructions. For a prompt you reuse with fixed files, a custom GPT or project works too.
Working in ChatGPT
- •Custom instructions apply to every chat, so keep task-specific rules in the prompt, not there.
- •If the reply drifts from the format, paste the format line again and ask it to redo only that part.
- •Start a new chat for unrelated work so earlier messages don't color the answer.
Worked example
What you give it
Name: csvtidy What it does: a command line tool that trims whitespace from every cell in a CSV and removes empty rows. Readers: developers on my team. CLI help: csvtidy <input> [-o output] [--keep-empty] -o, --output write to a file instead of stdout --keep-empty do not remove empty rows Install: npm install -g csvtidy Type: README
What a good answer looks like (shortened)
# csvtidy csvtidy cleans CSV files by trimming whitespace in every cell and removing empty rows. Use it before importing exported spreadsheets. ## Install npm install -g csvtidy ## Quick start csvtidy contacts.csv -o contacts-clean.csv ## Options - -o, --output: write to a file instead of printing to stdout - --keep-empty: keep empty rows instead of removing them ## Examples Print the cleaned file to the terminal: csvtidy contacts.csv ## Open questions - What happens if the output file already exists? - Does it handle quoted cells that contain commas?
Tips for better results
- •Give the AI the source of truth (spec, code, CLI help output) and tell it to flag anything it cannot confirm. Accuracy matters more than polish in docs.
- •Paste the actual help output or signatures into Source material. Documentation that drifts from the code is worse than none.
- •If the reply drifts from the format, paste the format line again and ask it to redo only that part.
- •Avoid this: Not pasting the real source, CLI help or signatures, so the AI documents flags and defaults that do not exist.
Check before you use it: Run every command and code sample, and check that parameter names, defaults and error codes match the current release.
Get the free prompt pack
Our best coding prompts in one Markdown file, delivered by email. The templates here stay free either way — the pack just saves you the copying.
Variations
Docstrings
Change Document type to docstrings and add: Use [Google, NumPy or JSDoc] style, with params, return value and raised errors for each function.
API reference
Replace Source material with your route handlers and add: For each endpoint, show method, path, parameters, an example request and an example response.
Changelog entry
Replace Document type with: A changelog entry for version [x.y.z] from this diff [paste], grouped as Added, Changed, Fixed.
Save it as a Retext snippet
Retext is a free text expander for Mac. Save this prompt once, then type ;writedocs in any app (ChatGPT, Claude, your editor, a browser tab) and the full prompt is pasted in.
- Click Add to Retext. The prompt installs as a snippet with the trigger ;writedocs.
- Change the trigger in Retext if you prefer a different one.
- Type the trigger wherever you want the prompt, then fill in the brackets.
Frequently asked questions
Can AI write API documentation?
It can draft solid reference pages from an OpenAPI spec or route code, including examples. Test every example request and check edge cases with engineers before publishing.
How do I keep AI-written docs accurate?
Give it the real source, help text or signatures and tell it not to invent options. Then run every example yourself before publishing.
Should this go in custom instructions?
No. Custom instructions apply to every chat. Keep this prompt for the task and paste it (or expand it with a Retext snippet) when you need it.
How do I reuse this prompt without copying it every time?
Click Add to Retext to save it as a snippet. Then type ;writedocs in any Mac app, including your AI tool, and the full prompt is pasted in.
Related Templates
Get the free prompt pack
Our best coding prompts in one Markdown file, delivered by email. The templates here stay free either way — the pack just saves you the copying.