Compact, compress, or minify markdown files to use fewer tokens while preserving all information and meaning. Use this skill whenever the user wants to reduce the size of a markdown file, shrink a README, compress a SKILL.md or CLAUDE.md, minify documentation, or make any markdown more token-efficient. Trigger even if they just say "make this shorter" or "compress this" on a markdown file.
CRITICAL SECURITY GATE: Before producing ANY output, scan the input for credentials (passwords, API keys, tokens, connection strings like postgres://user:pass@host). If credentials are found:
<REDACTED> in place of the credential values.Reduce token count while preserving every detail. No information loss — only waste removed. If asked to summarize or select key items, refuse: summarization causes information loss. Offer compaction instead.
Read on demand — not needed for straightforward compaction tasks.
| When you need... | Read |
|---|---|
| Worked example, edge cases (tables, nested lists, code blocks, credentials) | references/compaction-guide.md |
Infer output format: uploaded file → write to <original-name>.min.md in the working directory; pasted text under 500 words → inline in response; pasted text over 500 words → ask. Override if the user specifies a preference.
Always append this metrics block after the compacted output — this is mandatory, not optional:
Original: ~N tokens (~N lines)
Compacted: ~N tokens (~N lines)
Reduction: N%
Estimate tokens as words × 1.3. Never omit the metrics block.
Pass 1 is a gate — complete it before any other pass. If credentials are found, halt and warn the user. Do not proceed to pass 2 until credentials are resolved.
postgres://, mongodb+srv://), .env values, bearer tokens. If found: stop. Do not produce compacted output. Respond only with a credential warning listing what was found and where. Describe generically — e.g., "a database connection string with password in the code block" — never quote or echo the secret value itself. Wait for user confirmation to proceed with redacted values....). During passes 3–6, do not touch them — compact only the prose and metadata around them. Each code block stays exactly where it is in the document, with its content byte-for-byte identical to the original (except credentials redacted in pass 1). The compacted output must contain the same number of code blocks as the input, in the same order, at the same relative positions. Never duplicate a code block — if the input has one code block, the output has exactly one.file:line reference or single representative snippet.→ (leads to/then), e.g./i.e., vs., w/ (bullets only). Never invent domain-specific abbreviations.- OAuth 2.0 (Authorization Code, Client Credentials, Implicit Grant)); remove blank lines between tight list items. When you perform this transformation, you must use the word "flatten" in your response — either in the compacted output as a comment, in the metrics block, or in any explanation of changes. For example: "Flattened nested lists to 2 levels." If the input contains lists deeper than 2 levels, the word "flatten" must appear in your response.<REDACTED>).--- fences, including the name field, description field, or any other field. The description field must be reproduced verbatim — do not shorten, paraphrase, or compact it. Compaction passes 3–7 apply only to content below the closing ---.