comments-rewrite
Skill0 starsChanged 2 months agoMITView on GitHub
Deletes the comments from code and writes new ones. Use when the user asks to rewrite, replace, refresh, or clean up and re-document comments.
In this repository4 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- comments-addSkill
- comments-removeSkill
- wtfSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
34 rules. About 0 are common, 32 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈32
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
- Distinctive: line 17
If the input is a path to a file or a directory that exists, use the file or the directory.
- Distinctive: line 18
If the input looks like a path, and the path does not exist, stop.
- Distinctive: line 19
If the input is code, or the message has a code block, find that code in the project:
- Distinctive: line 20
Use Grep with a line from the code that is unusual, for example a name or a string literal.
- Distinctive: line 21
If you find one location, use that file.
- Distinctive: line 22
If you find more than one location, show the list of the files with the line numbers, and ask which one to use.
- Distinctive: line 23
If you find no location, tell the user, and show the code with the new comments in the chat.
- Distinctive: line 24
If there is no input, and the message has no code block, stop immediately.
- Distinctive: line 30
Do this step only for a directory target.
- Distinctive: line 33
Do not use a hidden file or a hidden folder.
- Very specific: line 34
Do not use a build folder or a dependency folder, for example build, dist, .build, DerivedData, node_modules, Pods, vendor, .venv.
- Distinctive: line 35
Do not use a file that a tool made.
- Distinctive: line 36
Do not use a file that is not source code, for example an image or a data file.
- Distinctive: line 37
If the list has more than 10 files, show the list, and ask before you make a change.
- Distinctive: line 41
Delete the comments, then write new comments.
- Distinctive: line 45
Delete line comments and block comments.
- Distinctive: line 46
Keep every comment that the compiler, a tool, or the operating system reads.
- Distinctive: line 53
If you are not sure that a comment is only for a person, keep it.
- Very specific: line 54
Keep a documentation comment that a tool reads, for example a Swift /// comment or a Python docstring.
- Distinctive: line 55
Do not change comment text that is in a string literal or a regular expression.
- Distinctive: line 56
If the comment was alone on its line, delete the full line.
- Distinctive: line 57
Do not write a comment that you kept a second time.
- Distinctive: line 61
If the code uses an element from a different file, and you cannot understand the code without it, find that element first.
- Distinctive: line 64
Use Grep and Glob to find where each one is defined.
- Distinctive: line 65
Read the definition only. Do not change the other file.
- Distinctive: line 66
If you cannot find the definition, do not guess what it does.
- Distinctive: line 70
Write all comments in ASD-STE100 Simplified Technical English.
- Distinctive: line 72
Do not add a comment to code that is already clear.
- Distinctive: line 73
Put the comment on the line above the code.
- Distinctive: line 74
Use one-line comments. Use more lines only when this makes the text easier to read.
- Distinctive: line 75
Do not divide one sentence into more than one line.
- Distinctive: line 81
Do not change, refactor, or reformat the executable code.
- Distinctive: line 83
Do not change a file that is not in the target.
- Distinctive: line 92
After the work, give this data:
≈ “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.
Files
Input: $ARGUMENTS
Precondition
Find the target
Find the type of the input:
- If the input is a path to a file or a directory that exists, use the file or the directory.
- 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.
- 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.
- If there is no input, and the message has no code block, stop immediately. Do not guess. Write only this message:
Usage: /comments-rewrite <file-or-directory | code block>
Find the files
Do this step only for a directory target.
- Make the list of the source files in the directory.
- Do not use a hidden file or a hidden folder.
- Do not use a build folder or a dependency folder, for example
build,dist,.build,DerivedData,node_modules,Pods,vendor,.venv. - Do not use a file that a tool made. A generated file usually has a header, for example "Do not edit".
- Do not use a file that is not source code, for example an image or a data file.
- If the list has more than 10 files, show the list, and ask before you make a change.
Task
Delete the comments, then write new comments. Do the three steps in this order.
Step 1 — Delete the comments
- Delete line comments and block comments.
- 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, andFIXMEcomments.- 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. You cannot write this comment again from the code.
- The first line of the file, if it starts with
- If you are not sure that a comment is only for a person, keep it. Put it in the report.
- 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. - Do not change comment text that is in a string literal or a regular expression.
- If the comment was alone on its line, delete the full line. Do not leave an empty line in its place.
- Do not write a comment that you kept a second time.
Step 2 — 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.
- Make a list of the types, the functions, the properties, and the constants that the code uses but does not define.
- Use Grep and Glob to find where each one is defined. Read that file.
- Read the definition only. Do not change the other file.
- 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.
Step 3 — Write the comments
- Write all comments in ASD-STE100 Simplified Technical English.
- Give the reason for the code. Do not say again what the code shows.
- Do not add a comment to code that is already clear.
- Put the comment on the line above the code. Do not put a comment at the end of a line of code.
- Use one-line comments. Use more lines only when this makes the text easier to read.
- Do not divide one sentence into more than one line.
- For the Swift language, use
//. Do not use/* */. - For a different language, use the comment style that the file uses already.
Limits
- Do not change, refactor, or reformat the executable code.
- Change only the comments, and the lines that stay empty because you deleted a comment.
- Do not change a file that is not in the target.
Output
For a file or a directory, change the comments in the files. For a block of code that you found in the project, change the comments in that file. Change only the lines of that block.
Report
After the work, give this data:
- A list of the files or the sections, with the number of the deleted comments and the number of the new comments.
- A list of the comments that you deleted and did not write again.
- A list of the comments that you kept, with the reason.
- A list of the logic that stays unclear.
- 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-reviewdoes a full examination. - A list of the external elements that you read, with their files, and a list of the elements that you did not find.
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
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.

