/review:comment-auditfrom Review toolkit
Audit every comment, docblock, JSDoc, Python docstring, GraphQL description, and markdown line a branch adds and give each a verdict (DELETE, TRIM, MOVE, KEEP, UNSURE, WRONG). Use before opening a PR, when reviewing a PR's comments, or when asked to trim, audit, or clean up comments. Report only by default; `--apply` edits and commits.
Ships in Review toolkit. 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; scripts run unread.
Code that reads clearly needs no comment saying what it does. A comment earns its place only when no name, type, or signature can carry it. This skill walks every comment a branch adds, checks the claim each one makes against the code, and gives it exactly one verdict. Report mode writes one file and changes nothing else. --apply edits the comments and makes one commit.
Two calibration examples:
reportUnknownStatus() docblock saying it calls report() rather than the logger because a log line cannot reach the error tracker. The method name already says it reports. A second paragraph explaining that the tracker's sender is synchronous HTTP is a WHAT any engineer reading the file already knows.logTransportFailure() docblock saying an unconfigured endpoint returns earlier with a warning and never reaches this method. That explains why a case looks unhandled here, so it survives. It should be one sentence, not a paragraph./review:comment-audit [--apply] [key=value ...]
| Argument | Meaning |
|---|---|
--apply | Edit and commit instead of reporting only. |
base= | The ref the branch merges into. |
head= | The branch tip under audit. |
dirs= | Space separated paths whose diff is in scope. |
readme= | The README that holds, or indexes, rationale shared by two or more sites. |
ticket= | Ticket id for the commit subject in apply mode. |
out= | Path the report is written to. |
sibling=<name>:<path> | A checkout of another system whose behaviour the comments claim. Repeatable. |
Without --apply the only file written is the report.
Where they conflict with this file, this file wins.
In this order, stopping at the first source that answers:
| Value | Argument | Detection | Ask if still missing |
|---|---|---|---|
| base | base= | gh pr view --json baseRefName; else the default branch of origin | yes |
| head | head= | HEAD | no |
| dirs | dirs= | every path in the diff, minus vendor/, node_modules/, .venv/, venv/, site-packages/, __pycache__/, *.egg-info/, build/ and dist/ in a Python package, tool caches (.ruff_cache/, .pytest_cache/, .mypy_cache/, .pyrefly_cache/, .complexipy_cache/), lockfiles (uv.lock, poetry.lock, and Pipfile.lock among them), and paths matching generated-code markers (generated, wayfinder, .d.ts under a generated dir, _ide_helper, *.min.*, *_pb2.py, *_pb2_grpc.py, .pyi under a generated dir, migrations/versions/, */migrations/0*.py) | no, but list the exclusions in the report |
| readme | readme= | nearest README.md at or above the directory with the most diffed files | yes, only when a MOVE verdict needs one |
| ticket | ticket= | branch name pattern [A-Z]+-\d+; else the PR title | no, fall back to docs: prefix |
| format, lint, test commands | none | the project's CLAUDE.md and .claude/rules/*.md; else composer.json / package.json scripts; else, for a Python project, the sources under Python commands | yes, in --apply mode only |
| sibling checkouts | sibling= | none | no; claims about another system become UNSURE with the path that would settle them |
| out | out= | <scratchpad>/comment-audit-<pr or branch>.md | no |
Echo the resolved values at the top of the report.
When a row marked yes cannot be resolved and no answer is available, stop and report which value is missing. Do not guess a base ref.
When CLAUDE.md and .claude/rules/*.md name no command, a Python project resolves each of format, lint, type check, and test from the first of these sources that names it:
Makefile or justfile targets named format, lint, typecheck, and test, run as make <target> or just <target>.noxfile.py sessions and tox.ini environments with those names, run as nox -s <name> or tox -e <name>..pre-commit-config.yaml. When it is the only gate, lint is pre-commit run --all-files. Its local hooks name the type checker and any extra gates (deptry, bandit, vulture, complexipy, pylint), which a stage may also run.pyproject.toml tool tables: [tool.ruff] gives ruff format and ruff check; [tool.mypy], [tool.pyright], [tool.pyrefly], or [tool.ty] gives mypy, pyright, pyrefly check, or ty check; [tool.pytest.ini_options] gives pytest.A command from the tool tables runs as uv run <command> when uv.lock exists, and as poetry run <command> when poetry.lock exists. A command CLAUDE.md lists wins over all of these, as it does for every other language.
bash ${CLAUDE_PLUGIN_ROOT}/skills/comment-audit/scripts/count-comment-lines.sh BASE HEAD DIRS
It prints one number: the added lines whose first non-blank characters are //, #, *, /*, /**, """, {/*, or <!--, plus, in a file named .sql, .psql, .pgsql, .lua, .elm, .ada, .adb, .ads, .vhd or .vhdl, -- followed by anything (--text, a --- banner, VHDL's --!, the --[[ line that opens a Lua block); in a .mysql file, -- followed by whitespace or the end of the line, because MySQL reads --1 as code (a .sql file in the MySQL dialect takes the wide rule, since no file name tells the dialects apart); and in a .hs or .lhs file two or more dashes followed by a character that is not an ASCII Haskell symbol, or by the end of the line, so -- |, --- and --text count while -->, --| and other operators do not. Not recognised: the lines inside a Lua --[[ ]] block and its closing ]], Haskell and Elm {- -} blocks, and the > code lines of a Bird-style .lhs file. The report opens with it.
A .py file is counted by python-comment-lines.py beside the script instead: every line of a module, class, or function docstring in any quote style, except a blank line, a doctest example, and a line the docstring shares with code, and every # comment with nothing before it on its line. Tool directives (the markers listed under Python in ../writing-comments/SKILL.md), a shebang, and an encoding declaration are not counted, even when a reason follows the marker. Step 3 still rules on that reason, so the findings can hold more entries than the count; when they do, the report says the difference is reasoned directives. Without python3 on PATH, or for a file that does not parse, or for a path git quotes in a diff header (one holding ", \, or a control character), Python is counted with the regex above and the script prints one line to stderr per file that does not parse, or one line in total when python3 is missing. Quote that line under the count.
If the command fails, the ref does not exist in this clone. Run git fetch and retry, or re-resolve base. A count of 0 means the branch adds no comments; write the report saying so and stop.
Steps 2 through 4 read git diff BASE...HEAD -- DIRS. Three dots, so only what the branch adds is in scope.
Inventory every rationale stated at two or more sites in the diff before ruling on any single comment.
For each one, first check whether the README or a markdown file beside it already covers it. If one does, the verdict is MOVE with a pointer and no new text. Otherwise decide where the text belongs.
The README is read by everyone who opens the directory. A topic file beside it (cache-keys.md, consent-flow.md) is read only by someone who has a reason to. Ask one question: would every reader of this directory need this before changing anything in it?
Calibration:
When the call is close, prefer the topic file. Splitting a file out later costs more than indexing one now. When an existing README section itself fails the question, say so in the report and suggest moving it out to a topic file with the new text.
A topic file gets an index line in the README naming the situation that sends a reader there, not a summary of the file:
- [Cache keys](cache-keys.md): read before changing a cache key's shape or TTL.
Extend an existing topic file on the same subject before creating a new one. For every proposal give the target (README section or topic file, new or existing), the sites it replaces, the full proposed text, a mermaid diagram where it replaces paragraphs (flows, hierarchies, pipelines), the index line when the target is a topic file, and one sentence on why it goes there.
The pointer left at each site is one line: See README.md, "<section>"., See <topic>.md., or See <topic>.md, "<section>". when the file has more than one section. Write the path relative to the repo root when the site is in another directory.
If no README resolves and a MOVE needs one, ask for readme=. With no answer available, propose the text anyway and name the missing path in the report.
Every added comment, docblock, JSDoc, Python docstring, GraphQL description, Storybook description, and markdown line gets exactly one verdict:
Good WHY examples, the kind that survive:
Rules for the rewrites:
it() or test() description is the comment, in every test framework. Keep prose only for a scenario that is not obvious from the name and the assertions.@param, @return, @var, @phpstan-type, @property, and JSDoc types are never removed. Only their descriptions are judged. A description that restates the name is a DELETE of the description, not of the annotation.""" description is a comment and is judged by the same rules. List every one with a verdict in its own report section, because they show up in introspection.sibling=<name>:<path>. With no sibling for that system, the verdict is UNSURE and the report names the file that would settle it.Write the report to out in the shape of references/report-template.md.
Line numbers are from the HEAD side of the diff, and a comment that spans several lines is listed by its first line, so they can be pasted as PR review comments. Quote every comment verbatim; the reviewer should not need the diff open to follow the report.
The template's two summary requirements are easy to drop and both are mandatory: state the added comment line count and an estimate of what remains once every DELETE, TRIM, and MOVE lands, and open the Summary with the three or four findings that matter most, not just a verdict tally. Derive the after-count M as N minus the lines of every DELETE, minus the lines removed by every TRIM and MOVE, where a MOVE leaves one pointer line per site.
Edit comments, docblocks, JSDoc, the README and topic files beside it, and schema descriptions only. Never change code.
A comment that is WRONG is corrected to match the code, never the code changed to match the comment. List every correction.
A comment that exists because the code is confusing is left in place and listed.
Never touch generated files, files outside dirs, vendor/, node_modules/, or lockfiles.
Commit the trim first, subject <TICKET>: trim comments and docblocks (or docs: trim comments and docblocks when no ticket resolved), so the verify script has a commit to compare against:
bash ${CLAUDE_PLUGIN_ROOT}/skills/comment-audit/scripts/verify-comments-only.sh FROM TO DIRS
FROM is the commit before the trim and TO is the commit carrying it, so HEAD~1 HEAD after the commit. The script prints every changed line that is not a comment or blank and exits 1. It skips a file that is markdown on both sides of the diff, so doc edits do not appear as hits. A .py file is checked with python-comment-lines.py on each side of the diff, so a docstring trim produces no hits, while a changed directive comment (# type: ignore, # noqa, # pragma:) is a hit, because it changes what a tool reports, and a trim that leaves a .py file unable to parse is a hit naming the file. Every hit gets a one-line explanation in the report. Two kinds of hit are expected and still get their line:
<!-- -->, a /* */ block without a leading * on each line, the lines inside a Lua --[[ ]] block and its closing ]], every line of a Haskell or Elm {- -} block, or, when the script warned that python3 is missing or a file does not parse, the inside of a Python docstring./* a */ code, --[[a]] code) passes as a comment line, so read such lines by eye.Run the project's format, lint, and test commands, in that order, using the commands resolved in step 0. If one of them could not be resolved, skip it and say so in the final message.
If the formatter changes a file the audit did not touch, revert that file. Amend the trim commit with formatter changes to files the audit did touch, so the branch still carries one commit.
Quote, do not summarise, the output of any step that did not pass.
One commit. No push.
The final message carries: comment line counts before and after, README sections and topic files added or extended, with the index lines added, comments corrected under WRONG, verify hits with an explanation for each, comments kept but unsure, and quoted tool output for any step that failed.
Comments, rewrites, and the report itself follow ../writing-comments/references/style.md.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
6 skills in this plugin
/correctness-reviewHunt correctness defects in a diff through named angles (hunk scan, removed behaviour, callers and callees, language pitfalls, wrapper routing) and drop a candidate only when the code refutes it. Use for a correctness or bug review of a branch or PR, and as the first correctness pass of pr-review./pr-commentsUse when a code review report (the pr-review consolidated report, a single stage report, or pasted findings) has to become comments a pull request author reads, anchored to a file and line, graded for severity, and referenceable by a code. Also use when asked to format, post, clean up, or grade review findings for a PR./pr-reviewOrchestrate a three-stage review (correctness, type safety, comment audit) of one PR or a stack of PRs, delegating each stage to a subagent with a structural brief and consolidating one report. Use when asked for a comprehensive, full, or three-stage PR review, or to review a PR stack.npx claudepluginhub noppu-labs/ai-toolkit --plugin review