StealThis .dev

Prompt Docs Gen

Prompt template to generate technical documentation from code and product context.

openai claude gemini prompting
Targets: Markdown

Code

The user is curently inside this file: {{filename}} The contents are below:

{{filecontent}}

The user has selected the following code from that file:

{{selected_code}}

The user has asked:

Provide documentation for {{selected_code}}.

  • Respond with a single code block.
  • Only include documentation comments. No other Swift code.

Reusable prompt template for Prompt Docs Gen workflows.

What This Prompt Solves

  • Generate clear developer and user documentation from provided sources.
  • Forces explicit assumptions, constraints, and output structure.
  • Produces actionable output that can be reviewed or executed.
  • Project goals, architecture notes, CLI/API references, and onboarding constraints.
  • Clear success criteria and any hard constraints.
  • 1-3 representative examples of desired output style when possible.

Expected Output

  • Structured docs with setup, usage, configuration, troubleshooting, and FAQs.
  • Risks, tradeoffs, and next-step recommendations.

Prompt Design Notes

  • Uses role + objective + constraints sections to reduce ambiguity.
  • Uses XML-style tags for better parsing and instruction separation.
  • Keeps static instructions first and variable context at the end.