code-comments

code-comments is a skill for Claude Code, Codex from petekp/claude-code-setup. It costs 34 tokens per session (1,577 once invoked), scanned A, original, MIT.

Guidance for writing code comments and nearby documentation in clear, everyday language.

In plain words
What is it for?
Use it for file headers, function documentation, architecture decisions, and reviews of inline comments.
Why use it?
It helps future developers and coding assistants understand why code exists without filling files with comments that merely repeat the code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Good fit Use it for file headers, function documentation, architecture decisions, and reviews of inline comments.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/petekp/claude-code-setup/code-comments
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add petekp/claude-code-setup --skill code-comments
Clone the repo
git clone --depth 1 https://github.com/petekp/claude-code-setup

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-comments

README.md
[![agentmods](https://agentmods.dev/badge/skills/petekp/claude-code-setup/code-comments/github.svg)](https://agentmods.dev/skills/petekp/claude-code-setup/code-comments)
Your own site
<a href="https://agentmods.dev/skills/petekp/claude-code-setup/code-comments"><img src="https://agentmods.dev/badge/skills/petekp/claude-code-setup/code-comments/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-comments

Your own site · 80×15
<a href="https://agentmods.dev/skills/petekp/claude-code-setup/code-comments"><img src="https://agentmods.dev/badge/skills/petekp/claude-code-setup/code-comments.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,577 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 21 Oct 2026
  • Snyk pass 21 Oct 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00034 $0.01577
Opus 5.5 $0.00014 $0.00631
Sonnet 5.5 $0.00007 $0.00315
Haiku 4.5 $0.00003 $0.00158

Measured 1mo ago against content hash 01b8394b54ba, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-comments scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/code-comments/SKILL.md · 161 lines

How it starts

The opening of the file, as written. The whole thing — 161 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code comments

Delete every comment that is not on the keep list. When you are not sure a comment fits an item, delete it. A comment that explains our own code usually means the code should change: make the code say it, then delete the comment. Before adding a comment while writing code, hold it to the same list.

Keep list

A comment stays only when it is one of these, and only while its claim holds today:

  1. A legal or license header.
  2. A tool directive, such as // prettier-ignore, @vitest-environment, or a compiler pragma. Lint and type suppressions must also pass Suppressions.
  3. A doc comment on an API used outside its module that states what the signature and types cannot: units, ownership, side effects, errors thrown, rejected inputs.
  4. A constraint set outside our code: a dependency or platform bug, a vendor or protocol rule, a business rule, a regulation. It names the source, and links the issue, spec, RFC, or ADR when one exists. A workaround also states the condition for removing it.
  5. A true constraint on our own code that the code cannot show yet, such as a required call order, or a line that looks removable but is not. It stays only until a code change, type, assertion, or test removes the need (steps 2 and 4).
  6. A TODO that links a tracked issue.

Judge each comment

Take each comment in scope through these steps in order.

  1. Check the claim. Read the code and its callers. Delete a comment that is false or stale. IMPORTANT, NOTE, do not remove, careful, for now, and any justification longer than two lines are claims to check, not reasons to keep.
  2. Make the code say it. When a comment explains our own code, change the code so the comment is unneeded, then delete it. In a cleanup or review, make only changes that keep behavior the same: rename after checking the consumers, or extract a named constant or local variable. For a change to what a function does or takes, even a private one, report the exact symbol and the change instead. The comment then goes to step 3, and often fits item 5 until that change is made.
  3. Match the keep list. Keep a comment that fits an item. Judge it sentence by sentence: delete each sentence that does not serve the item or cannot be verified, without rewording the rest.
  4. Offer an encoding for each item 5 comment: a type, an assertion, or a test that fails when someone breaks the constraint. Add it only after the user approves, then delete the comment.
  5. Delete the rest. Move what still matters to where it belongs:
    • Task history (what changed, who approved it, what was tried, how it was verified) goes in the commit or PR.
    • A TODO with no issue goes in the report, so it can be filed.
    • A value copied from a constant becomes a reference to the constant.
    • Commented-out code, file headers, section banners, and "Used by" lists go with no replacement. Git history and search answer them.

Read the full file on GitHub · 161 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · -37 lines · -27 tokens per session 01b8394b54ba
  2. 3mo ago First seen · 198 lines · 61 tokens per session scan A 4e1287f004da

Subscribe to this mod's changes

code-comments is a skill published in the GitHub repository petekp/claude-code-setup (50 stars, last pushed yesterday), licensed MIT. It adds 34 tokens to every session and 1,577 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

code-comments compared with skills from other repositories

code-comments next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
code-commentspetekp/claude-code-setupSkill50yesterdayMITA34Claude Code, Codex
html-artifactslangchain-ai/open-sweSkill11ktodayMITA52Claude Code, Codex
sandbox-imageslangchain-ai/open-sweSkill11ktodayMITA55Claude Code, Codex
web-appslangchain-ai/open-sweSkill11ktodayMITA43Claude Code, Codex
baby-sitlangchain-ai/open-sweSkill11ktodayMITA30Claude Code, Codex
merge-queue-recoverylangchain-ai/open-sweSkill11ktodayMITA31Claude Code, Codex
migratelangchain-ai/open-sweSkill11ktodayMITA72Claude Code, Codex