/lean:trim-comments
Judge every comment and docstring in the target files against
../../references/comment-policy.md, then delete or rewrite the ones
that fail. Edits in place and prints a diff. Never commits, never
pushes, never requires a clean tree.
Confirm before the first edit
This skill deletes code the user did not ask you to touch, and it can
be routed to from a passing remark about comments. Present the
classification and get an explicit yes through AskUserQuestion
before any Edit.
No exceptions: not for a single comment, not for a file the user just
named, not under --all. --diff-only is the way to skip the edit,
not the confirmation.
$ARGUMENTS
paths/globs — files to audit, resolved through git ls-files -- <glob> when tracked, else as literal paths.
--staged — audit what is staged rather than the branch diff.
--all — audit every tracked file. Expect a large diff; say so
before confirming.
--diff-only — classify and show what would change, edit nothing.
With no paths, the target set is the files this branch changed.
Steps
Resolve targets. With paths, expand them. With --all, take
git ls-files. With --staged, take the staged names:
$ git diff --name-only --cached --diff-filter=d
Otherwise find the trunk ref (git rev-parse --abbrev-ref origin/HEAD, falling back to the repo's default branch) and take
its merge base:
$ git merge-base HEAD origin/HEAD
Then take the names changed since it:
$ git diff --name-only --diff-filter=d <merge-base>
Keep source files; drop lockfiles, generated output, and vendored
trees. Reject an empty target set with a clear message rather than
widening the scope on your own.
Load the policy and voice. Read
../../references/comment-policy.md, then ./AGENTS.md and
./CLAUDE.md. Where the host project sets its own comment rules,
those govern.
Classify. Every comment and docstring in range gets one verdict
— keep, rewrite, or delete — and a failing gate by name for
anything not kept. A verdict you cannot attach to a gate is a keep.
Read the surrounding code before judging. A comment that looks like
narration but pins an invariant is a keep, and the loss gate is
what protects it.
Preview and confirm. Show each rewrite as old and new text, and
each deletion with the code it sat above, grouped by file. Confirm
through AskUserQuestion. Skip only for --diff-only.
Apply. Use Edit. Rewrites are concrete and shorter than what
they replace. Do not touch the code itself; a comment that is wrong
because the code is wrong is a finding to report, not to fix here.
Diff. Print git diff -- <targets>.
Report and hand off. Give the counts kept, rewritten, and
deleted, and name anything skipped and why. Then offer next steps
through AskUserQuestion: commit with /commit, tighten the prose
too with /lean:tighten, or discard — review the printed diff
first, since git checkout -- <file> resets the whole file to HEAD
and drops any other uncommitted work in it.
What this does not do
- Commit or push — that is
/commit.
- Edit code, only its comments.
- Rewrite prose files — that is
/lean:tighten.
- Rewrite history — that is
/pr:deslop.
- Add missing comments. Absence is not a finding here.
1---2name: trim-comments3description: Use when existing source comments or docstrings are bloated, dense, repetitive, AI slop, or should be trimmed, debloated, and kept light.4---567# `/lean:trim-comments`89Judge every comment and docstring in the target files against10`../../references/comment-policy.md`, then delete or rewrite the ones11that fail. Edits in place and prints a diff. Never commits, never12pushes, never requires a clean tree.1314## Confirm before the first edit1516This skill deletes code the user did not ask you to touch, and it can17be routed to from a passing remark about comments. Present the18classification and get an explicit yes through `AskUserQuestion`19before any `Edit`.2021No exceptions: not for a single comment, not for a file the user just22named, not under `--all`. `--diff-only` is the way to skip the edit,23not the confirmation.2425## `$ARGUMENTS`2627- `paths/globs` — files to audit, resolved through `git ls-files --28 <glob>` when tracked, else as literal paths.29- `--staged` — audit what is staged rather than the branch diff.30- `--all` — audit every tracked file. Expect a large diff; say so31 before confirming.32- `--diff-only` — classify and show what would change, edit nothing.3334With no paths, the target set is the files this branch changed.3536## Steps37381. **Resolve targets.** With paths, expand them. With `--all`, take39 `git ls-files`. With `--staged`, take the staged names:4041 ```console42 $ git diff --name-only --cached --diff-filter=d43 ```4445 Otherwise find the trunk ref (`git rev-parse --abbrev-ref46 origin/HEAD`, falling back to the repo's default branch) and take47 its merge base:4849 ```console50 $ git merge-base HEAD origin/HEAD51 ```5253 Then take the names changed since it:5455 ```console56 $ git diff --name-only --diff-filter=d <merge-base>57 ```5859 Keep source files; drop lockfiles, generated output, and vendored60 trees. Reject an empty target set with a clear message rather than61 widening the scope on your own.62632. **Load the policy and voice.** Read64 `../../references/comment-policy.md`, then `./AGENTS.md` and65 `./CLAUDE.md`. Where the host project sets its own comment rules,66 those govern.67683. **Classify.** Every comment and docstring in range gets one verdict69 — keep, rewrite, or delete — and a failing gate by name for70 anything not kept. A verdict you cannot attach to a gate is a keep.7172 Read the surrounding code before judging. A comment that looks like73 narration but pins an invariant is a keep, and the loss gate is74 what protects it.75764. **Preview and confirm.** Show each rewrite as old and new text, and77 each deletion with the code it sat above, grouped by file. Confirm78 through `AskUserQuestion`. Skip only for `--diff-only`.79805. **Apply.** Use `Edit`. Rewrites are concrete and shorter than what81 they replace. Do not touch the code itself; a comment that is wrong82 because the code is wrong is a finding to report, not to fix here.83846. **Diff.** Print `git diff -- <targets>`.85867. **Report and hand off.** Give the counts kept, rewritten, and87 deleted, and name anything skipped and why. Then offer next steps88 through `AskUserQuestion`: commit with `/commit`, tighten the prose89 too with `/lean:tighten`, or discard — review the printed diff90 first, since `git checkout -- <file>` resets the whole file to HEAD91 and drops any other uncommitted work in it.9293## What this does not do9495- Commit or push — that is `/commit`.96- Edit code, only its comments.97- Rewrite prose files — that is `/lean:tighten`.98- Rewrite history — that is `/pr:deslop`.99- Add missing comments. Absence is not a finding here.