GitLab Well Architected
Cookbook navigation
Prompts / Convert Documentation to Code Comments

Convert Documentation to Code Comments

DocumentationDeveloperMaintenanceCreateBeginner

Transform external documentation into inline code comments. Keep documentation close to the code.

For GitLab Duo

prompt

Convert this documentation into code comments:

[PASTE DOCUMENTATION]

Format for:
1. Function docstrings
2. Class documentation
3. Module-level comments
4. Inline explanations where needed

Use the prompt

Share the documentation alongside the code it describes and an example of your preferred comment style. This helps keep explanations close to the behavior they actually cover.