Overview
This prompt guides users in adding structured JavaDoc comments to methods in a code file, ensuring clarity and consistency. Programmers and developers will benefit by enhancing code documentation and maintainability.
Prompt Overview
Purpose: This task involves adding Java-style comments to methods in a code file.
Audience: The intended audience is developers familiar with Java and JavaDoc conventions.
Distinctive Feature: Comments must follow specific formatting and structure as demonstrated in provided references.
Outcome: The result will be a code file with clear, structured comments above each method, enhancing readability.
Quick Specs
- Media: Text
- Use case: Analysis, Data Analysis & Insights, Enhancement
- Techniques: Prompt Templates, Role/Persona Prompting, Style Guide Adherence
- Models: ChatGPT, Claude, Gemini AI
- Estimated time: 5-10 minutes
- Skill level: Beginner
Variables to Fill
No inputs required — just copy and use the prompt.
Example Variables Block
No example values needed for this prompt.
The Prompt
You are tasked with adding detailed, Java-style comments above each method in a given code file. Use the exact comment style and formatting conventions demonstrated by:
– TraceAnalyticsPolicyInspector
– TraceAnalyticsPolicyQualifier
– TraceMetricPolicyInspector
### Requirements
– Each method comment must clearly describe:
– The method’s purpose
– Input parameters
– Return values
– Side effects
– Any significant implementation details
– Use HTML-style tags like “ within JavaDoc comments to structure the descriptions, exactly as seen in the reference comments.
– Carefully study the tone, wording, and formatting from the references to ensure consistency across all comments.
– Insert the comments immediately above each method without modifying any code or method signatures.
### Steps
1. Review sample comments from:
– TraceAnalyticsPolicyInspector
– TraceAnalyticsPolicyQualifier
– TraceMetricPolicyInspector
– Capture style and structure.
2. For each method (including the `start` method):
– Determine its functionality, inputs, outputs, and side effects.
– Write a concise JavaDoc comment block using “ tags and the observed formatting conventions.
– Prepend the comment above the method definition, preserving existing indentation and code formatting.
3. If the method’s role is ambiguous, cautiously infer or add a TODO notation within the comment.
### Output Format
– Return the entire original file content with the newly added, fully formatted JavaDoc comments above every method.
– Keep the original code formatting intact except for inserting these comments.
### Notes
– Do not change any code logic or method signatures.
– Follow the reference styles precisely, including JavaDoc delimiters, `@param/@return` tags if used, and any HTML tags.
– Include comments for the `start` method following the same pattern.
Screenshot Examples
How to Use This Prompt
- Copy the prompt provided above.
- Identify the Java methods in your code file.
- Review the reference comments for style and structure.
- Write JavaDoc comments using the specified format for each method.
- Insert comments above each method without altering existing code.
- Ensure consistency in tone and formatting across all comments.
Tips for Best Results
- Use clear comments: Ensure each method has a detailed comment block explaining its purpose, parameters, return values, and side effects.
- Follow formatting conventions: Utilize HTML-style tags like within comments to maintain consistency with existing documentation.
- Preserve original code: Insert comments above methods without altering the existing code structure or logic.
- Clarify ambiguous methods: If a method’s functionality is unclear, include a TODO notation within the comment for future reference.
FAQ
- What is the purpose of Java-style comments?
Java-style comments provide clear documentation for methods, detailing their purpose, parameters, and return values. - How should method comments be structured?
Method comments should use HTML-style tags for clarity, following a specific format for consistency. - What should be included in each method comment?
Each comment must include purpose, input parameters, return values, side effects, and implementation details. - Why is consistency in comments important?
Consistency ensures readability and helps developers understand the codebase quickly and effectively.
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (February 2026): Initial release.


