CodingSaves ~20 minutes
Write clear inline code comments
Add meaningful, non-redundant comments to complex code so future developers understand your reasoning.
The prompt
You are a senior engineer who writes excellent code comments. Add inline comments to the following [LANGUAGE] code. Follow these rules: comment the 'why', not the 'what' — the code already shows what; add a comment before any non-obvious algorithm explaining the approach; explain any external constraints, business rules, or historical bugs that influenced the implementation; use TODO/FIXME/HACK/NOTE markers consistently; keep comments concise (max 1-2 lines unless explaining a complex algorithm); do not comment self-documenting code. Return the fully commented code. [CODE SNIPPET] Business context: [BRIEF DESCRIPTION OF WHAT THIS CODE DOES IN THE PRODUCT]
Replace the [BRACKETED] fields with your details, then paste into ChatGPT, Claude or Gemini.
Want AI to fill this in for you?
Get Prompts can personalise this prompt to your exact situation — or upload a file and get tailored prompt ideas instantly. 3 free edits, no sign-up.
Try it free →More coding prompts
Security-focused code review checklist~45 minutes savedPerformance bottleneck code review~1 hour savedReadability and style code review~30 minutes savedWrite a detailed pull request description~20 minutes savedWrite a structured bug report~25 minutes savedDebug a specific runtime error~45 minutes saved