Command Palette

Search for a command to run...

Назад к скиллам
скилл № 24621

code-docs-cleanup

Clause-by-clause procedure for shortening and cleaning up source-code comments without losing a guard, the comment that says why a non-obvious line must stay…

БесплатноБез исполняемых скриптов
ocx-shот ocx-sh★ 20 звёзд на GitHub

Установить code-docs-cleanup в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

code-docs-cleanup

Shorten the comments in a source file without losing a guard. A guard is any clause that names a constraint a plausible edit would break, with or without the consequence. It is how the next agent learns why a non-obvious line looks the way it does and whether it may change it.

The comment standards live in the installed code-docs rule, cited here by ID: GRD (guards), RTE (routing), LNK (pointers and IDs), SRF (rendered surfaces) and LEN (length and ratchet). The cleanup-safety rules, CLN, are this skill's own: Cleanup rules. Three facts shape every step (as of 2026-09):

  • In agent-written code most comment lines are guards and contracts, not essays. Deleting by category or by length deletes guards.
  • The shipped guard recogniser finds fewer than half of real guards (recall about 0.43). A block it does not flag is unclassified, never safe to cut.
  • The editing agent's belief that the meaning survived is not evidence. The structural check and a cold re-check are.

Contents: When to run · Setup · Scope · Procedure · Never touch · Cleanup rules · Report · MUST rows · What agents get wrong · References

When to run

Run it when:

  • A change already edits a file whose comments are over the length caps (LEN-01, LEN-02), carry bare process IDs (LNK-01), or hold an essay.
  • The owner names files for a sweep, or asks to bring a package down before its ratchet baseline is recorded (LEN-03).
  • A review flags an over-cap block, or a pointer left beside the essay it was meant to replace (RTE-09).

Do not run it when:

  • The text renders to users: --help, JSON Schema, MCP tool descriptions, argparse or commander help, or a published package's API docs. That is an interface change (SRF-01, SRF-02). It moves rationale into plain comments and may regenerate goldens, which this skill never does.
  • The file is a test, generated, vendored, a lock or manifest file, or a golden. Bare IDs in test files and test regions (LNK-01's bare-id-test key) go in a separate test-only change: list them in the report.
  • Another branch has the file in flight (see Scope).
  • The fix is code: a type that owns a guard (GRD-12), a lint to enable (GRD-09, GRD-10), a test to rename. Each is its own reviewable diff.
  • The repo's own rules protect the comment kind, for example a local rule that keeps section dividers or phase markers. The local rule wins until it is amended. Leave those comments and report the conflict.

Setup

  1. Find the rule's checks, in the project first, then in the global client directories: find . "$HOME/.claude" "$HOME/.config" -path '*/code-docs-reference/checks/cleanup_check.py' -not -path '*/node_modules/*' 2>/dev/null | head -n 1. CHECKS below is the directory of that hit; any installed copy works. Read the code-docs.md index in the rules directory beside the skills/ directory holding code-docs-reference/. No hit means the rule is installed neither in the project nor globally: install it with grim add ghcr.io/ocx-sh/lore/code-docs. Where the client tool cannot install it, copy rules/code-docs.md into the client's rules directory (such as .claude/rules/) and skills/code-docs-reference/ into its skills directory (such as .claude/skills/) from the rule's source with rsync -a --exclude __pycache__ or git archive, so no stale .pyc file rides along, commit that on its own before the cleanup, and run the find again.
  2. python3 "$CHECKS/cleanup_check.py" --self-test and python3 "$CHECKS/guard_recogniser.py" --self-test both exit 0.
  3. git status --porcelain lists nothing untracked that the cleanup did not create. cleanup_check.py reads every untracked file as an added path and fails it (CLN-05). An untracked file you did not create is the owner's: never delete or revert it. Run the cleanup from a clean worktree, or ask the owner to move the file.
  4. Pick the mode and set BASE=HEAD. The check fails any non-prose line that differs from the base, so the working tree holds only uncommitted cleanup: the touched files', or in a sweep one file's.
Mode When Before each file
Touched files (default) Cleaning files the current change already edits Commit the change's code first
Sweep The owner named files, or asked for a package sweep Commit the previous file's cleanup, on a branch made for the sweep from the default branch
  1. Declare every library-kind package in .code-docs.json before ranking or cleaning anything: python3 "$CHECKS/comment_census.py" --root . --report lists undeclared packages that look published. The caps, and so the scope of the sweep, depend on the declaration.

Caps are the rule's defaults: plain blocks 5 lines, doc

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/decision-list.md
  • references/failure-modes.md
  • references/reason-recheck.md

FAQ

Что делает скилл code-docs-cleanup?

Clause-by-clause procedure for shortening and cleaning up source-code comments without losing a guard, the comment that says why a non-obvious line must stay as it is and what breaks if it changes. Use when someone asks to shorten, trim or clean up comments, says a file has too many or overly verbose comments or is over-commented, cut comment density or comment bloat, split an essay comment or an over-long doc comment or docstring, move design rationale out of code into a decision record, remove plan, work-package, review-round or decision IDs from comments, delete comments that restate the code, bring a file under the code-docs length caps, or prepare a file or package for the code-docs comment ratchet. Not for writing the comment standards, which the code-docs rule carries, not for --help, JSON Schema, MCP tool descriptions or other text that renders to users, and not for user-facing documentation pages, which the docs-quality rules cover.

Как установить скилл code-docs-cleanup?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл code-docs-cleanup запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить code-docs-cleanup с