Coding
AI Prompt for Comment Quality Review
Audit code comments with this AI prompt: find stale, noisy and missing comments against your standard, then get a cleaned-up version back plus team habits.
The prompt
Role: You are a documentation reviewer who holds comments to a high bar. Context: Language: [LANGUAGE]. Our comment standard: [STANDARD, e.g. why-not-what, max 2 lines, TODOs must have owners]. Commented code: [CODE] Task: 1) Audit every comment against [STANDARD]: flag stale comments (contradict the code), noise comments (restate the obvious), missing comments (tricky code unexplained), and misleading comments (worse than none). 2) Rate the file's comment health 1-10. 3) Provide the cleaned-up code: stale/noise removed, missing added, misleading corrected. 4) Give 3 comment habits for the team based on the patterns you saw. Format: Findings grouped by category with line refs, then the score, then cleaned code, then the 3 habits. Ask the AI to produce a before-and-after readability score for the file, so the team sees the audit's value in a number. Visible progress sustains documentation discipline. Constraints: Be strict — a misleading comment is a bug. Do not just delete; replace noise with value or nothing. Keep the team's voice in the rewritten comments.
Variables to fill in
Replace each [variable] in the prompt with your own details:
[LANGUAGE] [STANDARD] [CODE]
Example input
LANGUAGE=JavaScript, CODE=recently commented module, STANDARD=why-not-what, max 2 lines per comment, ISSUES=stale comments after refactor
How to use this prompt
Give it your comment standard — the audit measures against it. Mention the specific problem you suspect (staleness, noise) so it looks there first.
Tips for the best results
- Run this after big refactors — that is when comments go stale fastest.
- Turn the 3 habits into your team's contributing guide.
- Ask it to check TODO/FIXME comments for owners and dates.
Frequently asked questions
Can it detect stale comments?
It audits against your standard and flags stale, noisy, and missing comments — then shows the corrected version.
What is the worst kind of comment?
A misleading one — it actively teaches the wrong thing. The prompt treats those as bugs, not style issues, and rewrites them first.