ar-optimize-doc-comments

Audit and repair doc comments by verifying documented names against real code signatures.

1|2|Updated Jul 11, 2026
One-click install
npx skills add https://github.com/mahsanamin/agentic-repos --skill ar-optimize-doc-comments-mahsanamin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ar-optimize-doc-comments
Source: https://github.com/mahsanamin/agentic-repos/tree/main/skills/ar-optimize-doc-comments
Command: npx skills add https://github.com/mahsanamin/agentic-repos --skill ar-optimize-doc-comments-mahsanamin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Doc comments sit next to code but nothing compiles them, so they drift silently: parameters get renamed, return types change, and copied blocks document the wrong method. Because the code still works, stale documentation is trusted far longer than it should be, and bloated comment blocks add reading cost to every file. ## Core Features & Use Cases - Signature Drift Detection: Parses every declaration in scope and mechanically verifies each documented name, @param, @return, and @throws against the real signature, auto-fixing provable mismatches. - Eleven-Class Defect Taxonomy: Classifies each block as signature drift, clone drift, contradiction, tautology, history, ticket reference, body restatement, oversized, orphaned, tombstone, or load-bearing, with distinct actions per class. - Prioritized Bloat Sweeps: Scores and ranks blocks and files by targetable lines so a bounded pass on a large codebase captures most of the win and names exactly what was left. - Use Case: Before publishing API reference docs (javadoc, typedoc, sphinx, DocC), run the audit on the modules a release touches to fix wrong parameter names, strip ticket IDs and design archaeology, and compress oversized blocks while preserving load-bearing constraints. ## Quick Start Ask the assistant to run ar-optimize-doc-comments on a module or the current PR diff to audit the doc comments and fix signature drift.

Frequently Asked Questions about ar-optimize-doc-comments

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find stale doc comments in a large codebase?▼

Parse every declaration into a declaration-to-signature-to-comment table, then verify each documented name against the real signature. Score blocks by size and content (ticket references, history, body restatement) and rank files by targetable lines so a bounded pass covers the highest-value findings first.

How to detect Javadoc @param tags that no longer match the method?▼

Compare each @param name against the parsed method signature; a tag naming an argument that does not exist is signature drift and can be auto-fixed since the signature is the single source of truth. Never invent descriptions for parameters that were never documented.

Can doc comment cleanup be automated safely?▼

Only signature drift is safe to auto-fix because it has exactly one correct answer. Tautologies, history, and ticket references are proposed rather than applied, since a comment can carry the only record of a design constraint in a throwaway clause.

Why does naive regex parsing of annotations give wrong results?▼

Attributes and decorators contain string literals that are not parameters, and nested closing brackets inside strings truncate naive scans. Read attributes by name, match balanced delimiters, and hand-verify a sample of parsed declarations before trusting the counts.

When should doc comments be deleted entirely?▼

Convention-named declarations like ORM derived queries, generated builders, and plain getters document themselves, so the correct doc comment is none. Also delete pure archaeology blocks where re-tensing to the present leaves no load-bearing constraint, trap, or contract.

Does this work with generated code and published APIs?▼

Generated sources are never edited; fix the generator or template instead. For published symbols consumed outside the repo, correct wrong claims freely but flag any change to the documentation's shape rather than deleting blocks.