prune-claude-md

Relocates oversized CLAUDE.md sections into docs and path-scoped rules without losing content.

5|1|Updated Aug 18, 2023
One-click install
npx skills add https://github.com/thpoll83/PolyKybdHost --skill prune-claude-md-thpoll83
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prune-claude-md
Source: https://github.com/thpoll83/PolyKybdHost/tree/main/.claude/skills/prune-claude-md
Command: npx skills add https://github.com/thpoll83/PolyKybdHost --skill prune-claude-md-thpoll83

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? CLAUDE.md files load in full at every session start, so an overgrown file taxes every session's context window. This Skill shrinks a bloated CLAUDE.md by moving whole subsystems into docs/ files and path-scoped rules while proving, line by line, that no information was lost. ## Core Features & Use Cases - Byte-level measurement: Python snippets report per-section byte counts and detect cross-file duplicated paragraphs so decisions are driven by numbers, not impressions. - Verbatim block relocation: The bundled move_blocks.py script cuts line ranges bottom-up, appends each block byte-identically to its destination, and inserts a pointer in the source. - Losslessness verification: A diff check replays every original prose line against the new CLAUDE.md, docs/, and .claude/rules/ to confirm zero content was dropped, plus link re-base and heading-level checks. - Use Case: A repo's CLAUDE.md has grown past 400 KB and slows every session. Measure the sections, move subsystem history into docs/ with pointers, add path-scoped rules for hazardous files, and verify the result is lossless before committing. ## Quick Start Ask the assistant to prune the repository's CLAUDE.md by moving large subsystem sections into docs/ with pointers and verifying that no lines were lost.

Frequently Asked Questions about prune-claude-md

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce the size of a CLAUDE.md file?

Measure per-section byte counts first, then move large subsystem blocks into docs/ files behind short pointers and convert file-specific warnings into path-scoped rules. Verify the result by diffing every original prose line against the new files to confirm nothing was lost.

How do I move sections out of CLAUDE.md without losing information?

Use the move_blocks.py script with a JSON spec of line ranges; it cuts blocks bottom-up, appends each verbatim to its destination, and asserts byte-identical copies. Then run the losslessness check that replays every original line longer than 25 characters against the new files.

Do path-scoped rules in .claude/rules replace CLAUDE.md content?

No. A path-scoped rule fires only when the matching file is opened with the Read tool, not when it is read through Bash commands like cat or sed. Rules supplement the CLAUDE.md pointer and should stay under about 1 KB with a link to the full doc.

Why do links break after moving Markdown sections into docs/?

Moving text re-bases every relative link in it, and nothing validates prose links automatically. Run the provided link checker over CLAUDE.md and docs/ after every move, and read the resolved path rather than trusting the exists() result for links into sibling repos.

When should content stay in CLAUDE.md instead of moving to docs?

Keep any rule that binds code outside its own file, such as a note that a mirrored file in other repos must stay byte-identical. Move only content a reader needs while working inside that subsystem, like its reference notes and history.