Skip to content
Back to skills

Comment Layout And Formatting

ASecurity

Apply proper indentation and spacing rules to code comments to enhance readability and maintain code visual structure. Use when writing or formatting comments within code blocks, or when establishing code style guidelines.

  • 666 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 8, 2026
documentationgo

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill comment-layout-and-formatting --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Comment Layout And Formatting?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Comment Layout And Formatting
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-comment-layout-and-formatting/badge)](https://www.skillsdirectory.com/skills/majiayu000-comment-layout-and-formatting)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: comment-layout-and-formatting
description: Apply proper indentation and spacing rules to code comments to enhance readability and maintain code visual structure. Use when writing or formatting comments within code blocks, or when establishing code style guidelines.
---

# Comment Layout and Formatting

Apply these rules to ensure comments enhance rather than disrupt code readability.

## Comment Indentation

**When to apply:** When writing or formatting code comments (excluding end-of-line comments)

1. Align comments with the code they describe using the same indentation level
2. Ensure comments do not obscure the visual indentation structure of the code
3. Maintain visual hierarchy to help readers understand program logic structure

**Rationale:** Research (Shneiderman 1980) shows comments that interfere with visual scanning reduce their effectiveness. Good comment style should enhance, not disrupt, visual structure.

## Comment Spacing

**When to apply:** When separating code blocks or emphasizing comments

1. Place at least one blank line before each comment to separate it from code
2. Optional: Use blank lines both before and after comments (two total)
   - **Pros:** Better visual effect, easier to scan
   - **Cons:** Consumes more display space
3. Decision is primarily aesthetic unless display space is extremely limited

**Core principle:** Having a consistent convention is more important than the specific details of the convention.

## Result
- Code logical structure remains clearly visible
- Comments are visually separated from code
- Comments align with their corresponding code blocks

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.