Prompts Easy
Prompt Comment
Prompt for adding concise, intention-revealing comments to non-obvious code paths.
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}}
The user has asked: {{message}}
Reusable prompt template for Prompt Comment workflows.
What This Prompt Solves
- Add comments only where intent or tradeoffs are not obvious from the code itself.
- Forces explicit assumptions, constraints, and output structure.
- Produces actionable output that can be reviewed or executed.
Recommended Inputs
- Source code, style guide, and constraints about comment density and tone.
- Clear success criteria and any hard constraints.
- 1-3 representative examples of desired output style when possible.
Expected Output
- Annotated code suggestions with concise comments and justification per insertion.
- 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.