Comment WHY, Not WHAT - Code Commenting Prompt
From Wikiprompt, the free prompt encyclopedia
Comment WHY, Not WHAT - Code Commenting Prompt A prompt template for generating code comments that explain the reasoning behind the code, not just what it does.
Prompt ContentSave
π
Bad code comment (what): "// Sort the list"
Good code comment (why): "// Sort alphabetically because users expect A-Z"
My prompt: "Make it short"
His style: "Keep under 100 words because mobile users skim"
Context = better execution.
Old wisdom: Explain the reason, not just the rule
Sign in to see the full prompt
Continue with:
By logging in, you agree to our Terms of Use and Privacy Policy
Usage
This prompt is designed for use with coding. Copy the prompt content above and paste it into your preferred AI tool.
For best results, you may customize the placeholders (indicated by square brackets or capital letters) with your specific requirements.
References
- Category: coding Prompts
- Source: https://x.com/Nas_tech_AI/status/2030871548320772414
Talk
0 comments