Global Commenting

Generate evergreen comments explaining complex code logic across programming languages.

Updated Aug 11, 2023
One-click install
npx skills add https://github.com/EIS-ITS/vss-cli --skill global-commenting-eis-its
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Global Commenting
Source: https://github.com/EIS-ITS/vss-cli/tree/main/.claude/skills/global-commenting
Command: npx skills add https://github.com/EIS-ITS/vss-cli --skill global-commenting-eis-its

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you avoid cluttered, outdated, or excessive code comments that hinder understanding. It guides you to write self-documenting code with minimal, high-value comments that explain why complex logic exists, rather than just what the code does.

Core Features & Use Cases

  • Evergreen Comments: Focus on explaining complex algorithms or non-obvious decisions, not temporary fixes.
  • Self-Documenting Code: Prioritize clear code structure and meaningful naming over excessive commenting.
  • Contextual Explanations: Clarify business logic and design choices for future maintainers.
  • Use Case: When reviewing a complex data processing function, use this skill to add a concise comment explaining the underlying mathematical principle or business rule, making it immediately understandable without describing every line of code.

Quick Start

Review the attached Python file and add comments only where the logic is complex or non-obvious, explaining the 'why' behind the implementation.

Frequently Asked Questions about Global Commenting

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write code comments that explain why logic exists rather than what code does?

Evergreen comments explain the rationale and business logic behind complex decisions, not line-by-line code behavior. Focus on the 'why'—algorithmic principles, design choices, or non-obvious patterns—and let clear naming and structure convey the 'what'. This approach prevents comments from becoming outdated as code evolves.

When should I add comments to code versus relying on self-documenting structure?

Add comments only where logic is genuinely complex or non-obvious—clarifying algorithms, business rules, or counterintuitive decisions. Prioritize clear variable names, function structure, and meaningful code organization first. Comments should fill gaps that naming and design cannot; excessive commenting signals unclear code needing refactoring.

What's the best way to document complex algorithms and business logic in code?

Document algorithms by explaining the underlying mathematical principle or business rule upfront, then reference it sparingly in the code. Use docstrings for API contracts and contextual explanations for maintainers. Keep comments concise and language-agnostic so they remain relevant across codebases and refactoring cycles.

How do I avoid writing comments that become outdated or cluttered?

Comments become stale when they describe temporary fixes, recent changes, or what code obviously does. Write evergreen comments tied to rationale and context, not implementation details. Review comments during refactoring to remove redundant ones and update those explaining enduring design decisions or non-obvious logic.

Can I apply commenting best practices across different programming languages?

Yes, the principles of evergreen, self-documenting comments apply universally across any language or codebase. Focus on explaining 'why' over 'what', use meaningful naming, and keep comments minimal and relevant to future maintainers regardless of syntax or framework.

Do I need extensive comments if my code is already well-named and structured?

No. Well-named functions, clear logic flow, and meaningful variable names eliminate the need for descriptive comments. Add comments only to clarify complex algorithms, non-obvious decisions, or business context that naming alone cannot convey, keeping your codebase lean and maintainable.