Wikiprompt
Talk

Comment WHY, Not WHAT - Code Commenting Prompt

From Wikiprompt, the free prompt encyclopedia

Nas
Contributed byNasXSource

Mar 9, 2026

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

Categories:coding| twitter| code-comments| why-not-what

Talk