文档

Improve Code Comments

试用

Use when auditing, adding, removing, or improving code comments, docstrings, JSDoc/TSDoc, TODO/FIXME/HACK notes, public API comments, inline rationale, stale...

它能做什么

Use when auditing, adding, removing, or improving code comments, docstrings, JSDoc/TSDoc, TODO/FIXME/HACK notes, public API comments, inline rationale, stale...

技能文档

Improve Code Comments

Improve comments with the smallest durable change. Only edit comments and docstrings; do not change code, tests, configuration, or external docs.

Default Workflow

  1. Read local guidance first: AGENTS.md, existing docstring style, lint rules, generated/vendor paths, and nearby examples.
  2. Audit before editing unless the user explicitly asks for a narrow direct fix.
  3. Report findings with file:line, severity, evidence, and proposed action.
  4. Edit only confirmed or clearly requested comment targets. Avoid whole-repo rewrites.
  5. Run the narrow formatter/check command when comment edits can affect syntax or generated docs.

What To Change

Use this order:

  1. Remove comments that are stale, misleading, redundant, commented-out code, author/date/history notes, or vague TODOs.
  2. Update comments that contain useful context but no longer match current code.
  3. Add comments only for hidden intent: business rules, non-obvious constraints, edge cases, performance/security tradeoffs, workaround reasons, lifecycle/ownership requirements, surprising return values, or public API contracts.
  4. Recommend escalation when long architecture rationale belongs in ADRs, design docs, or API docs instead of large inline blocks.

Quality Rules

  • Explain why, not what the syntax already says.
  • Match the existing project style; do not force a docstring format or file headers into a repo that does not use them.
  • Public/exported API comments and docstrings may be more complete. Internal code gets comments only when the name, type signature, and local conventions do not carry enough context.
  • Preserve tool directives exactly: eslint-disable, biome-ignore, prettier-ignore, @ts-expect-error, coverage pragmas, generated-code markers, and similar comments.
  • Preserve institutional knowledge during refactors unless it is demonstrably wrong or the code it explains is removed.
  • Do not use comment-density targets. Judge value per comment.
  • TODO/FIXME/HACK comments need a concrete action and context: blocker, issue/spec reference, owner, or removal condition.

Accuracy Checks

Verify comment claims against code before trusting them: thresholds, units, fallbacks, error handling, retries, null/empty cases, references, flags, public signatures, side effects, and tool-marker behavior.

Severity

Use severity to keep reports useful:

  • Critical: comment would cause unsafe use, data loss, security misunderstanding, or a false public contract.
  • High: stale/misleading comment, commented-out code, or wrong docstring for a public API.
  • Medium: redundant or vague comment, missing rationale around non-obvious behavior, weak TODO/FIXME/HACK.
  • Low: style, placement, wording, or optional clarity improvement.

Output

For audits, return:

  1. Summary
  2. Must Fix
  3. Useful Improvements
  4. Recommended Removals
  5. Good Existing Patterns

For edits, summarize changed paths and validation. If the user asks to "add comments" broadly, stop after the audit report and ask which candidates to apply.

相关技能

Analyze and improve existing documentation using Diataxis principles

20 次安装

Systematic code error diagnosis and fix skill. Handles compilation errors, runtime exceptions, type errors, logic bugs, crash analysis, dependency conflicts,...

2 次安装

Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technic...

Review code for bugs, security, architecture, smells, patterns, performance, tests, and refactor plans

2 次安装

在 `.learnings/` 目录维护结构化的 Markdown 记录,沉淀编码中的缺陷、反模式与改进经验。

17 次安装

Open a browser tab so a human can highlight-and-comment on a Markdown file. Submits a structured JSON of comments the agent can read and respond to. Use when...