/will-wright-eng-skills:prune-comments [<base-branch>|<path>] [<max-comment-ratio>%]from will-wright-eng-skills
Aggressively remove redundant comments from code files — deletes narration that restates the code, "pseudo-why" comments whose reason is already visible in the code, and step-heading comments over blocks; condenses verbose why-comments and doc comments to minimal technical language; never touches semantic comments (directives, pragmas, shebangs, license headers) or genuine why-comments. Doubt resolves toward deletion. Scopes to the diff against main (or a named base branch) by default, or sweeps a named path; optionally drives the comment ratio under a target percentage; modifies comments only, never code, and never markdown/docs. Use when comments are noisy or redundant — "remove redundant comments", "clean up the comments", "prune comments", "strip unnecessary comments", "too many AI comments", "comment ratio too high", "get comments under N%".
Ships in will-wright-eng-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Strip redundant comments from code files. Default scope is the diff against main, or against the base branch I name (stacked PRs); I can instead point you at a file, directory, or the whole repo. The default action is delete: a comment survives only when you can name the specific fact it carries that a competent reader could not get from the code, the names, or the types. Doubt resolves toward deletion — not toward keeping, and not toward condensing. Judge every comment against the code it describes — the enclosing function, class, or block, read from the file — never against the diff hunk alone. Never touch semantic comments that tooling reads (see DIRECTIVES.md) or genuine why-comments. Modify comments only — never code, never markdown. Measure the comment ratio before and after; when I give a maximum (e.g. 15%), keep going until every candidate file is under it or only directives and why-comments remain. Finish with a concise summary of what was removed, condensed, kept, and observed.
Two modes, chosen by how I invoke you:
git diff <base>...HEAD, where <base> is main unless I name another branch. Pre-existing comments elsewhere in touched files are left alone. The diff locates candidates; it is not the context to judge them against — see below.File scope is code and functional files with in-file comment syntax: source files, scripts, config (YAML/TOML/INI), SQL, Dockerfiles, CI definitions. Explicitly out of scope, never modified:
.md, .rst, .txt, anything under docs/)A diff hunk shows three lines of context, which is never enough to know whether a comment restates the code. Never classify from the hunk. For every candidate, open the working-tree file and read the comment with the unit it describes: the enclosing function, class, or block; the block it heads when it's a heading; and the declarations of any name or type it mentions. Where there is no enclosing unit — module level, config files, scripts — read at least 10 lines either side. Redundancy is relative to what a reader of that code can see: a comment that would be informative in isolation is still narration when the surrounding names, types, and calls already say it, and a terse comment that looks like narration in the hunk may be the only statement of a constraint visible a few lines away.
Every comment can be rationalized into a why-comment: it mentions a reason, it might help a newcomer, it's harmless. None of those is a fact the code lacks. This skill fails when it leaves a file reading as a tutorial of itself, not when it deletes a comment a reader could have reconstructed from the code in five seconds. When you notice yourself writing "kept because it adds context", stop: name the fact or delete.
Classify every candidate comment into exactly one bucket. Remove is the default; the other three have entry conditions a comment must meet.
Comments that tooling reads; deleting or rewording them changes behavior. Read DIRECTIVES.md for per-language patterns: shebangs, encoding declarations and magic comments, linter and type-checker suppressions, coverage and security-scanner pragmas, formatter toggles, build and codegen directives, IDE structure markers, license and copyright headers, doctest examples inside docstrings. The patterns are representative, not exhaustive — a comment shaped like a machine directive (tool:action, short and rigidly formatted) that you don't recognize belongs here too. This is the one place doubt resolves toward keeping: an unrecognized directive-shaped comment stays.
A comment earns its place by carrying a fact that a competent engineer, reading the code fresh, would otherwise get wrong or be surprised by. Name the fact before you keep it; if you can't, it isn't one. Facts that qualify:
The test is the fact, not the word "because". A comment that gives a reason the code already shows is a pseudo-why comment — see Remove.
Condense is for comments that definitely carry a fact but bury it in prose. It is not the hedge for comments you're unsure about — if you can't name the fact you're preserving, there is no fact, and the comment goes in Remove.
help(), Sphinx, JSDoc, godoc, rustdoc, a docstring lint rule — check the repo's lint and docs config) → keep the contract (params, returns, raises, where the ecosystem expects them), delete the restated narration; condense, never deleteThe doubt rule: doubt resolves toward deletion. Not sure the comment carries a fact the code lacks → delete. Sure it carries one, but not sure the condensed version keeps it → keep the original and say so in the summary. Never condense as a compromise between keep and delete.
The default bucket: everything that isn't semantic and doesn't carry a nameable fact.
.lower()// MARK: and #region are never-touch)Match the surrounding codebase only where a convention is enforced: a lint rule or docs build that requires doc comments (godoc on exported symbols, a docstring rule) wins even where it feels redundant. An unenforced house style — "the other files have docstrings" — does not; note it in the summary instead of obeying it.
Comment ratio is comment lines ÷ non-blank lines over the candidate lines — added lines in diff mode, the whole file in sweep mode. A line counts as a comment when it is entirely comment or docstring: line comments, block-comment bodies, docstring bodies. Trailing comments on code lines don't count.
Measure before touching anything and again after — per file for small scopes, aggregate for large ones. cloc --git --diff $(git merge-base <base> HEAD) HEAD --by-file reports added comment and code lines per file for diff mode; cloc, scc, or tokei report comment and code lines per file for sweeps. When none is installed, count with grep -c against the language's comment syntax on the diff's added lines.
When I pass a maximum (15%), any file still over it after the taxonomy pass gets a second pass over its condensed comments: delete each one whose preserved fact is recoverable from a name, a type, a test, or a doc file. Measure again. If the file is still over, stop — the remainder is directives and why-comments, and deleting those to hit a number is the wrong trade. Report the file, its ratio, and its largest remaining comment blocks so I can decide.
The ratio checks the taxonomy; it doesn't replace it. Never delete a semantic or why-comment to reach the target, and never leave redundant narration in a file because it's already under the target.
Never modify code — not even a rename that would make a comment unnecessary. When a comment exists because the code is unclear (a bad name, a convoluted expression), apply the doubt rule to the comment and record the observation for the summary. The code fix belongs to a later turn if I want it.
Close with a concise report:
What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (will-wright-eng/skills) — no native marketplace selected
npx claudepluginhub p/will-wright-eng-will-wright-eng-skills21 skills in this plugin
/agent-specificationWrite or review the specification of an agent, or of a system of several agents, through a question/answer session. Chooses the arrangement first (one agent, pipeline, orchestrator or blackboard), then settles one SPECIFICATION.md per agent and, when there is more than one agent, a SYSTEM.md that states how they are joined. Works in a fresh repo or against one role of a system that already exists. Takes an optional path to a specification or system document to review. Use when defining, scoping or reviewing an agent or a multi-agent system, choosing between agent patterns, writing an agent's SPECIFICATION.md, or giving each role of an existing agent system a written scope./annealDecompose a god module into stable and volatile pieces whose boundaries match how the code actually changes. Locates hotspots with the hc CLI (decay-weighted churn × complexity quadrants), autopsies the chosen file along three evidence axes (symbol co-change, consumer slices, internal references), interviews through each proposed seam one at a time, and delivers a strangler-fig migration plan with a measurable hc baseline. Use when a file is a "god module" or "god file", one file soaks up every change, a module needs splitting, or the user wants to isolate hot code or reduce churn concentration.Other plugins' skills for the same job