brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
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
Claude Code
$ npx -y skills add g-akshay/ClaudeShrink --skill ClaudeShrink --agent claude-code
Codex
$ npx skills add g-akshay/ClaudeShrink --skill ClaudeShrink -a codex -y
Cursor
$ npx skills add g-akshay/ClaudeShrink --skill ClaudeShrink -a cursor -y
Gemini CLI
$ npx skills add g-akshay/ClaudeShrink --skill ClaudeShrink -a gemini-cli -y
GitHub Copilot
$ npx skills add g-akshay/ClaudeShrink --skill ClaudeShrink -a github-copilot -y
OpenCode
$ npx skills add g-akshay/ClaudeShrink --skill ClaudeShrink -a opencode -y
Windsurf
$ npx skills add g-akshay/ClaudeShrink --skill ClaudeShrink -a windsurf -y
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
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`
---
---
Follow these steps in order every time this skill is triggered:
1. **Self-check: verify the environment is installed.** Run:
test -f ~/.claude/skills/ClaudeShrink/.venv/bin/python && echo "ready" || echo "not_installed"
bash ~/.claude/skills/ClaudeShrink/install.sh
If `install.sh` is missing (skill was added without cloning), fetch and run it:
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. **Extract user intent** — look at the user's request and derive a `--question` flag that captures what they care about. Examples:
4. **If it's a file on disk**, run:
~/.claude/skills/ClaudeShrink/.venv/bin/python ~/.claude/skills/ClaudeShrink/scripts/compressor.py /absolute/path/to/file.txt --question "derived question here"
5. **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):
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" --question "derived question here" rm "$TMP"
6. **Capture stdout** — this is the compressed text. Ignore stderr (it contains stats for your reference).
7. **If the compressor exits non-zero**, warn the user ("ClaudeShrink compression failed — proceeding with raw input") and continue with the original uncompressed text.
8. **Use only the compressed text** (or raw text on failure) as your working context for the user's request.
9. **Inform the user** with a one-line note, e.g.: > "Input compressed with ClaudeShrink (LLMLingua). Compression stats: [paste ratio from stderr if available]."
10. **Proceed with the user's original request** using the compressed context.
---
---
**Example 1 — Large log file with intent:** > User: "Find all payment failures in this log: /var/log/app.log"
~/.claude/skills/ClaudeShrink/.venv/bin/python ~/.claude/skills/ClaudeShrink/scripts/compressor.py /var/log/app.log --question "What payment failures occurred?"
Then analyze the compressed output.
**Example 2 — Pasted text with intent:** > User: "Summarize the errors in this log" then pastes 800 lines.
TMP=$(mktemp /tmp/cs_input.XXXXXX.txt) cat > "$TMP" << 'EOF' [full pasted content] EOF ~/.claude/skills/ClaudeShrink/.venv/bin/python ~/.claude/skills/ClaudeShrink/scripts/compressor.py "$TMP" --question "What errors occurred?" rm "$TMP"
**Example 3 — No specific focus:** > User: "Compress this before you read it: [long prompt]"
Omit `--question` — blind compression applies.
A Claude Code skill that shrinks massive prompts and files using LLMLingua to save tokens. This skill enables Claude Code to handle massive files (logs, documentation, long traces) by compressing them using LLMLingua.
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.