OmniscioGuidesPromptsDocumentation
Claude Code prompt for documentation
Documentation written by a model fails in a specific way: it reads beautifully and gets the flags wrong. The sentence is right, the default value is invented, and the reader finds out by running it.
The difference between documentation a reader can trust and documentation that merely sounds right is one instruction, and it is the one most prompts leave out.
- The prompt, ready to copy.
- Why each line is there.
- The subagent version.
- What good output looks like.
- The common failure.
- Make it a one-word command.
Checked against Anthropic's Claude Code documentation on November 25, 2026. By the Omniscio team. Updated .
The prompt
Swap --watch and src/cli/watch.ts for your flag and your file. If there is no section above the one you are adding, name the closest page instead — the point of that line is to give Claude a voice to match, not a position.
Write the README section for the new --watch flag added in src/cli/watch.ts. Explain what it watches, when it fires, and what it deliberately does not cover. Use the same structure and voice as the section above it, and link to the two related commands instead of repeating them. Assume the reader has just installed the tool and is deciding whether to use the flag at all.
Include one complete example a reader can paste, with its real output below it.
Check every flag name, default and path against the source before you write it, and list the files you checked at the end.The last paragraph is the whole difference between documentation you can trust and documentation that merely sounds right. Without it, every specific detail in the page is a guess with good grammar.
Why each line is there
"the README section for the new --watch flag added in src/cli/watch.ts"
Anthropic's documentation recipe starts from the same place: point at the code that needs documenting, then ask for the documentation. Naming the file gives Claude the source of truth and tells it that the flag already exists, so it writes about what is there rather than what a flag like this usually does.
"Explain what it watches, when it fires"
This is the clause most likely to be answered from memory. Whether a watcher polls or listens, and whether it fires once or on every change, is a claim about runtime behaviour that no amount of good prose makes true. Asking for it in the same sentence as the check below is what turns the page from a description of the flag into a description of what the flag does.
"what it deliberately does not cover"
The limits are the first thing a reader needs and the first thing a writer leaves out. Every tool page that omits its own boundaries produces the same support question, because the reader assumes the feature covers the case they care about. Asking for it explicitly turns a missing section into a required one.
"the same structure and voice as the section above it"
This is the reference pattern: name an existing file, test or pattern to match, so the new text is consistent with what you already have. Applied to prose, the section itself is the pattern. For prose it does more work than for code, because voice is the thing that makes a documentation set feel like one document instead of a folder.
"link to the two related commands instead of repeating them"
Repeated documentation is documentation that will disagree with itself within a quarter. One page owns a fact and the others link to it. Saying this in the prompt also stops the page from turning into a fourth explanation of the same command.
"one complete example a reader can paste, with its real output below it"
Anthropic's tips for the documentation job are to ask for examples, and to request documentation for public APIs, interfaces and complex logic. Complete means a reader copies it and it runs: the command, the flags, and the output they should expect, so a wrong result is obvious rather than mysterious.
"Check every flag name, default and path against the source … list the files you checked"
This is the evidence line, and it is the only one that catches invented specifics. What makes it weak evidence is a listed file that does not contain the flag: a path can be summoned as easily as a default, so the list is worth reading, not just counting. The last clause matters as much as the first, because a list of files tells you which parts of the page rest on something.
The subagent version
The docs job is a good subagent fit because a lot of reading goes in and a short page comes out, Anthropic's list of what subagents are for includes exactly this — keeping long output out of your main conversation — and a documentation pass over an unfamiliar module generates a lot of reading.
Use a subagent to do the job above, and have it return the finished Markdown
ready to paste, plus a list of the files it read to check the flags and
defaults. Not a summary of what it would write.That last sentence is worth keeping in every subagent prompt. A subagent that returns a description of the work has cost you a round trip and saved nothing, which is the exact opposite of what it is for.
A worked file for this job is on the site: the docs writer subagent, among the subagent examples.
What good output looks like
- It reads like the page around it. Same heading shape, same voice, same amount of detail per idea.
- One example that would actually run. With its output, so a reader can compare.
- A section on what it does not do. The limits, stated plainly.
- Links instead of echoes. The related command is named and linked, not re-explained.
- The list of files checked. However many it actually read, each one a place a detail came from.
The common failure
Invented specifics. The page is well written, the structure is right, and three details are wrong:
- A flag written the way flags of that kind usually look, rather than the way this one is spelled.
- A default value that is the sensible default for a feature like this, rather than the one in the code.
- An output block that shows what the command should print, rather than what it does.
None of them is a language failure, which is why reading the page does not catch them. The check has to be against the source, and the prompt has to make that a step rather than a hope. Asking for the files that were checked is the difference between a claim and evidence.
A quieter failure is the page that documents the implementation instead of the job. It explains the internal state machine and never says what a reader types, which is complete, accurate, and useless to the person who arrived from a search.
Make it a one-word command
Anthropic's own advice is that knowledge like how your team wants API docs written belongs in a skill rather than CLAUDE.md: a SKILL.md at .claude/skills/doc-it/SKILL.md, with a name and a description in YAML frontmatter, loads its body only when it is used, so a long style guide costs almost nothing on the tasks that do not need it. Save the prompt there with your house rules — the voice, the heading order, the example format — and the folder name becomes the command: /doc-it.
Keep CLAUDE.md for the facts every task needs: where the docs live, which command builds them, and which files are generated and must not be edited by hand.
Both are covered with worked examples on this site: skills examples and CLAUDE.md examples.
How this page was written
Everything here about what Anthropic recommends for the documentation job, what a subagent is for, and where team knowledge belongs was read from Anthropic's Claude Code documentation on November 25, 2026, and checked against the wording in the Sources below.
The prompt is ours: an example written for this site, following the patterns Anthropic documents, not a prompt Anthropic publishes. The flag and the path in it are placeholders.
Sources
- Anthropic's Common workflows, for the documentation recipe and its tips about style and examples, read November 25, 2026.
- Anthropic's Best practices for Claude Code, for what subagents are for and what they cost, the check that returns pass or fail, and where team knowledge such as documentation conventions belongs, read November 25, 2026.
- Anthropic's Prompt library, for pointing at a reference, read November 25, 2026.
- Anthropic's Create custom subagents, for context isolation and what a subagent costs, read November 25, 2026.
- Anthropic's Extend Claude with skills, for a skill's location, its frontmatter and when its body loads, read November 25, 2026.
- Google's autocomplete suggestions for "claude code prompt for documentation" and "claude code documentation prompt", read November 25, 2026, for the queries this page answers.
Common questions
What do I change first when the generated docs still get details wrong?
Check whether the prompt names the source file at all. A prompt that says "document the --watch flag" gives Claude a subject to describe; one that points at src/cli/watch.ts gives it a file to read. The second is the difference between a plausible page and a correct one, and it costs one path.
Why does generated documentation get details wrong?
Because the details are the part that has to be looked up. A flag name, a default value and a file path all sound right and can be wrong, so the prompt should make checking them an explicit step and ask which files were checked.
Should the docs be written by a subagent?
It fits when the job is to read a lot of code and write a short page, or to update a set of docs after a change. Ask for the final text, not a description of what it would write, or the subagent adds a step instead of saving one.
Where do documentation conventions belong?
In a skill. Anthropic's guidance is that team knowledge such as how you want API docs written belongs in a skill rather than CLAUDE.md, because a skill's body loads only when it is used, while a line in CLAUDE.md is paid for on every task.
Should the page describe the implementation or the job?
The job. A reader arrives with a task and a search phrase, and leaves when they can do the task. The implementation belongs further down, for the reader who now needs to know why.
Write the docs in one session. Run them side by side.
A documentation prompt runs inside one Claude Code session. Omniscio is the level above: a desktop app for running Claude Code and other coding agents side by side, with one list of sessions and one inbox, so an agent only interrupts you when a decision needs you.
The features page lists what is in it today, pricing covers the plans, and you can download it for Windows, macOS or Linux.