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

comments-add

Skill0 starsChanged 2 months agoMITView on GitHub

Adds explanatory comments to source files or to a block of code. Use when the user asks to comment, document, or annotate code.

The file

Show its rules and text

We split this skill into the rules it gives an agent

29 rules. About 0 are common, 27 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈27

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    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 new comments 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:

    Add clear, short, explanatory comments to the code.

    line 41
  16. Distinctive:

    If the code uses an element from a different file, and you cannot understand the code without it, find that element first.

    line 45
  17. Distinctive:

    Use Grep and Glob to find where each one is defined.

    line 48
  18. Distinctive:

    Read the definition only. Do not change the other file.

    line 49
  19. Distinctive:

    If you cannot find the definition, do not guess what it does.

    line 50
  20. Distinctive:

    Write all comments in ASD-STE100 Simplified Technical English.

    line 54
  21. Distinctive:

    Do not add a comment to code that is already clear.

    line 56
  22. Distinctive:

    Put the comment on the line above the code.

    line 57
  23. Distinctive:

    Use one-line comments. Use more lines only when this makes the text easier to read.

    line 58
  24. Distinctive:

    Do not divide one sentence into more than one line.

    line 59
  25. Distinctive:

    Keep the comments that are in the file.

    line 62
  26. Distinctive:

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

    line 66
  27. Very specific:

    Do not delete a comment. To delete a comment, use /comments-remove.

    line 67
  28. Distinctive:

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

    line 68
  29. Distinctive:

    After the work, give this data:

    line 77

≈ “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 new comments 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-add <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

Add clear, short, explanatory comments to the code.

Read the code that you cannot see

If the code uses an element from a different file, and you cannot understand the code without it, find that element first.

  1. Make a list of the types, the functions, the properties, and the constants that the code uses but does not define.
  2. Use Grep and Glob to find where each one is defined. Read that file.
  3. Read the definition only. Do not change the other file.
  4. If you cannot find the definition, do not guess what it does. Write a comment about the code that you can see, and put the element in the report.

Write the comments

  1. Write all comments in ASD-STE100 Simplified Technical English.
  2. Give the reason for the code. Do not say again what the code shows.
  3. Do not add a comment to code that is already clear.
  4. Put the comment on the line above the code. Do not put a comment at the end of a line of code.
  5. Use one-line comments. Use more lines only when this makes the text easier to read.
  6. Do not divide one sentence into more than one line.
  7. For the Swift language, use //. Do not use /* */.
  8. For a different language, use the comment style that the file uses already.
  9. Keep the comments that are in the file. If a comment does not agree with the code, do not change it. Put it in the report.

Limits

  1. Do not change, refactor, or reformat the executable code. Add only comments.
  2. Do not delete a comment. To delete a comment, use /comments-remove. To write a comment again, use /comments-rewrite.
  3. Do not change a file that is not in the target.

Output

For a file or a directory, add the comments in the files. For a block of code that you found in the project, add 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 that you documented, with the number of the new comments.
  2. A list of the comments that do not agree with the code.
  3. A list of the logic that stays unclear.
  4. A short list of the code that can be unsafe, for example a forced unwrap, an unfinished error operation, or a race condition. Tell the user that /security-review does a full examination.
  5. A list of the external elements that you read, with their files, and a list of the elements that you did not find.

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.