AgentSkillsCN

Global Commenting

编写自我文档化的代码,注释尽量精简但有用,解释大段逻辑而不使代码库杂乱。在编写代码注释、记录复杂逻辑、审查是否需要注释、编写函数文档、解释不明显的代码段、确保通过命名和结构使代码清晰、避免临时或与变化相关的注释、保持注释与时俱进且面向未来、决定是添加注释还是重构以提高清晰度时,可使用此技能。在编写或审查任何代码文件时,可应用此技能,以确保注释带来价值而不制造噪音,代码主要通过清晰的命名和结构自我解释。

SKILL.md
--- frontmatter
name: Global Commenting
description: Write self-documenting code with minimal, helpful comments that explain large sections of logic without cluttering the codebase. Use this skill when writing code comments, documenting complex logic, reviewing whether comments are needed, writing function documentation, explaining non-obvious code sections, ensuring code clarity through naming and structure, avoiding temporary or change-related comments, keeping comments evergreen and future-relevant, or deciding between adding comments versus refactoring for clarity. Apply this skill when writing or reviewing any code file to ensure comments add value without creating noise, and that code is primarily self-explanatory through clear naming and structure.

Global Commenting

When to use this skill

  • When writing or reviewing code comments in any file
  • When documenting complex logic or algorithms that need explanation
  • When deciding whether to add a comment or refactor for clarity
  • When explaining non-obvious code sections or business logic
  • When writing function or class documentation
  • When ensuring code is self-documenting through clear naming and structure
  • When removing outdated or unnecessary comments
  • When avoiding comments that speak to recent changes or temporary fixes
  • When keeping comments concise, minimal, and evergreen
  • When reviewing code to ensure comments are helpful and relevant
  • When balancing between commenting and writing self-explanatory code

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