AgentSkillsCN

Global Commenting

编写自我文档化的代码,通过清晰的结构和命名来解释自身,仅添加最少的、与时俱进的注释,用于复杂逻辑部分。在决定代码是否需要注释、移除关于更改/修复的过时临时注释,或编写简洁解释时使用此技能。适用于所有代码文件,在平衡代码清晰度与必要文档的同时,确保注释在未来很长一段时间内仍然相关,而不是描述临时状态。

SKILL.md
--- frontmatter
name: Global Commenting
description: Write self-documenting code that explains itself through clear structure and naming, adding only minimal, evergreen comments for complex logic sections. Use this skill when deciding whether code needs comments, removing outdated temporal comments about changes/fixes, or writing concise explanations. Applies to all code files when balancing code clarity with necessary documentation, ensuring comments remain relevant far into the future rather than describing temporary states.

Global Commenting

When to use this skill

  • When deciding whether code needs comments or can be made self-explanatory through better naming
  • When writing comments for complex algorithms or business logic that isn't immediately obvious
  • When removing temporal comments like "fixed bug yesterday" or "TODO: refactor later"
  • When reviewing existing comments to ensure they're still accurate and evergreen
  • When explaining WHY code makes a particular decision rather than WHAT it does
  • When documenting large sections of code logic with concise, helpful summaries
  • When avoiding redundant comments that just restate what the code obviously does
  • When refactoring code to eliminate the need for explanatory comments through clarity
  • When adding comments to configuration files explaining non-obvious settings
  • When documenting workarounds for third-party library quirks or platform limitations
  • When ensuring comments will remain relevant months or years into the future

Global Commenting

This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle global commenting.

Instructions

For details, refer to the information provided in this file: global commenting