ClaudeShrink - Large Text Compression
Automatically compresses large text files and documents using LLMLingua before analysis to reduce token usage while preserving semantic content
Free to install — no account needed
Copy the command below and paste into your agent.
Instant access • No coding needed • No account needed
What you get in 5 minutes
- Full skill code ready to install
- Works with 1 AI agent
- Lifetime updates included
Description
--- name: claudeshrink version: 1.0.0 author: Akshay Gundewar description: > Automatically compress large natural text or log files before processing. Trigger when the user pastes massive text blobs, or asks to analyze a large file (logs, docs, transcripts), or provides a prompt that is too large for the context window. DO NOT trigger on source code files or structural data (JSON, XML). tags: - compression - tokens - context-window - llmlingua - skills - ai-tool - claude-code - prompt-compression requires: - python3 - git allowed-tools: - Bash --- # Overview ClaudeShrink compresses large inputs using [LLMLingua](https://github.com/microsoft/LLMLingua) (gpt2) before you reason over them. This preserves semantic content while dramatically reducing token usage. The compressor lives at: `~/.claude/skills/ClaudeShrink/scripts/compressor.py` It runs inside an isolated venv at: `~/.claude/skills/ClaudeShrink/.venv` --- ## When to Use - User pastes a large block of text, logs, or a document (>~8000 chars / ~2000 tokens) - User asks to analyze, summarize, or reason over a large file on disk - User's prompt is very long and would benefit from compression before reasoning - User explicitly says "use ClaudeShrink" or "compress this" --- ## Instructions Follow these steps in order every time this skill is triggered: 1. **Self-check: verify the environment is installed.** Run: ```bash test -f ~/.claude/skills/ClaudeShrink/.venv/bin/python && echo "ready" || echo "not_installed" ``` - If output is `ready`, proceed to step 2. - If output is `not_installed`, run the installer first: ```bash bash ~/.claude/skills/ClaudeShrink/install.sh ``` If `install.sh` is missing (skill was added without cloning), fetch and run it: ```bash curl -fsSL https://raw.githubusercontent.com/g-akshay/ClaudeShrink/main/install.sh | bash ``` Wait for it to complete, then proceed to step 2. 2. **Identify the input source** — is it a file path, raw pasted text, or a prompt? 3. **If it's a file on disk**, run: ```bash ~/.claude/skills/ClaudeShrink/.venv/bin/python ~/.claude/skills/ClaudeShrink/scripts/compressor.py /absolute/path/to/file.txt ``` 4. **If it's raw pasted text or a prompt (no file on disk)**, write to a uniquely-named temp file, compress, then delete: Write the actual input content into the heredoc (do not write a placeholder string): ```bash TMP=$(mktemp /tmp/cs_input.XXXXXX.txt) cat > "$TMP" << 'EOF' [insert the full raw text content here] EOF ~/.claude/skills/ClaudeShrink/.venv/bin/python ~/.claude/skills/ClaudeShrink/scripts/compressor.py "$TMP" rm "$TMP" ``` 5. **Capture stdout** — this is the compressed text. Ignore stderr (it contains stats for your reference). 6. **If the compressor exits non-zero**, warn the user ("ClaudeShrink compression failed — proceeding with raw input") and continue with the original uncompressed text. 7. **Use only the compressed text** (or raw text on failure) as your working context for the user's request. 8. **Inform the user** with a one-line note, e.g.: > "Input compressed with ClaudeShrink (LLMLingua). Compression stats: [paste ratio from stderr if available]." 9. **Proceed with the user's original request** using the compressed context. --- ## Output Format - Do not show the raw compressed text to the user unless they ask for it. - Respond to the user's original request (summarize, analyze, explain, etc.) as normal. - Optionally append a brief compression note: original size, compressed token target, ratio. --- ## Examples **Example 1 — Large log file:** > User: "Analyze this error log: /var/log/app.log" ```bash ~/.claude/skills/ClaudeShrink/.venv/bin/python ~/.claude/skills/ClaudeShrink/scripts/compressor.py /var/log/app.log ``` Then analyze the compressed output. **Example 2 — Pasted text:** > User pastes 800 lines of documentation inline. Write it to a `mktemp`-generated path, compress, delete, analyze. **Example 3 — Explicit trigger:** > User: "Use ClaudeShrink on this prompt before answering: [long prompt]" Same as Example 2.
Security Status
Unvetted
Not yet security scanned
Related AI Tools
More Save Money tools you might like
Family History Research Planning Skill
FreeProvides assistance with planning family history and genealogy research projects.
Naming Skill
FreeName products, SaaS, brands, open source projects, bots, and apps. Use when the user needs to name something, find a brand name, or pick a product name. Metaphor-driven process that produces memorable, meaningful names and avoids AI slop.
Profit Margin Calculator
$7.99Find hidden profit leaks — see exactly where your money goes
guard-scanner
Free"Security scanner and runtime guard for OpenClaw skills, MCP servers, and AI agent workflows. Detects prompt injection, identity hijacking, memory poisoning, A2A contagion, secret leaks, supply-chain abuse, and dangerous tool calls with 364 static th
bbc-skill — Bilibili Comment Collector
FreeFetch Bilibili (哔哩哔哩) video comments for UP主 self-analysis. Use when the user asks to collect, download, export, or analyze comments on a Bilibili video (BV号 / URL / UID). Produces JSONL + summary.json suitable for further Claude Code analysis (senti
Life OS · Personal Decision Engine
Free"A personal decision engine with 16 independent AI agents, checks and balances, and swappable cultural themes. Covers relationships, finance, learning, execution, risk control, health, and infrastructure. Use when facing complex personal decisions (c