agentleFS
caiopizzolcaiopizzol/comment-bench/skills/comment-audit/SKILL.md

comment-audit

Skill0 starsChanged 7 months agoMITView on GitHub

Audit code comments and agent-facing docs against a repository's comment policy. Use when asked to review comments, audit stale or redundant comments, check AIDEV-NOTE anchors, evaluate comment-policy.md / CLAUDE.md / AGENTS.md compliance, or inspect changed files for comments that should be kept, deleted, updated, or investigated.

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. meowdiocre/meowpi★ 3same name
    2. smarzban/agent-skills★ 1same name
    3. aayushbtw/skills★ 0same name
    4. mjmorales/claude-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.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

26 rules. 0 are common, 17 are distinctive, and 9 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 17

    Distinctive

    This author's own choices. Worth a look.

  • 9

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Default to audit-only. Do not edit files unless the user explicitly asks for fixes.

    line 12
  2. Very specific:

    Load policy: Read the repo's comment-policy.md if present.

    line 16
  3. Very specific:

    Choose scope: If the user gives a file or directory, audit that.

    line 17
  4. Very specific:

    Find candidate comments: Use rg first for obvious comment markers and loaded terms.

    line 20
  5. Very specific:

    Classify each finding: Use keep, delete, update, or investigate.

    line 21
  6. Distinctive:

    Use this only when the repo has no local policy.

    line 26
  7. Distinctive:

    Keep comments that encode invariants, business rules, security constraints, compliance rules, non-local coupling, compatibility promises, …

    line 28
  8. Distinctive:

    Delete comments that paraphrase the next line or restate obvious syntax.

    line 29
  9. Distinctive:

    Update comments that are stale, misleading, vague, missing required annotations, or no longer match code behavior.

    line 30
  10. Distinctive:

    Prefer specific comments near the code they constrain.

    line 31
  11. Distinctive:

    Treat stale comments as bugs.

    line 32
  12. Distinctive:

    Do not generalize these labels across projects.

    line 47
  13. Very specific:

    Prefer investigate over guessing when a comment refers to product, legal, compliance, migration, or incident context that is not in the …

    line 58
  14. Very specific:

    Do not require every language to follow AIDEV-NOTE:.

    line 71
  15. Very specific:

    Use rg to find likely issues before deeper reading.

    line 75
  16. Distinctive:

    When the user asks for documentation freshness, changed-file review, or a base-to-head audit, compare code changes against agent-facing …

    line 97
  17. Distinctive:

    Treat README.md, AGENTS.md, CLAUDE.md, architecture notes, runbooks, and tutorials as comment-like prompt surface.

    line 106
  18. Very specific:

    Read at least the surrounding function/class/module.

    line 117
  19. Distinctive:

    Check referenced symbols or files when named.

    line 118
  20. Distinctive:

    Check tests or callers when the comment states behavior not obvious from the local code.

    line 119
  21. Distinctive:

    Check recent diff context if auditing changed files.

    line 120
  22. Distinctive:

    If there are no findings, say that clearly and name the residual risk, for example: "No high-signal issues found in changed files.

    line 146
  23. Distinctive:

    If the user asks to apply fixes:

    line 150
  24. Distinctive:

    Do not invent business, legal, security, or historical context.

    line 153
  25. Very specific:

    Leave investigate items as report findings unless the user provides the missing context.

    line 155
  26. Distinctive:

    After edits, summarize changed files and remaining risks.

    line 156

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “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

Overview

Audit comments as prompt surface for future AI-assisted edits. The goal is not "more comments" or "fewer comments"; it is to preserve comments that carry information the code cannot recover and remove or repair comments that are redundant, vague, stale, or misleading.

Default to audit-only. Do not edit files unless the user explicitly asks for fixes.

Workflow

  1. Load policy. Read the repo's comment-policy.md if present. Also read relevant CLAUDE.md, AGENTS.md, .cursorrules, or package-local policy files when they govern the audited path. If no local policy exists, use the fallback policy below.
  2. Choose scope. If the user gives a file or directory, audit that. Otherwise audit changed files with git diff --name-only --diff-filter=ACMR HEAD and include staged files if relevant. If there is no git repo, ask for a scope.
  3. Skip noise. Exclude dependencies, generated artifacts, lockfiles, vendored code, build outputs, minified files, snapshots, and test fixtures unless the user explicitly includes them.
  4. Detect language conventions. Infer expectations from file extensions and local patterns. Do not apply TypeScript/JSDoc rules blindly to Python, Go, Rust, Java, or docs.
  5. Find candidate comments. Use rg first for obvious comment markers and loaded terms. Then read nearby code before classifying.
  6. Classify each finding. Use keep, delete, update, or investigate.
  7. Report. Lead with the highest-risk findings. Include file, line, action, reason, and suggested replacement or next step.

Fallback Policy

Use this only when the repo has no local policy.

  • Keep comments that encode invariants, business rules, security constraints, compliance rules, non-local coupling, compatibility promises, or historical rationale the code cannot express.
  • Delete comments that paraphrase the next line or restate obvious syntax.
  • Update comments that are stale, misleading, vague, missing required annotations, or no longer match code behavior.
  • Prefer specific comments near the code they constrain.
  • Treat stale comments as bugs. In agent-heavy repos, stale comments can become bad input for the next agent run.
  • Preserve public API documentation when the language ecosystem expects it, but verify it still matches behavior and types.

