# Compress File

> Compress one instruction file to the leanest STRUCTURE that still delivers its purpose — dissolve sections that restate others, fold unique survivors into the section that governs them. TRIGGER when: user says 'why is this so long', 'strip the fat', 'de-duplicate this skill/doc', 'these sections overlap'.

- Skill: `preetamnath/compress-file` (Agent Skill)
- Install (CLI): `npx skillmds@latest add preetamnath/compress-file`
- Raw SKILL.md: https://api.skillmd.com/api/skills/preetamnath/compress-file/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: preetamnath (https://skillmd.com/u/preetamnath)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/preetamnath/compress-file

---


# Compress File

Cut structure, not meaning — the file must still deliver its purpose, in fewer lines.

## Steps

### Step 1 — Pin the purpose + its invariants

State in one line what the file is for. List every distinct instruction it must still deliver — the checklist you prove against in Step 4.

### Step 2 — Find and remove structural fat

Map which sections restate the purpose, the description, or each other. Judge each overlap:

- **CUT** — content another section or the description already carries.
- **FOLD** — unique content in the wrong home → move it into the section that governs it, then delete the emptied section.

Score each finding 0.00–1.00 — how sure you are the CUT loses nothing, or the FOLD's new home is right.

invoke the `tighten-instruction` skill via the Skill tool; tighten each survivor in place. Leave the file's output-contract or skeleton near-untouched — it's the product.

### Step 3 — Score-gate and apply

Show the plan, then `Edit` every finding scoring **≥ 0.75**; list the rest as held, un-applied. The edits land in a reviewable diff, revert in one commit, and Step 4 re-reads them cold — so the floor applies without walking each.

```
**Compression plan — <file>**
Purpose (must survive): <one line>
- [0.92] CUT:  <section/line> — already in <where>
- [0.60] FOLD: <content> → <target section>  · held (< 0.75)
```

Write `Nothing to compress — already lean.` when there's nothing to change.

### Step 4 — Prove and quantify

Re-read each changed section cold, plan out of view. Confirm every Step 1 invariant survived — in place and still reading right — or was an approved CUT; a FOLD can strand a referent or half a rule, so revert or fix any that broke. Then report net lines and words removed, and the percentage.

