Code Comment Patterns

Guide code comment writing with rationale-focused standards and TODO conventions.

Updated Feb 25, 2026
One-click install
npx skills add https://github.com/HermeticOrmus/LibreCopy-Claude-Code --skill code-comment-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Code Comment Patterns
Source: https://github.com/HermeticOrmus/LibreCopy-Claude-Code/tree/main/plugins/code-comments/skills/code-comment-patterns
Command: npx skills add https://github.com/HermeticOrmus/LibreCopy-Claude-Code --skill code-comment-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the common issue of unhelpful or misleading code comments, ensuring that comments provide genuine value by explaining the reasoning behind code decisions rather than simply restating what the code does.

Core Features & Use Cases

  • Guidance on Effective Commenting: Provides clear rules and examples for writing comments that explain the "why" behind code.
  • Specific Scenarios: Details when comments are required, such as for non-obvious algorithms, workarounds, magic numbers, and business rule implementations.
  • TODO Standards: Establishes best practices for TODO comments, including owner and expiry context.
  • Anti-Pattern Identification: Highlights common pitfalls like echoing types, commented-out code, lying comments, and apologetic comments.
  • Use Case: A developer is unsure how to document a complex piece of logic. They consult this Skill to understand the best practices for explaining the non-obvious choices made in the implementation, ensuring future maintainability.

Quick Start

Use the code comment patterns skill to understand how to write effective comments for complex code.

Frequently Asked Questions about Code Comment Patterns

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

FAQPage Schema
What are the best practices for writing effective code comments?

Effective code comments explain the "why" behind decisions rather than restating the "what." Best practices include documenting non-obvious algorithms, workarounds, and business rule implementations to ensure future maintainability and team collaboration.

When should I add comments to my code?

You should add comments to your code when implementing required scenarios like non-obvious algorithms, workarounds, magic numbers, and business rule implementations. Comments are necessary when the rationale behind the implementation choices is not immediately obvious to maintainers.

What are common code comment anti-patterns to avoid?

Common code comment anti-patterns to avoid include echoing types, leaving commented-out code blocks, writing lying comments that misrepresent the logic, and using apologetic comments. These pitfalls reduce clarity and provide no actionable context for future maintainers.

How do I format TODO comments for software maintainability?

To format TODO comments for maintainability, establish standards that include the owner and an expiry context. Documenting the specific owner and timeframe ensures the technical debt is tracked and resolved during future software development cycles.

Does writing comments that explain why instead of what improve code maintainability?

Writing comments that explain why instead of what significantly improves code maintainability. By focusing on the rationale behind decisions rather than literal implementation, you provide actionable information and context that helps developers understand complex logic.