/cleaning-comments
Cleaning redundant and obvious comments following clean code principles while preserving meaningful documentation. Supports git scope filtering (staged, unstaged, branch, commit-range). Use when code has excessive comments, during code review, or post-refactor cleanup. Skip when
$ npx -y skills add LerianStudio/ring --skill cleaning-comments --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/cleaning-comments
Context preview
The summary Claude sees to decide when to auto-load this skill.
Cleaning redundant and obvious comments following clean code principles while preserving meaningful documentation. Supports git scope filtering (staged, unstaged, branch, commit-range). Use when code has excessive comments, during code review, or post-refactor cleanup. Skip when
SKILL.md
cleaning-comments.SKILL.mdname: ring:cleaning-comments
description: "Cleaning redundant and obvious comments following clean code principles while preserving meaningful documentation. Supports git scope filtering (staged, unstaged, branch, commit-range). Use when code has excessive comments, during code review, or post-refactor cleanup. Skip when reviewing documentation files or comments are already minimal."
user-invocable: true
argument-hint: "[file-pattern=<pattern>] [git-scope=<scope>] [dry-run]"
Cleaning Comments
When to use
- Code has excessive, redundant, or obvious comments
- During code review or post-refactor cleanup
- Before committing to clean up comment noise in changed files
- Codebase has accumulated commented-out code blocks
Skip when
- Reviewing documentation files (README, docs/, etc.)
- Comments are already minimal and meaningful
- Working with generated code or third-party files
Sequence
**Runs after:** ring:exploring-codebases (optional, for architecture context)
Related
**Complementary:** ring:exploring-codebases — run first for architecture-aware cleaning that preserves critical documentation
---
Analyze comments in code and remove those that violate clean code principles while preserving valuable ones. You can focus on git changes for faster, more relevant cleaning, or analyze the entire codebase.
**Recommended workflow:** Run `ring:exploring-codebases` first to understand the architecture, then clean comments with that context. This preserves architectural documentation, understands which comments are critical for complex modules, and respects project-specific documentation standards.
Clean Code Comment Rules
1. **Always try to explain yourself in code** — Remove comments that can be replaced with better function/variable names 2. **Don't be redundant** — Remove comments that just repeat what the code obviously does 3. **Don't add obvious noise** — Remove comments like `i++; // increment i` 4. **Don't use closing brace comments** — Remove `} // end of if block` style comments 5. **Don't comment out code** — Remove commented-out code blocks 6. **Keep explanation of intent** — Preserve comments explaining WHY, not WHAT 7. **Keep warnings of consequences** — Preserve comments about important side effects 8. **Keep legal and informative comments** — Preserve copyright, licenses, TODOs
Examples
**Before:**
// Check if user is eligible for discount
if (user.age >= 65 && user.membershipYears >= 5) {
// Apply senior discount
total = total * 0.9 // multiply by 0.9 to get 10% discount
} // end if block**After:**
if (user.isEligibleForSeniorDiscount()) {
total = total * SENIOR_DISCOUNT_RATE
}Process
Phase 0: Git Scope Filtering (when git options used)
If `git-scope` is specified, determine files in scope:
| Scope | Git command | |-------|------------| | `staged` | `git diff --cached --name-only --diff-filter=ACMR` | | `unstaged` | `git diff --name-only --diff-filter=ACMR` | | `all-changes` | `git diff HEAD --name-only --diff-filter=ACMR` | | `last-commit` | `git diff HEAD~1..HEAD --name-only --diff-filter=ACMR` | | `branch` | `git diff $(git merge-base HEAD main)..HEAD --name-only --diff-filter=ACMR` | | `commit-range=<range>` | `git diff <range> --name-only --diff-filter=ACMR` |
If `file-pattern` is also specified, filter the git results to match. Show git statistics: scope name, file count, and first 10 filenames.
Phase 1: Architecture-Aware Analysis
1. **Understand Codebase Context**
- Identify key architectural patterns and conventions
- Map critical system components and their responsibilities
- Understand established documentation patterns
- Identify complex modules requiring careful comment preservation
Phase 2: Targeted Comment Analysis
2. **Scan Files**
- Find all files matching the pattern (or entire codebase if no pattern specified)
- Prioritize files with most comment issues (using codebase analysis)
- Identify different types of comments in context of project patterns
- Categorize by clean code rules while respecting architecture
Phase 3: Context-Aware Cleaning
3. **Clean Bad Comments**
- Remove redundant comments that repeat code
- Remove obvious noise comments
- Remove closing brace comments
- Remove commented-out code blocks
- **Preserve architectural explanations** identified in Phase 1
4. **Preserve Good Comments**
- Keep intent explanations and clarifications
- Keep consequence warnings
- Keep legal/copyright notices
- Keep TODO comments
- **Keep system design documentation** critical to understanding
- **Keep pattern explanations** that help maintain conventions
5. **Suggest Code Improvements**
- Identify where comments can be replaced with better naming
- Suggest function extractions for complex logic
- **Recommend architectural improvements** based on codebase analysis
Read more
name: ring:cleaning-comments description: "Cleaning redundant and obvious comments following clean code principles while preserving meaningful documentation. Supports git scope filtering (staged, unstaged, branch, commit-range). Use when code has excessive comments, during code review, or post-refactor cleanup. Skip when reviewing documentation files or comments are already minimal." user-invocable: true argument-hint: "[file-pattern=<pattern>] [git-scope=<scope>] [dry-run]"
Cleaning Comments
When to use
- Code has excessive, redundant, or obvious comments
- During code review or post-refactor cleanup
- Before committing to clean up comment noise in changed files
- Codebase has accumulated commented-out code blocks
Skip when
- Reviewing documentation files (README, docs/, etc.)
- Comments are already minimal and meaningful
- Working with generated code or third-party files
Sequence
**Runs after:** ring:exploring-codebases (optional, for architecture context)
Related
**Complementary:** ring:exploring-codebases — run first for architecture-aware cleaning that preserves critical documentation
---
Analyze comments in code and remove those that violate clean code principles while preserving valuable ones. You can focus on git changes for faster, more relevant cleaning, or analyze the entire codebase.
**Recommended workflow:** Run `ring:exploring-codebases` first to understand the architecture, then clean comments with that context. This preserves architectural documentation, understands which comments are critical for complex modules, and respects project-specific documentation standards.
Clean Code Comment Rules
1. **Always try to explain yourself in code** — Remove comments that can be replaced with better function/variable names 2. **Don't be redundant** — Remove comments that just repeat what the code obviously does 3. **Don't add obvious noise** — Remove comments like `i++; // increment i` 4. **Don't use closing brace comments** — Remove `} // end of if block` style comments 5. **Don't comment out code** — Remove commented-out code blocks 6. **Keep explanation of intent** — Preserve comments explaining WHY, not WHAT 7. **Keep warnings of consequences** — Preserve comments about important side effects 8. **Keep legal and informative comments** — Preserve copyright, licenses, TODOs
Examples
**Before:**
// Check if user is eligible for discount
if (user.age >= 65 && user.membershipYears >= 5) {
// Apply senior discount
total = total * 0.9 // multiply by 0.9 to get 10% discount
} // end if block**After:**
if (user.isEligibleForSeniorDiscount()) {
total = total * SENIOR_DISCOUNT_RATE
}Process
Phase 0: Git Scope Filtering (when git options used)
If `git-scope` is specified, determine files in scope:
| Scope | Git command | |-------|------------| | `staged` | `git diff --cached --name-only --diff-filter=ACMR` | | `unstaged` | `git diff --name-only --diff-filter=ACMR` | | `all-changes` | `git diff HEAD --name-only --diff-filter=ACMR` | | `last-commit` | `git diff HEAD~1..HEAD --name-only --diff-filter=ACMR` | | `branch` | `git diff $(git merge-base HEAD main)..HEAD --name-only --diff-filter=ACMR` | | `commit-range=<range>` | `git diff <range> --name-only --diff-filter=ACMR` |
If `file-pattern` is also specified, filter the git results to match. Show git statistics: scope name, file count, and first 10 filenames.
Phase 1: Architecture-Aware Analysis
1. **Understand Codebase Context**
- Identify key architectural patterns and conventions
- Map critical system components and their responsibilities
- Understand established documentation patterns
- Identify complex modules requiring careful comment preservation
Phase 2: Targeted Comment Analysis
2. **Scan Files**
- Find all files matching the pattern (or entire codebase if no pattern specified)
- Prioritize files with most comment issues (using codebase analysis)
- Identify different types of comments in context of project patterns
- Categorize by clean code rules while respecting architecture
Phase 3: Context-Aware Cleaning
3. **Clean Bad Comments**
- Remove redundant comments that repeat code
- Remove obvious noise comments
- Remove closing brace comments
- Remove commented-out code blocks
- **Preserve architectural explanations** identified in Phase 1
4. **Preserve Good Comments**
- Keep intent explanations and clarifications
- Keep consequence warnings
- Keep legal/copyright notices
- Keep TODO comments
- **Keep system design documentation** critical to understanding
- **Keep pattern explanations** that help maintain conventions
5. **Suggest Code Improvements**
- Identify where comments can be replaced with better naming
- Suggest function extractions for complex logic
- **Recommend architectural improvements** based on codebase analysis
Proven engineering practices, enforced through skills. Ring is a comprehensive skills library and workflow system for AI agents that transforms how AI assistants approach software development.
Repo: LerianStudio/ring
Other skills on ring.
- /analyzing-options
Analyzing different approaches for a task or problem with structured comparisons, effort estimates, and recommendations. Use when facing strategic decisions, architecture choices, or multiple viable approaches. Skip when there's an obvious single approach or the decision is
Open skill - /auditing-production-readiness
Auditing a service's production readiness against Ring engineering standards across base dimensions plus a conditional multi-tenant dimension, then emitting a scored report and an HTML dashboard. Use before production deploy, periodic review, onboarding, or a major release. Skip
Open skill - /committing-changes
Commit changes with scope allowlist enforcement, atomic grouping, GPG-signed conventional commits, and trailer management. Detects the repo's PR-validation scope policy before proposing any message. Use when the user asks to commit or has changes ready to record. Skip when the
Open skill - /creating-handoffs
Creating a handoff document that captures session state (completed work, decisions, open items, next steps) and delivering it via Plan Mode so the user gets the native 'clear context and continue implementing' resume option. Use when ending a session, when context grows large,
Open skill - /creating-worktrees
Creating an isolated git worktree for parallel branch work: selects the directory by priority order, verifies/adds .gitignore safety, auto-installs the detected toolchain's dependencies, runs a baseline test, and reports readiness. Use before a feature that needs isolation from
Open skill - /dispatching-workflows
Executing a phased plan in rolling waves where each phase runs as one multi-agent workflow harness: the supervisor elaborates the phase into tasks against the real landed code, launches a workflow that implements with TDD and runs mandatory in-harness review plus an adversarial
Open skill

