ln-613-code-comments-auditor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePaths: File paths (,shared/,references/) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.../ln-*
路径说明: 文件路径(、shared/、references/)是相对于技能仓库根目录的。如果在当前工作目录(CWD)中未找到,请定位到SKILL.md所在目录,然后向上一级即为仓库根目录。../ln-*
Code Comments Auditor (L3 Worker)
代码注释审计器(L3 Worker)
Specialized worker auditing code comments and docstrings quality.
专注于审计代码注释与文档字符串质量的Worker。
Purpose & Scope
目标与范围
- Worker in ln-610 coordinator pipeline - invoked by ln-610-docs-auditor
- Audit code comments for quality and compliance across 6 categories
- Universal for any tech stack (auto-detect comment syntax)
- Return structured findings to coordinator with severity, location, recommendations
- Calculate compliance score (X/10) for Code Comments category
- ln-610协调器流水线中的Worker - 由ln-610-docs-auditor调用
- 从6个维度审计代码注释的质量与合规性
- 支持任意技术栈(自动检测注释语法)
- 向协调器返回结构化检查结果,包含严重程度、位置和改进建议
- 计算代码注释维度的合规得分(X/10)
Inputs (from Coordinator)
输入参数(来自协调器)
MANDATORY READ: Load .
shared/references/audit_worker_core_contract.mdReceives with: , , .
contextStoretech_stackproject_rootoutput_dir必读: 加载文件。
shared/references/audit_worker_core_contract.md接收包含以下字段的:、、。
contextStoretech_stackproject_rootoutput_dirWorkflow
工作流程
- Parse Context: Extract tech stack, project root, output_dir from contextStore
- Scan: Find all source files (use for detection)
tech_stack - Extract: Parse inline comments + docstrings/JSDoc
- Audit: Run 6 category checks (see Audit Categories below)
- Collect Findings: Record each violation with severity, location (file:line), effort estimate (S/M/L), recommendation
- Calculate Score: Count violations by severity, calculate compliance score (X/10)
- Write Report: Build full markdown report per , write to
shared/templates/audit_worker_report_template.mdin single Write call{output_dir}/613-code-comments.md - Return Summary: Return minimal summary to coordinator (see Output Format)
- 解析上下文: 从contextStore中提取技术栈、项目根目录、输出目录
- 扫描文件: 查找所有源文件(利用进行检测)
tech_stack - 提取内容: 解析行内注释 + 文档字符串/JSDoc
- 执行审计: 完成6个维度的检查(详见下方审计维度)
- 收集结果: 记录每一项违规内容,包含严重程度、位置(文件:行号)、修复工作量预估(S/M/L)、改进建议
- 计算得分: 按严重程度统计违规项数量,计算合规得分(X/10)
- 生成报告: 按照模板生成完整Markdown报告,通过单次写入操作保存到
shared/templates/audit_worker_report_template.md{output_dir}/613-code-comments.md - 返回摘要: 向协调器返回极简版结果摘要(详见输出格式)
Audit Categories
审计维度
| # | Category | What to Check |
|---|---|---|
| 1 | WHY not WHAT | Comments explain rationale, not obvious code behavior; no restating code |
| 2 | Density (15-20%) | Comment-to-code ratio within range; not over/under-commented |
| 3 | No Forbidden Content | No dates/authors; no historical notes; no code examples in comments |
| 4 | Docstrings Quality | Match function signatures; parameters documented; return types accurate |
| 5 | Actuality | Comments match code behavior; no stale references; examples runnable |
| 6 | Legacy Cleanup | No TODO without context; no commented-out code; no deprecated notes |
| 序号 | 维度 | 检查内容 |
|---|---|---|
| 1 | 说明原因而非内容 | 注释需解释设计思路,而非重复代码的明显行为;不得复述代码逻辑 |
| 2 | 注释密度(15-20%) | 注释与代码占比需在范围内;避免注释过多或过少 |
| 3 | 无禁用内容 | 不得包含日期/作者信息;不得包含历史记录;注释中不得有代码示例 |
| 4 | 文档字符串质量 | 与函数签名匹配;参数已文档化;返回类型描述准确 |
| 5 | 时效性 | 注释与代码行为一致;无过时引用;示例代码可正常运行 |
| 6 | 遗留内容清理 | 无缺失上下文的TODO标记;无被注释掉的代码;无已废弃的说明 |
Scoring Algorithm
评分算法
MANDATORY READ: Load and .
shared/references/audit_worker_core_contract.mdshared/references/audit_scoring.md必读: 加载和文件。
shared/references/audit_worker_core_contract.mdshared/references/audit_scoring.mdOutput Format
输出格式
MANDATORY READ: Load and .
shared/references/audit_worker_core_contract.mdshared/templates/audit_worker_report_template.mdWrite report to with and checks: why_not_what, density, forbidden_content, docstrings_quality, actuality, legacy_cleanup.
{output_dir}/613-code-comments.mdcategory: "Code Comments"Return summary to coordinator:
Report written: docs/project/.audit/ln-610/{YYYY-MM-DD}/613-code-comments.md
Score: X.X/10 | Issues: N (C:N H:N M:N L:N)Severity mapping:
| Issue Type | Severity |
|---|---|
| Author names, dates in comments | CRITICAL |
| Commented-out code blocks | HIGH |
| Stale/outdated comments | HIGH |
| Obvious WHAT comments | MEDIUM |
| Density deviation >5% | MEDIUM |
| Minor density deviation | LOW |
必读: 加载和文件。
shared/references/audit_worker_core_contract.mdshared/templates/audit_worker_report_template.md将报告写入,标记,检查项包括:why_not_what、density、forbidden_content、docstrings_quality、actuality、legacy_cleanup。
{output_dir}/613-code-comments.mdcategory: "Code Comments"向协调器返回如下格式的摘要:
Report written: docs/project/.audit/ln-610/{YYYY-MM-DD}/613-code-comments.md
Score: X.X/10 | Issues: N (C:N H:N M:N L:N)严重程度映射:
| 违规类型 | 严重程度 |
|---|---|
| 注释中包含作者姓名、日期 | CRITICAL(严重) |
| 被注释掉的代码块 | HIGH(高) |
| 过时注释 | HIGH(高) |
| 重复代码内容的注释 | MEDIUM(中) |
| 注释密度偏差超过5% | MEDIUM(中) |
| 注释密度小幅偏差 | LOW(低) |
Critical Rules
核心规则
MANDATORY READ: Load .
shared/references/audit_worker_core_contract.md- Do not auto-fix: Report violations only; coordinator aggregates for user
- Fix code, not rules: NEVER modify rules files (*_rules.md, *_standards.md) to make violations pass
- Code is truth: When comment contradicts code, flag comment for update
- WHY > WHAT: Comments explaining obvious behavior should be removed
- Universal: Works with any language; detect comment syntax automatically
- Location precision: Always include for programmatic navigation
file:line
必读: 加载文件。
shared/references/audit_worker_core_contract.md- 禁止自动修复: 仅报告违规内容;由协调器汇总后提交给用户处理
- 修改代码而非规则: 绝不修改规则文件(_rules.md、_standards.md)来使违规项通过检查
- 代码为基准: 当注释与代码行为矛盾时,标记注释需更新
- 原因优先于内容: 解释明显代码行为的注释应被移除
- 通用性: 支持任意编程语言;自动检测注释语法
- 位置精准: 必须包含格式的位置信息,以支持程序化导航
file:line
Definition of Done
完成标准
MANDATORY READ: Load .
shared/references/audit_worker_core_contract.md- contextStore parsed successfully (including output_dir)
- All source files scanned (tech stack from contextStore)
- All 6 categories audited
- Findings collected with severity, location, effort, recommendation
- Score calculated using penalty algorithm
- Report written to (atomic single Write call)
{output_dir}/613-code-comments.md - Summary returned to coordinator
必读: 加载文件。
shared/references/audit_worker_core_contract.md- 成功解析contextStore(包括output_dir)
- 已扫描所有源文件(基于contextStore中的技术栈)
- 已完成全部6个维度的审计
- 已收集所有包含严重程度、位置、工作量、建议的检查结果
- 已通过惩罚算法计算得分
- 已将报告写入(原子化单次写入操作)
{output_dir}/613-code-comments.md - 已向协调器返回结果摘要
Reference Files
参考文件
- Comment rules and patterns: references/comments_rules.md
Version: 4.0.0
Last Updated: 2026-03-01
- 注释规则与模式:references/comments_rules.md
版本: 4.0.0
最后更新: 2026-03-01