Project-Specific Overlays

Local policy beats the fallback policy. If comment-policy.md, CLAUDE.md, AGENTS.md, or package docs define project-specific terms, enforce those definitions.

Common examples:

  • legacy should say whether it means public compatibility, fallback behavior, old naming, or dead code.
  • deprecated should name the replacement and removal policy.
  • temporary should name the removal condition, issue, owner, or deadline.
  • compat-fallback should name the trigger, normal path, and retirement condition.
  • removed-dead or equivalent terms should not survive in comments that describe current behavior.

Do not generalize these labels across projects. Read the local policy first and use the repo's vocabulary.

Classification

Use these labels:

  • keep - The comment carries real context the code cannot recover, is accurate, and is placed where future edits will see it.
  • delete - The comment restates nearby code, adds generic filler, or creates noise with no recoverable value.
  • update - The comment is useful in principle but stale, vague, too far from the constrained code, or missing required project-specific metadata.
  • investigate - The comment makes a claim that cannot be verified locally. Name what must be checked.

Prefer investigate over guessing when a comment refers to product, legal, compliance, migration, or incident context that is not in the repo.

Language Awareness

Apply the repo policy through the conventions of the file being audited:

  • TypeScript / JavaScript: JSDoc may define public API, generated docs, typedefs, deprecation contracts, or consumer-facing behavior. Deletion threshold is higher for exported symbols.
  • Python: Docstrings can be runtime help, API docs, or behavior contracts. Check whether tests, callers, or generated docs rely on them.
  • Go: Public package, type, function, and method comments are part of Go documentation conventions. Do not delete solely because they restate a name.
  • Rust: /// and //! comments may include examples, docs, and doctests. Verify examples still compile conceptually.
  • Java / Kotlin / C#: Doc comments may define API contracts and generated documentation. Check @deprecated, replacement links, and version/removal notes.
  • Markdown / agent docs: CLAUDE.md, AGENTS.md, README architecture notes, and policy docs are prompt surface. Stale statements here can be higher risk than inline comments.

Do not require every language to follow AIDEV-NOTE:. Treat it as one useful convention, not a universal syntax.

Cheap Pre-Pass

Use rg to find likely issues before deeper reading. Adapt patterns to the repo.

Useful searches:

rg -n "AIDEV-NOTE|TODO|FIXME|HACK|temporary|deprecated|legacy|compat|fallback|workaround|remove|delete|old|special handling|returns the appropriate|helper function" .
rg -n "@deprecated|@todo|@fixme|@internal|@public" .
rg -n "for now|eventually|later|soon|should be removed|no longer used|not used|dead code" .

Flag these common problems:

  • Bare temporary, for now, or workaround with no issue, owner, or removal condition.
  • Bare @deprecated with no replacement or removal/version policy.
  • legacy without explaining whether it means public compatibility, dead code, old name, or fallback.
  • Vague warnings such as "special handling", "be careful", or "business logic" with no rule, file, symbol, or consequence.
  • Generic AI-style comments such as "returns the appropriate value", "helper function", or "processes the data".
  • Comments naming symbols, files, feature flags, APIs, or migrations that no longer exist.
  • Comments far from the code they constrain, especially when the constrained code is likely to be edited without reading the header.

Diff Freshness Pass

When the user asks for documentation freshness, changed-file review, or a base-to-head audit, compare code changes against agent-facing docs:

git diff --name-only --diff-filter=ACMR <base>...HEAD
git diff --unified=0 <base>...HEAD -- <changed-files>
rg -n "<symbol-or-rule-from-diff>" README.md AGENTS.md CLAUDE.md docs/ .cursorrules 2>/dev/null

Treat README.md, AGENTS.md, CLAUDE.md, architecture notes, runbooks, and tutorials as comment-like prompt surface. If a changed symbol, feature flag, business rule, route, migration, config key, or public workflow is documented, check whether the prose still matches the code. Classify stale or unverifiable docs the same way as stale inline comments: update, delete, or investigate.

Reading Nearby Code

For each candidate comment:

  1. Read at least the surrounding function/class/module.
  2. Check referenced symbols or files when named.
  3. Check tests or callers when the comment states behavior not obvious from the local code.
  4. Check recent diff context if auditing changed files.
  5. Distinguish "stale comment" from "code bug": if the comment documents a real policy and code violates it, classify as investigate or update code? rather than deleting the comment.

Output Format

Use this structure:

Comment audit: <scope>

Summary
- keep: <n>
- delete: <n>
- update: <n>
- investigate: <n>

Findings
1. <action> <file>:<line>
   Comment: <short excerpt>
   Reason: <one or two sentences>
   Suggested action: <delete/update text/check X>

Notes
- <policy gaps, language-specific caveats, or files skipped>

If there are no findings, say that clearly and name the residual risk, for example: "No high-signal issues found in changed files. This did not audit unchanged architecture docs."

Fix Mode

If the user asks to apply fixes:

  1. Apply only low-risk deletes or local wording updates.
  2. Do not invent business, legal, security, or historical context.
  3. Preserve public API docs unless replacement wording is clearly known.
  4. Leave investigate items as report findings unless the user provides the missing context.
  5. After edits, summarize changed files and remaining risks.

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.