Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

source-doc-slimming

БесплатноЗапускает вложенные скриптыНе проверен

Slim down an oversized "always-read" source document — a single source of truth, a registry, a config, a published skill/README, or a rule document — without…

haiyangchenbjот haiyangchenbj364 установки в других каталогах

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

Source-document slimming

Split an over-large "always-read" file into an operating spine plus a companion reference, and prove nothing was lost. The problem this solves is not disk space: it is that a file read under time pressure gets skimmed by topic, so a load-bearing caveat goes unread while every automated check stays green.

When to use

  • A source-of-truth / registry / config / rule document has grown large enough that readers skim it.
  • A post-mortem concludes something was missed because of volume ("因体量挑读").
  • A document accretes one new section per incident and shows no sign of stopping.
  • A size target has been proposed for such a file ("get it under N KB") — verify it before working to it.

Do not use this for ordinary prose editing, for dead text, or when nothing is under time pressure.

Steps

1. Reconnaissance — three read-only measurements, before proposing anything

python scripts/slim.py breakdown <file>          # section sizes in UTF-8 bytes
python scripts/slim.py coupling <root> "<regex>" # who references the parts you intend to move

Then answer explicitly, in writing:

  • What does code actually read? Grep the readers (validators, tests, loaders) for the exact keys/sections you plan to move. Count hits per key. Zero hits on a key is the licence to move it.
  • What is the arithmetic floor? Sum the blocks that readers depend on. If that sum already exceeds the proposed target, the target is impossible — say so with the number instead of under-delivering.
  • Is the coupling zero? If nothing automated references the parts being moved, the change cannot break a pipeline. If something does, stop and sequence it differently.

2. Run the keep/move test on every block

The test is "is it still binding?", not "does it look historical?"

Keep in the file Move to the companion
Operative values and rule definitions Chronology / append-only version history
Any record carrying a currently binding condition (a gate to be re-checked, a split governing the next action) Resolution narratives, incident write-ups, superseded values
The decision procedure: lookup tables, step lists, the detection formulas Corollaries, worked examples, the "why this rule exists"

A record that looks chronological but states a live precondition stays. Moving it recreates the incident.

3. Move the text verbatim, then write the spine

Move whole blocks byte-for-byte into the companion. Do not paraphrase while moving. Then write the inline spine by hand — a digest, not a copy:

  • the step list / lookup table / detection formulas a reader needs to act;
  • the short list of things a green check does not tell you;
  • a pointer line naming the companion.

Then declare the direction explicitly, in both files:

The table above is a digest, re-derived from companion.md, which is authoritative. If the two ever diverge, the companion wins and this digest is regenerated from it.

Without that sentence the split itself violates the "one writable copy" rule it is meant to uphold.

4. Give future appends a single write path

If the companion is now where new history goes, add one small helper that appends and updates the pointer's count in the source (e.g. changelog_ref / changelog_count). Otherwise the next dated script will append back into the source and quietly undo the work.

5. Add a shape guard, and wire it into the existing gate

Guard shape, not just size:

  • FAIL if a moved-away key reappears in the source;
  • FAIL if the serialization round-trip drifts (a reformat buries a three-line change in a three-thousand-line diff);
  • FAIL if a required operative field is missing;
  • FAIL if the pointer count disagrees with the companion;
  • WARN / FAIL at byte thresholds derived from the measured floor, not from a round number.

Register it as a step in whatever gate the project already runs, so it is not "only mentioned in prose".

6. Prove it losslessly

python scripts/slim.py verify <pre_migration_copy> <companion_file> \
    --start "## 12. Section Heading" --end "## Next Heading"

Repeat per moved section. Exits non-zero if any non-empty line of the original did not land in the companion.

Then assert the retained side too: every operative field byte-identical to the pre-migration copy, and the source's remaining key set correct.

7. Merging two divergent copies of one document

A document published in several forms (SKILL.md + README.md + README_zh.md) has usually drifted. Merge before externalising, and merge deliberately:

  • Normalise aliases first. A release written v1.5 in one file and v1.5.x in another is one row. Without an alias table the merge reproduces the very duplicate you set out to remove.
  • Fix the language; never pick "the longest". Byte-longest silently mixes languages row by row, because CJK runs ~1.4 bytes/char an
Полный SKILL.md на ClawHub

Установить source-doc-slimming в Claude Code и Claude Desktop

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

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

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

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

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

Read

FAQ

Что делает скилл source-doc-slimming?

Slim down an oversized "always-read" source document — a single source of truth, a registry, a config, a published skill/README, or a rule document — without deleting any content. Use when a file that must be read under time pressure has grown so large that its load-bearing parts get skimmed past, when a review or incident concludes that something important was missed because of file volume, when a document accretes a new section after every incident, or when someone sets a size target for a file and you need to check whether that target is arithmetically reachable. Moves long narrative, chronology and incident history into a companion file, leaves an operating spine plus pointers inline, adds a shape guard so the file cannot silently re-inflate, and proves the move was lossless by replaying the original text line-by-line against the companion. Do not use for ordinary editing or for trimming prose that is genuinely dead.

Как установить скилл source-doc-slimming?

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

Скилл source-doc-slimming запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

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

Сравнить source-doc-slimming с