Agent Skills
› LodyAI/Lody
› delete-comment
delete-comment
GitHub自动化审计代码注释,分类为冗余、过时或借口并删除,迁移重要决策记录。通过扫描器精准定位,执行语法检查并更新基线,实现注释精简与合规管控。
触发场景
请求清理或审查代码注释
需要减少注释数量以符合规范
安装
npx skills add LodyAI/Lody --skill delete-comment -g -y
SKILL.md
Frontmatter
{
"name": "delete-comment",
"description": "Audit code comments in a scope, classify each as Tautology, Excuse, Stale, or Decision Record, delete the removable ones, relocate durable rationale, and tighten the comment ratchet. Use for comment audits, comment cleanup passes, or any request to reduce or review comments."
}
Delete comments
scripts/check-comment-ratchet.mjs bans comment growth per scope: counted
comment lines may only shrink against scripts/comment-ratchet-baseline.json.
This skill is the repeatable audit procedure for that ratchet.
Census
node scripts/check-comment-ratchet.mjs --reportfor per-scope counts.node scripts/check-comment-ratchet.mjs --dump <dir>to list comments with file and line ranges. The scanner is string/template/regex-aware; trust its ranges, nevergrep //.- Weighted sample: the heaviest files per scope plus a spread across file kinds (source, tests, UI, libs).
Classify, then act
- Tautology (restates the next line: "Increment counter", section labels, decorative banners): delete.
- Stale (describes removed behavior or expired compat windows): delete; if the dead code also remains, report it, don't silently remove it.
- Excuse (excuses a hack, or a TODO/FIXME with no owner): delete; record the underlying follow-up in the PR body or a note. Only file an issue when the user explicitly asks.
- Decision Record (non-obvious why: lifecycle, compat, containment): check
for an existing durable home first — scoped
AGENTS.md,.agents/docs/, linked notes. If covered, delete as redundant. If not, move a condensed version into the nearestAGENTS.mdthat has word-ceiling headroom (scripts/docs/agents-budgets.json); watchpnpm run docs status.
Exempt, never delete by policy
JSDoc /** */, tool directives (@ts-*, oxlint/eslint/biome/prettier,
istanbul/c8, cspell, #region, @generated, sourceMappingURL, PURE
annotations, triple-slash, @dec:). The scanner marks these exempt.
Deletion safety
- Delete comments with the scanner's ranges (see
scanCommentsexport) or by hand from the dump; never a line-level//regex — comments inside template literals (GLSL shaders, embedded docs) are false positives. - After each file, syntax-check:
git diffreview plus a parse of the file. - Then
node scripts/check-comment-ratchet.mjs --updateto tighten the baseline; re-run with no args to verify the ratchet passes.
版本历史
- 4e2f025 当前 2026-11-26 00:12


