Code Comment Cleaner

Find and remove commented-out dead code across 8 languages (JS, TS, Python, Java, Go, Rust, HTML, CSS) while preserving TODOs, FIXMEs, license headers, disabled tests, and real documentation.

Install
cmdop skills install agensi-code-comment-cleaner

Code Comment Cleaner is a skill that targets commented-out dead code blocks across eight languages: JavaScript, TypeScript, Python, Java, Go, Rust, HTML, and CSS. It uses a two-pass detection approach. The first pass identifies code indicators inside comments — brackets, keywords, and assignments — to distinguish abandoned logic from genuine prose. The second pass applies preservation rules that explicitly protect TODOs, FIXMEs, developer notes, license headers, copyright notices, disabled tests, and multi-line architectural explanations. Nothing in those categories is touched.

Before any file is modified, the skill generates a preview report listing exactly which lines are targeted and the reason each is flagged. A developer can review this output and confirm before changes are applied. When changes do proceed, the skill writes a .bak backup of the original file first, giving a recovery path if anything looks wrong after the fact.

This is appropriate when a codebase has accumulated commented-out logic over time and manual review would be slow or inconsistent across a large file tree. It handles multi-line comment syntax correctly in all supported languages, which is a common failure point for simple find-and-replace approaches.

It is not a general code formatter, linter, or documentation generator. It does not remove live code, restructure files, or work on languages outside the eight listed. Agents with no tools exposed use this skill’s built-in logic directly rather than through discrete API calls.

Use cases

  • Remove accumulated commented-out code blocks from a legacy JavaScript or TypeScript project before a major refactor
  • Clean up Python files after a long feature branch where old logic was commented out instead of deleted
  • Audit a Go or Rust codebase to preview which commented lines are dead code before committing to deletion
  • Strip dead HTML and CSS comments from a front-end codebase while keeping license headers intact
  • Automate comment cleanup as part of a CI-adjacent code hygiene workflow across Java services
  • Safely clean a mixed-language monorepo spanning JS, TS, Python, and Java in one pass

When to use it

  • The codebase contains significant commented-out logic accumulated over multiple development cycles
  • Consistency matters and manual comment review across many files would be error-prone
  • Preserving TODOs, FIXMEs, and license headers automatically is a hard requirement
  • A preview-before-delete workflow and .bak backups are needed for safety
  • The target files are in one of the eight supported languages

When not to use it

  • The language in use is not JavaScript, TypeScript, Python, Java, Go, Rust, HTML, or CSS
  • The goal is reformatting, linting, or general code style enforcement rather than comment removal
  • Live code needs to be removed or restructured — this skill only targets comments
  • Documentation generation or comment enrichment is the objective
  • A fully automated no-preview deletion pipeline is required with no confirmation step