This prompt is designed for technical writers and CLI maintainers who need to produce a single, internally consistent command reference page from multiple source artifacts. The ideal scenario is when you have raw --help output, source code annotations, hand-written usage examples, a table of exit codes, and configuration documentation that all describe the same command. Instead of manually reconciling these sources, you feed them into the prompt to generate a unified page containing a synopsis, description, options table, examples, exit codes, and see-also links. The core job-to-be-done is documentation assembly and consistency enforcement, not original research or behavior discovery.
Prompt
Command Reference Page Assembly Prompt

When to Use This Prompt
Learn when assembling a command reference page from fragmented sources is the right job for this prompt, and when it is not.
Use this prompt when you have at least two distinct source artifacts for a command and need a structured reference page that passes documentation QA. The prompt excels at spotting contradictions between sources—for example, when the --help text lists a default value that differs from the source code annotation, or when an example uses a flag that is not documented in the options table. It also enforces structural completeness by checking that every required section (synopsis, description, options, examples, exit codes, see-also) is populated and that cross-references between sections are valid. The harness should validate the output against a schema that requires these sections and flag any missing or empty ones before the page is published.
Do not use this prompt when the command behavior is still in flux and cannot be verified against a live binary. The prompt assembles and reconciles existing documentation; it does not reverse-engineer behavior from an unstable codebase. Similarly, avoid this prompt when you lack source material entirely—if you have no help text, no source annotations, and no examples, the model will hallucinate plausible but incorrect command behavior. For high-risk or security-sensitive commands, always include a human review step where a subject-matter expert verifies the assembled page against the actual binary before publication. The next step after reading this section is to gather your source artifacts and prepare them as structured inputs for the prompt template.
Use Case Fit
Where this prompt works and where it does not. Use these cards to decide if the Command Reference Page Assembly Prompt fits your current documentation task.
Good Fit: Multi-Source Assembly
Use when: you have help text, source annotations, example files, and exit code docs that need to be merged into one unified reference page. Guardrail: validate that every source contributes at least one section to the final output and flag any source that produced zero claims.
Bad Fit: Single-Source Extraction
Avoid when: you only have one source, such as raw --help output, and need structured extraction rather than assembly. Guardrail: use a dedicated extraction prompt (like CLI Flag Extraction) instead and reserve this prompt for multi-source merging tasks.
Required Inputs
Risk: incomplete output when sources are missing. This prompt needs help text, source annotations, usage examples, and exit code documentation. Guardrail: maintain a preflight checklist that verifies all four input categories are present and non-empty before invoking the prompt.
Operational Risk: Cross-Reference Drift
Risk: the assembled page contains internal cross-references (see-also links, related flags) that point to non-existent sections or contradict other parts of the page. Guardrail: run a post-generation consistency check that validates every internal reference resolves to a real section heading.
Operational Risk: Stale Examples
Risk: usage examples from source annotations or external files may reference deprecated flags or behaviors that no longer match the current CLI version. Guardrail: execute every example command in a test environment and compare exit codes and output against the documented expected results.
Operational Risk: Section Omission
Risk: the prompt may silently skip a required section such as exit codes or environment variables when source material is sparse. Guardrail: define a required section schema before generation and validate that every required section heading appears in the output with non-empty content.
Copy-Ready Prompt Template
A reusable prompt template for assembling a unified command reference page from disparate source artifacts.
This prompt template is designed to be the core instruction set you send to a model. It accepts structured inputs—help text, source annotations, usage examples, and exit code documentation—and produces a complete, internally consistent command reference page. The template uses square-bracket placeholders that you must replace with actual content before execution. Do not send the placeholders to the model; they represent the data injection points your application or manual workflow must fill.
textYou are a technical writer assembling a complete command reference page for a CLI tool. Your task is to synthesize the provided source artifacts into a single, unified reference document. ## Required Output Sections Generate a command reference page with the following sections, in this order: 1. **Synopsis**: A one-line usage summary showing the command structure. 2. **Description**: A concise paragraph explaining the command's purpose. 3. **Options**: A markdown table of all flags and options. Columns: `Flag`, `Type`, `Default`, `Description`. 4. **Subcommands**: A list of subcommands with brief descriptions, if any exist. 5. **Examples**: Realistic, annotated shell examples demonstrating common and edge-case usage. 6. **Exit Codes**: A markdown table of exit codes. Columns: `Code`, `Description`, `Recovery`. 7. **See Also**: A list of related commands or documentation links. ## Source Artifacts - **Help Text**: [HELP_TEXT] - **Source Code Annotations**: [SOURCE_ANNOTATIONS] - **Usage Examples**: [USAGE_EXAMPLES] - **Exit Code Documentation**: [EXIT_CODE_DOCS] ## Constraints - [CONSTRAINTS] - If any section cannot be populated from the provided sources, output the section heading and the text `*No information available from provided sources.*`. - Ensure all flags in the help text appear in the Options table. - Ensure all exit codes in the documentation appear in the Exit Codes table. - Do not invent flags, examples, or exit codes not present in the source artifacts.
To adapt this template, replace each [PLACEHOLDER] with the corresponding text from your sources. The [CONSTRAINTS] placeholder is critical for enforcing style guides, specific formatting rules, or domain-specific requirements (e.g., 'All examples must use long-form flags,' or 'Sort options alphabetically'). After assembly, the harness should validate the output against the original source artifacts to ensure no information was dropped or hallucinated. For high-stakes documentation, always include a human review step before publication.
Prompt Variables
Replace each placeholder with concrete source material before sending the prompt to the model. The assembly harness should validate that every required input is present and non-empty.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[COMMAND_NAME] | The CLI command or subcommand this reference page documents | git-commit | Must match a single command string; reject if empty or contains shell metacharacters |
[HELP_TEXT] | Raw --help output from the command | usage: git commit [-a]... | Must be non-empty plain text; validate line count > 5 and presence of usage line |
[SOURCE_ANNOTATIONS] | Code comments, docstrings, or structured annotations extracted from source | // CommitOptions holds flags for commit subcommand | Can be empty string if no annotations exist; otherwise must be valid text block |
[EXAMPLES_LIST] | Curated list of realistic usage examples with descriptions | Stage all and commit: git commit -a -m 'fix' | Must contain at least 2 examples; each example must include a description and the exact command |
[EXIT_CODE_DOCS] | Structured mapping of exit codes to causes and recovery actions | 1: General error, 128: Invalid branch ref | Must be a valid JSON object mapping integer codes to cause strings; reject if empty object |
[STDIN_STDOUT_BEHAVIOR] | Documentation of input expectations and output formats across modes | Reads commit message from stdin when -F - is used | Must describe pipe behavior, TTY vs non-TTY differences, and encoding; null allowed if command has no stdin/stdout |
[RELATED_COMMANDS] | List of related commands for the See Also section | git-log, git-diff, git-status | Must be an array of command strings; reject if empty array; validate each command exists in the documented tool |
[CONFIG_ENV_VARS] | Environment variables and config keys that affect this command | GIT_AUTHOR_NAME, commit.template | Must be a valid JSON object mapping variable names to descriptions; null allowed if no config applies |
Implementation Harness Notes
How to wire the Command Reference Page Assembly Prompt into a documentation pipeline with validation, retries, and human review gates.
This prompt is designed to be the final assembly step in a multi-source documentation pipeline, not a standalone generator. Before calling this prompt, you should have already extracted structured data from help text, source annotations, and exit code documentation using the sibling extraction prompts in this pillar. The assembly prompt expects pre-processed, structured inputs in the [SECTIONS] placeholder—passing raw, unparsed help text will produce inconsistent results. The ideal implementation fetches these structured inputs from a documentation database or content API, assembles them into the prompt's expected schema, and then calls the model to produce the unified reference page.
Wire this prompt into a documentation CI/CD pipeline with explicit validation and retry logic. After the model returns the assembled reference page, run a validation harness that checks for: (1) internal consistency—do the options listed in the synopsis match the options table? (2) section completeness—are all required sections (synopsis, description, options, examples, exit codes, see-also) present and non-empty? (3) cross-reference integrity—do see-also links point to existing pages? (4) example accuracy—can the documented command examples be parsed without syntax errors? Use a structured output format (JSON with markdown content fields) so the validation harness can programmatically inspect each section. If validation fails, feed the specific failure messages back into a retry call with the original inputs plus a [CORRECTIONS] field containing the validator output. Limit retries to 2 attempts before flagging for human review.
For model choice, prefer models with strong instruction-following and long-context handling (GPT-4o, Claude 3.5 Sonnet, or equivalent). The prompt's output is primarily markdown, so strict JSON mode is not required, but you should wrap the output in a predictable container (e.g., a JSON object with sections as keys) to simplify downstream rendering. Implement logging that captures: the input sources used, the model and version, the raw output, validation results, and any human review decisions. This audit trail is essential when debugging why a specific command reference page has a stale flag or missing exit code. For high-risk CLI tools (security, infrastructure, compliance), always require a human review gate before publishing—the model can assemble, but a subject-matter expert must confirm that no dangerous flags are misdocumented or omitted.
Avoid wiring this prompt directly to a public-facing documentation site without validation. The most common production failure mode is stale cross-references: the model confidently links to a see-also page that was renamed or deleted. Mitigate this by maintaining a sitemap or page registry that the validation harness checks against. Another failure mode is example drift, where the assembled examples reference flags that were deprecated between extraction and assembly. If your pipeline caches extracted flag data, set a TTL that aligns with your CLI release cadence and invalidate caches on new version tags. Finally, do not use this prompt for commands with more than ~50 flags or deeply nested subcommand trees exceeding 10 levels—the context window will strain, and the model will start dropping sections. For those cases, split the assembly into per-subcommand pages and use a separate index-generation prompt.
Expected Output Contract
Fields, format, and validation rules for the assembled command reference page. Use this contract to validate the model's output before publishing or routing to a human reviewer.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
command_synopsis | string (single line) | Must match the pattern | |
description | string (1-3 paragraphs) | Must not exceed 200 words. Must not contain placeholder text. Human review required if it includes claims about data loss or security. | |
options_table | array of objects | Schema check: each object must have | |
examples | array of objects | Schema check: each object must have | |
exit_codes | array of objects | Schema check: each object must have | |
see_also | array of strings | Cross-reference check: each string must match an existing command or section name in [DOCUMENTATION_MAP]. Broken links are a hard failure. | |
environment_variables | array of objects | Schema check: each object must have | |
stdin_stdout_behavior | string | Must describe TTY vs pipe behavior if the command supports both. Null allowed for commands that do not use standard streams. |
Common Failure Modes
Command reference assembly fails in predictable ways. These are the most common failure modes when generating unified reference pages from disparate sources, along with concrete guardrails to catch them before publication.
Flag Drift Between Sources
What to watch: Help text, source annotations, and example snippets describe different flag sets. A flag present in --help output may be missing from the options table, or a deprecated flag still appears in examples. Guardrail: Extract flags from all sources independently, compute set union/intersection, and flag every discrepancy. Require explicit resolution before assembly proceeds.
Stale or Non-Executable Examples
What to watch: Assembled examples reference removed flags, wrong subcommand paths, or output formats that no longer match the current binary. Readers copy-paste and get errors. Guardrail: Run every example command against the actual CLI binary in a test harness. Flag any example that produces a non-zero exit code or output that doesn't match the documented expected result.
Missing Exit Code Documentation
What to watch: The reference page lists only exit code 0 and 1, but the binary can return codes 2-5, 64-78, or 126-130 for specific failure modes. Undocumented exit codes break scripts that depend on exit code semantics. Guardrail: Cross-reference documented exit codes against source code return paths. Require every non-zero exit path to have a documented cause and recovery action before the page ships.
Broken Cross-References and See-Also Links
What to watch: The assembled page links to related commands, man pages, or external docs that don't exist, have moved, or reference a different version. Guardrail: Validate every cross-reference target at assembly time. For internal references, check that the target page or anchor exists. For external URLs, verify they return 200. Flag dead links as blocking issues.
Inconsistent Option Formatting
What to watch: One source uses --flag=VALUE, another uses --flag VALUE, and a third uses --flag <VALUE>. The assembled page mixes conventions, confusing readers and breaking copy-paste workflows. Guardrail: Define a single formatting convention before assembly. Normalize all option syntax during extraction. Run a post-assembly lint pass that rejects any deviation from the chosen convention.
Silent Section Omission
What to watch: A required section like environment variables, stdin/stdout behavior, or shell completion notes is absent from all source materials. The assembler produces a page without it, and no error is raised because nothing conflicted. Guardrail: Define a required-section checklist per command type. After assembly, verify every required section is present and non-empty. Missing sections must be explicitly acknowledged or escalated to a human.
Evaluation Rubric
Score each criterion on a pass/fail basis. A passing command reference page must meet all criteria before shipping.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Section Completeness | All required sections present: Synopsis, Description, Options, Examples, Exit Codes, See Also | Missing one or more required sections | Schema check against required section list; parse headings from output |
Flag Coverage | Every flag from [SOURCE_HELP_TEXT] appears in Options table with long flag, short flag, type, default, and description | Flag present in source but missing from Options table or missing required column | Diff flag names extracted from [SOURCE_HELP_TEXT] against Options table rows; flag missing columns |
Example Executability | Every example in Examples section uses valid flag combinations and produces documented exit code when run against current CLI version | Example command fails with error or produces unexpected exit code | Shell execution of each example command block; compare exit code to documented value |
Exit Code Mapping | Every exit code in [EXIT_CODE_SOURCE] appears in Exit Codes section with numeric code, cause, and recovery action | Exit code found in source but missing from reference; or recovery action is empty | Parse exit code list from source; cross-reference against Exit Codes table rows; check recovery action non-empty |
Cross-Reference Integrity | Every See Also link points to an existing page or command; no broken internal references | Link returns 404, references non-existent command, or is a placeholder | Link checker crawl of all See Also targets; verify each resolves to valid documentation page |
Internal Consistency | No contradictory statements across sections: flag defaults match between Options and Examples; exit codes match between Exit Codes and Examples | Flag default in Options table differs from value used in example; exit code in example contradicts Exit Codes table | Parse all flag defaults and example invocations; compare values; parse exit codes in examples against Exit Codes table |
Deprecation Accuracy | All deprecated flags marked with deprecation notice, replacement flag, and sunset date from [DEPRECATION_SOURCE] | Deprecated flag appears without deprecation marker; replacement flag is missing or invalid | Parse deprecation notices from source; verify each deprecated flag in Options table has marker, replacement, and date |
Placeholder Absence | No unresolved placeholders, TODO markers, or template variables remain in final output | Output contains [PLACEHOLDER], TODO, FIXME, or empty field values | Regex scan for bracket placeholders, TODO/FIXME strings, and null-equivalent empty cells |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with lighter validation. Remove the [OUTPUT_SCHEMA] constraint and ask for a markdown table instead of structured JSON. Accept a single pass without cross-reference checks.
Watch for
- Missing sections like Exit Codes or See Also
- Flag descriptions that don't match the provided help text
- Examples that don't include realistic shell prompts

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us