with one click
comments
// Use when: adding comments, reviewing comment quality, documenting non-obvious code, removing stale comments, or deciding whether a code comment is necessary.
// Use when: adding comments, reviewing comment quality, documenting non-obvious code, removing stale comments, or deciding whether a code comment is necessary.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | comments |
| description | Use when: adding comments, reviewing comment quality, documenting non-obvious code, removing stale comments, or deciding whether a code comment is necessary. |
| user-invocable | false |
Use this skill when deciding whether code should have a comment. Comments should explain useful context that the code cannot express clearly on its own. Prefer clearer code over comments that restate what the code does.
Write comments for future readers who need intent, constraints, or surprising context. Do not write comments to narrate syntax, repeat names, or compensate for unclear code that can be made clearer directly.
Before adding a comment, ask:
If the answer is no, improve the code instead of adding a comment.
Examples to remove:
const count = 0; // Initialize count to 0
// Loop through users
for (const user of users) { ... }
// TODO: fix this
// const oldCode = something;
Examples worth keeping or adding:
// Using setTimeout to avoid a race with DOM rendering.
setTimeout(() => updateUI(), 0);
// Discount only applies to orders over 100 by marketing requirement JIRA-1234.
if (order.total > 100) { ... }
// Binary search is valid because fetchData sorts this list upstream.
const index = binarySearch(sortedItems, target);
For new or significantly changed files, follow the project's existing file header convention. If the project has no convention, use the language's normal documentation style:
@file header.//! doc comment.Only add a header when it meaningfully helps future readers understand the file's purpose.