agentleFS
mykytasomykytaso/claude-skills/skills/comments-remove/SKILL.md

comments-remove

Skill0 starsChanged 2 months agoMITView on GitHub

Removes comments from source files or from a block of code. Use when the user asks to delete, strip, or clean comments in code.

The file

Show its rules and text

We split this skill into the rules it gives an agent

25 rules. About 0 are common, 22 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈22

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If the input is a path to a file or a directory that exists, use the file or the directory.

    line 17
  2. Distinctive:

    If the input looks like a path, and the path does not exist, stop.

    line 18
  3. Distinctive:

    If the input is code, or the message has a code block, find that code in the project:

    line 19
  4. Distinctive:

    Use Grep with a line from the code that is unusual, for example a name or a string literal.

    line 20
  5. Distinctive:

    If you find one location, use that file.

    line 21
  6. Distinctive:

    If you find more than one location, show the list of the files with the line numbers, and ask which one to use.

    line 22
  7. Distinctive:

    If you find no location, tell the user, and show the code with the comments removed in the chat.

    line 23
  8. Distinctive:

    If there is no input, and the message has no code block, stop immediately.

    line 24
  9. Distinctive:

    Do this step only for a directory target.

    line 30
  10. Distinctive:

    Do not use a hidden file or a hidden folder.

    line 33
  11. Very specific:

    Do not use a build folder or a dependency folder, for example build, dist, .build, DerivedData, node_modules, Pods, vendor, .venv.

    line 34
  12. Distinctive:

    Do not use a file that a tool made.

    line 35
  13. Distinctive:

    Do not use a file that is not source code, for example an image or a data file.

    line 36
  14. Distinctive:

    If the list has more than 10 files, show the list, and ask before you make a change.

    line 37
  15. Distinctive:

    Delete the comments from the target.

    line 41
  16. Distinctive:

    Delete line comments and block comments.

    line 45
  17. Distinctive:

    Keep every comment that the compiler, a tool, or the operating system reads.

    line 46
  18. Distinctive:

    If you are not sure that a comment is only for a person, keep it.

    line 53
  19. Very specific:

    Keep a documentation comment that a tool reads, for example a Swift /// comment or a Python docstring.

    line 54
  20. Distinctive:

    Do not change comment text that is in a string literal or a regular expression.

    line 55
  21. Distinctive:

    If the comment was alone on its line, delete the full line.

    line 56
  22. Distinctive:

    Do not change, refactor, or reformat the executable code.

    line 60
  23. Very specific:

    Do not write a new comment.

    line 62
  24. Distinctive:

    Do not change a file that is not in the target.

    line 63
  25. Distinctive:

    After the work, give this data:

    line 72

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Input: $ARGUMENTS

Precondition

Find the target

Find the type of the input:

  1. If the input is a path to a file or a directory that exists, use the file or the directory.
  2. If the input looks like a path, and the path does not exist, stop. Show the path. Do not guess. Do not search for the path text.
  3. If the input is code, or the message has a code block, find that code in the project:
    • Use Grep with a line from the code that is unusual, for example a name or a string literal.
    • If you find one location, use that file.
    • If you find more than one location, show the list of the files with the line numbers, and ask which one to use. Do not make a change.
    • If you find no location, tell the user, and show the code with the comments removed in the chat. Do not write a file.
  4. If there is no input, and the message has no code block, stop immediately. Do not guess. Write only this message:

Usage: /comments-remove <file-or-directory | code block>

Find the files

Do this step only for a directory target.

  1. Make the list of the source files in the directory.
  2. Do not use a hidden file or a hidden folder.
  3. Do not use a build folder or a dependency folder, for example build, dist, .build, DerivedData, node_modules, Pods, vendor, .venv.
  4. Do not use a file that a tool made. A generated file usually has a header, for example "Do not edit".
  5. Do not use a file that is not source code, for example an image or a data file.
  6. If the list has more than 10 files, show the list, and ask before you make a change.

Task

Delete the comments from the target.

Rules:

  1. Delete line comments and block comments.
  2. Keep every comment that the compiler, a tool, or the operating system reads. Delete only a comment that is for a person. Keep these comments:
    • The first line of the file, if it starts with #!.
    • License headers and copyright headers.
    • A comment that gives a version or a build rule, for example // swift-tools-version:6.0, //go:build linux, # -*- coding: utf-8 -*-, # frozen_string_literal: true.
    • A directive for a tool or the compiler, for example // swiftlint:disable, // swiftformat:disable, # type: ignore, # noqa, // @ts-ignore, // eslint-disable, // prettier-ignore, #pragma.
    • TODO, MARK, and FIXME comments.
    • A comment that gives data that the code does not show, for example a reason, a defect number, a link, or a description of a workaround.
  3. If you are not sure that a comment is only for a person, keep it. Put it in the report.
  4. Keep a documentation comment that a tool reads, for example a Swift /// comment or a Python docstring. A docstring is a string, not a comment. Do not delete it.
  5. Do not change comment text that is in a string literal or a regular expression.
  6. If the comment was alone on its line, delete the full line. Do not leave an empty line in its place.

Limits

  1. Do not change, refactor, or reformat the executable code.
  2. Change only the comments, and the lines that stay empty because you deleted a comment.
  3. Do not write a new comment. To write new comments, use /comments-add or /comments-rewrite.
  4. Do not change a file that is not in the target.

Output

For a file or a directory, delete the comments in the files. For a block of code that you found in the project, delete the comments in that file. Change only the lines of that block.

Report

After the work, give this data:

  1. A list of the files or the sections, with the number of the deleted comments.
  2. A list of the comments that you kept, with the reason.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.