why-comments

why-comments is a skill for Claude Code from mikestangdevs/craft-skills. It costs 130 tokens per session (1,327 once invoked), scanned A, original, MIT.

A code-review aid for improving comments. It removes comments that merely repeat what the code does and keeps or adds comments that explain why unusual code exists.

In plain words
What is it for?
Use it on comment-heavy files, surprising code, or changes produced by an AI coding agent. It helps document decisions, constraints, and workarounds that the code alone cannot show.
Why use it?
Narrating obvious code creates stale noise, while missing reasons can lead someone to remove a necessary workaround or ordering rule. This keeps comments useful for future maintainers.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the craft-skills plugin — 17 skills shipped together

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.

agentmods
npx agentmods add skills/mikestangdevs/craft-skills/why-comments
Any agent
npx skills add mikestangdevs/craft-skills --skill why-comments
Clone the repo
git clone --depth 1 https://github.com/mikestangdevs/craft-skills

Made for: Claude Code.

Or install craft-skills, the plugin that ships this one along with the rest of its 17 skills.

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 why-comments

README.md
[![agentmods](https://agentmods.dev/badge/skills/mikestangdevs/craft-skills/why-comments.svg)](https://agentmods.dev/skills/mikestangdevs/craft-skills/why-comments)
Your own site
<a href="https://agentmods.dev/skills/mikestangdevs/craft-skills/why-comments"><img src="https://agentmods.dev/badge/skills/mikestangdevs/craft-skills/why-comments.svg" alt="Measured on agentmods" height="20"></a>
Per session 130 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,327 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00130 $0.01327
Opus 5 $0.00065 $0.00664
Sonnet 5 $0.00026 $0.00265
Haiku 4.5 $0.00013 $0.00133

Measured 6d ago against content hash 3de14c7bc6a2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

why-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 6d 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/craft/why-comments/SKILL.md · 86 lines

How it starts

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

Why Comments

The failure mode this fixes

Comments fail in two opposite directions. Agents (and tired humans) write narration — // loop over the users, // call the API — that restates what the code already says, goes stale the moment the code changes, and trains every reader to skip comments entirely. Meanwhile the one thing a comment can do that code can't — record why — goes unwritten: why the retry is 3 and not 5, why this runs before that, why the obvious approach was tried and reverted. Six months later someone "simplifies" the workaround and reintroduces the bug it guarded against.

This skill inverts the ratio: delete the whats, keep and sharpen the whys, and add a why where surprising code has none.

When to Use This Skill

  • A file is full of comments that just narrate the next line
  • Load-bearing or surprising code (a magic value, an odd ordering, a deliberately "wrong-looking" approach) has no explanation
  • You're reviewing AI-generated code — agents over-narrate and under-justify
  • explain-back flagged a chunk UNJUSTIFIED and the justification, once found, should be written down
  • A comment and the code beneath it disagree (the comment went stale)

Don't use when: the comments are API documentation (docstrings, JSDoc, godoc) — those describe a contract for consumers and are a different job, judged by different rules. And don't add a why where the code is genuinely self-evident; a comment on the obvious is noise wearing a justification.

Instructions

1. Classify every comment in scope

Walk the comments and tag each one:

  • WHAT — restates the code (// check if the user is active above if (user.isActive))
  • WHY — states a reason, constraint, or history the code can't show (// gateway rate-limits at 10 rps; see INC-482)
  • CONTRACT — docstring/API documentation for consumers → out of scope, leave it
  • CORPSE — commented-out code → that's delete-this territory; version control already remembers it
  • STALE — describes code that no longer matches → either fix it to the current truth or delete it; a wrong comment is worse than none

Read the full file on GitHub · 86 lines

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. 6d ago First seen · 86 lines · 130 tokens per session scan A 3de14c7bc6a2

Subscribe to this mod's changes

why-comments is a skill published in the GitHub repository mikestangdevs/craft-skills (4 stars, last pushed 2mo ago), licensed MIT. It adds 130 tokens to every session and 1,327 once invoked, about $0.0006 per session on Opus 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

Other skills, from other repositories

absolute-simplify

Use when the user wants to simplify, clean up, refactor, tidy, or refine code — their staged/unstaged git changes or a target file/path. Reduces complexity, flattens nesting, removes redundancy and dead code, scores each change by value (holding low-value churn), then runs tests to prove nothing broke. Invoke on…

maddhruv/absolute · 178 tokens

plumb-line-audit

Use when auditing a diff or repository against the plumb-line principles — finds laundered uncertainty, boundary leaks, hardcoded priors, overstated maturity, outputs lacking recorded lineage, and baseline drift with no explanation. Read-only: it reports, never auto-fixes.

slopstopper/plumb-line · 0 tokens

plumb-line-bootstrap

Use when setting up a project with the plumb-line discipline — interviews the builder to find their source-truth layer and layering, generates a domain-neutral ruleset, and installs parameterized enforcement (boundary check, test gate, pre-commit gate, branch guard) for the project's language. Ships no default layers…

slopstopper/plumb-line · 73 tokens

plumb-line-adopt

Use when a builder wonders what plumb-line would do for their codebase or which part to adopt — or when, mid-task, their work shows a fit signal (adding a mock or fallback near a production path, mixing fixture, cached, or LLM/agent-produced data with real data) and visible uncertainty would help. Inspects the repo…

slopstopper/plumb-line · 0 tokens

Tech Debt Auditor

Identifies and prioritizes technical debt in a codebase with an effort/impact matrix.

Notysoty/openagentskills · 22 tokens

Refactor Planner

Creates a safe, step-by-step plan to refactor messy code without breaking existing behavior.

Notysoty/openagentskills · 22 tokens