santosomar/general-secure-coding-agent-skills/code-comment-generator
- community
Checking that the SKILL.md file is still in the repository.
Generates code comments that explain non-obvious intent, constraints, and tradeoffs — not what the code already says. Use when code is correct but opaque, when documenting for future maintainers, or when a function's why is harder to see than its what.
Install
npx vskill@latest install santosomar/general-secure-coding-agent-skills/code-comment-generatorSKILL.md
Code Comment Generator
Good comments explain why, not what. The code already says what. If you're narrating the code, delete the comment and make the code clearer instead.
What deserves a comment
| Worth commenting | Why | |
|---|---|---|
| A non-obvious constraint the code depends on | "x is sorted here because caller guarantees it" | |
| A tradeoff that was made deliberately | "O(n²) is fine — n ≤ 20 by construction" | |
| Why the obvious approach is wrong | "Can't use .sort() — caller holds references into this list" | |
| A workaround for an external bug | "libfoo 2.3 returns NULL here; remove when we upgrade" | |
| Magic numbers with a source | "15s — AWS Lambda cold start p99 + margin" | |
| Coupling to something far away | "Must match the regex in nginx.conf" | |
| A subtle correctness argument | "Safe to read without lock: only written at startup" |
What does NOT deserve a comment
| Skip | Why | |
|---|---|---|
i++ // increment i | The code says that. Noise. | |
// loop over items above for item in items: | Same. | |
| Restating the function name in a docstring | def save_user(): """Saves user.""" — waste. | |
| Commented-out code | That's what git is for. Delete it. | |
// TODO: fix this later | Unactionable. TODO: what and why not now? | |
| Comments that will rot | "Called from foo.py:42" — until foo.py changes. |
The test: does this survive a rename?
If you rename all the variables and the comment still makes sense, it's a good comment (explains intent). If the comment is now wrong, it was restating the code.
vs.
Rename x → comment still explains why the ordering matters. Good.
Worked example
Uncommented code:
What the code already says: retries 8 times, exponential backoff, cap at 5s, jitter. Don't comment any of that.
What's not obvious:
Two comments. The first explains a non-obvious design choice (why half-jitter, not full-jitter). The second explains a magic number in terms of an external constraint (LB timeout).
Docstrings — the API contract
Docstrings are a different animal: they're for callers, not maintainers. They should state:
- What the function does (one line)
- Parameter constraints (types, ranges, nullability)
- Return value meaning (including sentinel values)
- Exceptions raised and when
- Side effects (mutation, I/O)
They should NOT describe the implementation. If the implementation changes but the contract doesn't, the docstring shouldn't need updating.
Do not
- Do not write
// increment counterabovecounter++. Ever. - Do not explain what a standard idiom does.
# list comprehensionabove a list comprehension — the reader knows Python or they don't; the comment won't help either way. - Do not leave
TODOwithout a what and a why-not-now.TODO(#1234): remove this shim once libfoo 3.0 ships (expected Q2)is actionable.TODO: fixis not. - Do not write comments that reference line numbers or file paths elsewhere. They rot immediately. Reference concepts, not locations.
- Do not add a comment when the fix is to rename a variable.
x = get_total() # x is the total→ justtotal = get_total().
Output format
For each comment proposed:
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/code-analysis/code-comment-generator/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/santosomar/general-secure-coding-agent-skills/code-comment-generator)