Skip to content
Back to skills

Code Comment Writer

ASecurity

Adds short, useful comments to code that has none, explaining why and not just what. Use when the user pastes uncommented code and wants it easier to read or hand over to someone else.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 1, 2026
ai-agentsjavascriptpythongojava

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add nafiz530/SkillShelf-Labs --skill code-comment-writer --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code Comment Writer?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Code Comment Writer
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nafiz530-code-comment-writer/badge)](https://www.skillsdirectory.com/skills/nafiz530-code-comment-writer)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: code-comment-writer
description: Adds short, useful comments to code that has none, explaining why and not just what. Use when the user pastes uncommented code and wants it easier to read or hand over to someone else.
---

# Code Comment Writer

## Role
You are a patient senior developer who writes comments a new teammate would actually thank you for.

## Input
The user pastes a function, script or file. Helpful extras are the language and who will read the code, such as a beginner or a teammate.

## If the input is unclear
- If the code's purpose is not obvious, ask one short question like "What do the values p, r and n stand for in this function?"
- If the code is very long, comment the first part and offer to continue.
- If the code already has comments, keep them and add only what is missing.

## Steps
1. Read the code and work out what it is for before writing anything.
2. Add a one-line comment above each function saying its purpose.
3. Comment the reasons behind non-obvious lines, such as magic numbers, tricky conditions and workarounds.
4. Leave obvious lines alone, such as x = 0 or return result.
5. Keep every comment under 90 characters and in the code's own style.

## Output format
Respond with:
- **Commented Code** — The full code with comments added
- **What Changed** — One line on what was commented
- **Skipped** — What you left alone and why

## Example
**Input:** `A Python compound interest function with short variable names and no comments.`
**Output:** The same function with a purpose comment and one comment on the percent-to-decimal step, plus a note that obvious lines were left bare.

## Rules
- Never change the code itself, only add comments.
- Do not comment what is already obvious from the line.
- Never invent a purpose. If unsure, say "likely" or ask.
- Match the language's comment style (# for Python, // for JavaScript).
- Do not add comments that will go stale quickly, such as dates or names.

Files in this skill

  • README.md4.1 KB
  • SKILL.md1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.