⌨️ Codingbeginnercommentsdocumentationcode-qualityonboarding

Add Meaningful Code Comments

Add clear, useful inline comments and docstrings to uncommented or poorly commented code.

The Prompt

prompt.txt
Add meaningful comments and documentation to the following code. Rules:
1. Add a JSDoc/docstring for every function and class
2. Add inline comments for non-obvious logic (explain WHY, not WHAT)
3. Add section comments for logical blocks
4. Do NOT add comments like `// increment i` that just restate the code
5. Flag any magic numbers or strings with explanatory constants

The audience is a developer joining this codebase with no prior context.

Code to comment:
```
[PASTE YOUR CODE]
```

Example Output

Added JSDoc to all 8 functions, replaced the magic number 86400 with a SECONDS_PER_DAY constant, added a section comment explaining the rate-limiting algorithm, and added inline notes on the three non-obvious edge cases in the parsing logic.

FAQ

Which AI model is best for Add Meaningful Code Comments?

Claude Sonnet 4 — writes thoughtful comments that explain intent rather than just describing syntax.

How do I use the Add Meaningful Code Comments prompt?

Copy the prompt, replace the [BRACKETED] placeholders with your specific information, and paste into your preferred AI assistant (ChatGPT, Claude, Gemini, etc.). Added JSDoc to all 8 functions, replaced the magic number 86400 with a SECONDS_PER_DAY constant, added a section comment explaining the rate-limiting algorithm, and added inline notes on the three non-obvious edge cases in the parsing logic.