agentleFS
mjmoralesmjmorales/claude-skills/skills/comment-audit/SKILL.md

comment-audit

Skill0 starsChanged 6 months agoMITView on GitHub

Audit and clean up source-code comments in any language. Use when asked to audit comments, clean up comments, remove LLM comment smell, fix comment rot, or do a comment cleanup. Removes stale cross-references (Jira/GitHub/RFC/phase refs), temporal/LLM-authorship tells ("for now", "in a real implementation", "previously"), and WHAT-not-WHY narration; keeps WHY/HOW comments.

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. meowdiocre/meowpi★ 3same name
    2. aayushbtw/skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read-only tools (Read, Grep, Glob, git) during the audit.

    line 14
  2. Distinctive:

    Resolve scope: If the user named files, directories, or a diff, audit those.

    line 18
  3. Distinctive:

    Read once: Read each in-scope file fully into memory.

    line 19
  4. Very specific:

    Gate once: Call AskUserQuestion with header Review and options Apply / Revise.

    line 25
  5. Distinctive:

    Never delete a comment whose content is a genuine WHY/HOW or a real constraint.

    line 38
  6. Distinctive:

    Never silently downgrade a stub into shipped code.

    line 39
  7. Distinctive:

    Never re-read a file mid-pass.

    line 40
  8. Very specific:

    Never apply edits before the gate.

    line 41
  9. Very specific:

    When a comment's intent is ambiguous (could be WHY or could be noise), flag it as uncertain and propose, but defer to the user at the gate …

    line 42

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Comment Audit

Audit comments for rot and noise, then apply fixes behind one review gate. Headline principle: no comment is better than a bad comment.

Architecture

ONE read pass over the target files into memory. Then THREE sequential audit passes over that in-memory content — do not re-read files per pass. Collect all findings, present them grouped, gate once, then apply approved edits.

Read-only tools (Read, Grep, Glob, git) during the audit. Make edits only after the gate approves.

Workflow

  1. Resolve scope. If the user named files, directories, or a diff, audit those. Otherwise default to the current git diff (git diff --name-only plus staged) and state that you are doing so. Skip generated and vendored files (lockfiles, vendor/, node_modules/, dist/, *.pb.go, *_generated.*, minified assets).
  2. Read once. Read each in-scope file fully into memory. This is the only read pass.
  3. Run the three passes over the in-memory content. See references/comment-smells.md for the full detection catalog — trigger phrases, why each is harmful, and the remedy per family.
    • Pass 1 — Shifting / meta references.
    • Pass 2 — Temporal anchoring (LLM-authorship smell).
    • Pass 3 — Poor structure / WHAT-not-WHY bloat.
  4. Present findings, grouped by pass then by file. Per finding: file:line, the offending comment, which family it hit, and the proposed remedy (delete / rewrite-to-state-constraint / upgrade-to-WHY). Quote the exact replacement for rewrites.
  5. Gate once. Call AskUserQuestion with header Review and options Apply / Revise. On Apply, make the edits. On Revise, take the user's adjustments and re-present, then gate again. Do not edit before approval.
  6. Apply approved edits and report a one-line-per-file summary of what changed.

Pass summary

Detail and examples live in references/comment-smells.md. Quick map:

  • Pass 1 — Shifting / meta references. Comments anchored to identifiers outside the source (issue IDs, spec/RFC sections, task-plan phases) that drift independently and rot into misdirection. Remedy: if the comment's value is the cross-ref, delete it; if it states a real constraint, rewrite to state the constraint directly without the volatile ref.
  • Pass 2 — Temporal anchoring. Three sub-families: forward-deferral ("for now", "eventually"), stub-admission ("in a real implementation", "for simplicity"), retro-temporal ("previously", "now we", "as of this change"). Remedies, respectively: do the work or write an auditable TODO with owner + concrete trigger; implement properly or fail loudly (raise/panic/not-implemented); delete — that history belongs in VCS.
  • Pass 3 — Poor structure. WHAT-narration that restates the code (// increment i), commented-out code, and stale doc-comments that contradict the code. Remedy: delete pure WHAT-narration and commented-out code; upgrade salvageable comments to state the WHY (rationale, tradeoff, non-obvious constraint, invariant, gotcha); fix doc-comments that lie. Keep comments that explain WHY, or HOW at a level the code can't show.

Rules

  • Never delete a comment whose content is a genuine WHY/HOW or a real constraint; instead, rewrite it to drop the volatile anchor while preserving the substance.
  • Never silently downgrade a stub into shipped code; instead, implement it or make it fail loudly.
  • Never re-read a file mid-pass; instead, operate on the in-memory copy from the single read pass.
  • Never apply edits before the gate; instead, present all findings and wait for Apply.
  • When a comment's intent is ambiguous (could be WHY or could be noise), flag it as uncertain and propose, but defer to the user at the gate rather than auto-deleting.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.