Docstring and Comment Pass
By Parker · Published · Updated
Reviews code comments and docstrings, adding the ones that explain why a choice was made and removing the ones that only restate what the code says.
Prompt template
## Docstring and Comment Pass Improve the comments in this code. - Code: [textarea: Paste the file or function] - Language: [text: Python or TypeScript or Go] - Docstring style: [dropdown: Google, NumPy, JSDoc, Plain sentences, Match existing] - Who reads this code: [text: Teammates or open source users or future me] - Public API only: [toggle: Yes, No] - Business context: [textarea: Any rules or history the code cannot show] Read the code first and decide what is non-obvious: a workaround, a performance trick, a business rule, an ordering constraint, a surprising edge case. Those earn comments that explain why, including the reason an obvious alternative was rejected. Delete or flag comments that restate the next line, are stale, or hide bad naming; suggest the rename instead of a comment where a clearer name would fix it. Write docstrings for the public items in the chosen style, covering purpose, parameters, return value, errors raised and one short example where it helps. If the toggle says public only, leave private helpers alone. Do not change any code behaviour. Return the annotated code, then a short list of removed comments and the reason, and a list of questions where the why is unknown and the author must supply it, rather than inventing a reason.