CO

context-compressor

Compresses AI context to improve token efficiency.

Install

mkdir -p .claude/skills/context-compressor && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/6117" && unzip -o skill.zip -d .claude/skills/context-compressor && rm skill.zip

Installs to .claude/skills/context-compressor

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Strategies for compressing context to maximize token efficiency
63 charsno explicit “when” trigger
Beginner

Key capabilities

  • Summarize files to save tokens
  • Generate structural outlines of code
  • Extract diffs for updated files
  • Track file references without loading content
  • Implement progressive disclosure of details

How it works

It reduces token usage by replacing full file loads with summaries, outlines, or diffs, and only decompressing specific sections when necessary.

Inputs & outputs

You give it
Full file content or context
You get back
Compressed summary, outline, or diff

When to use context-compressor

  • Reducing context usage for large files
  • Improving response efficiency in deep coding sessions

About this skill

Context Compressor Skill

<role> You are a context compression specialist. Your job is to maintain rich understanding while using minimal tokens.

Core principle: Compress aggressively, decompress only when needed. </role>


Compression Strategies

Strategy 1: Summary Mode

When: You've fully understood a file and may need to reference it later.

How:

## File Summary: src/auth/login.ts

**Purpose:** Handles user login via email/password
**Key functions:**
- handleLogin(req, res) → Validates credentials, returns JWT
- validateCredentials(email, password) → Checks against DB
**Dependencies:** bcrypt, jose, database
**Tokens saved:** ~400 (95 lines not reloaded)

Use instead of: Re-reading the full file


Strategy 2: Outline Mode

When: You need to understand a file's structure but not implementation details.

How:

## Outline: src/services/payment.ts (127 lines)

- L1-15: Imports and types
- L17-35: PaymentService class
  - L20: constructor(config)
  - L25: processPayment(amount, method)
  - L45: refund(transactionId)
  - L67: getHistory(userId)
- L90-127: Helper functions

Tokens: ~50 vs ~500 for full file


Strategy 3: Diff-Only Mode

When: You've already seen a file and need to understand changes.

How:

## Changes to: src/config.ts

Added:
- L45: TOKEN_BUDGET_THRESHOLD = 0.5
- L46: COMPRESSION_ENABLED = true

Modified:
- L12: MAX_CONTEXT → increased from 100000 to 150000

Use for: Reviewing modifications, understanding updates


Strategy 4: Reference Mode

When: You need to track a file without loading it.

How:

## References

| File | Last Seen | Summary | Load If |
|------|-----------|---------|---------|
| auth.ts | Task 2 | Login handling | Auth bugs |
| db.ts | Task 1 | Postgres client | DB errors |
| utils.ts | Never | Utility funcs | Helper needed |

Cost: ~10 tokens vs ~200+ per file


Strategy 5: Progressive Disclosure

When: Unsure how much detail is needed.

Process:

  1. Start with outline (Level 1)
  2. If insufficient, load key functions (Level 2)
  3. If still stuck, load related code (Level 3)
  4. Full file only as last resort (Level 4)
L1: Outline → "I see handleLogin at L25"
L2: Function → "handleLogin validates then calls createToken"
L3: Related → "createToken uses jose.sign with HS256"
L4: Full → Only for complex debugging

Compression Triggers

Automatic Compression Points

TriggerAction
After understanding a fileCreate summary
Switching tasksCompress previous context
Budget at 50%Aggressive outline mode
Budget at 70%Summary-only mode
End of waveFull compression pass

Decompression Protocol

When you need details from compressed context:

  1. Check summary first — Often sufficient
  2. Load specific section — If summary incomplete
  3. Full load as last resort — And re-compress after
## Decompression Log

| File | Reason | Level | Tokens |
|------|--------|-------|--------|
| auth.ts | Debug login | L2 (func) | +150 |
| db.ts | Check query | L3 (snippet) | +50 |

Compression Format Templates

Summary Template

## 📦 [filename]
**Purpose:** [one line]
**Key exports:** [list]
**Dependencies:** [list]
**Patterns:** [notable patterns used]
**Watch for:** [gotchas or edge cases]

Outline Template

## 📋 [filename] (N lines)
- L[start]-[end]: [section name]
  - L[n]: [key item]
  - L[n]: [key item]

Diff Template

## Δ [filename]
**+** [additions]
**-** [removals]
**~** [modifications]

Integration

Works with:

  • token-budget — Triggers compression at thresholds
  • context-fetch — Provides input for compression
  • context-health-monitor — Monitors compression effectiveness

Anti-Patterns

Keeping full files in mental context — Compress after understanding ❌ Re-reading instead of referencing — Use summaries ❌ Loading full file for one function — Use outline + target ❌ Skipping compression "to save time" — Costs more later


Part of GSD v1.6 Token Optimization. See docs/token-optimization-guide.md for examples.

When not to use it

  • When full file content is required for complex debugging
  • When context budget is not constrained

Limitations

  • Summaries may omit critical implementation details
  • Requires manual re-compression after decompression

How it compares

It actively manages token budgets through structured compression strategies rather than relying on raw file inclusion.

Compared to similar skills

context-compressor side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
context-compressor (this skill)14moNo flagsBeginner
pptx3936moReviewAdvanced
nano-pdf632moReviewBeginner
video-downloader1017moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

pptx

anthropics

Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks

393763

nano-pdf

openclaw

Edit PDFs with natural-language instructions using the nano-pdf CLI.

63300

video-downloader

ComposioHQ

Downloads videos from YouTube and other platforms for offline viewing, editing, or archival. Handles various formats and quality options.

101255

youtube-transcript

michalparkola

Download YouTube video transcripts when user provides a YouTube URL or asks to download/get/fetch a transcript from YouTube. Also use when user wants to transcribe or get captions/subtitles from a YouTube video.

68277

using-superpowers

obra

Use when starting any conversation - establishes mandatory workflows for finding and using skills, including using Skill tool before announcing usage, following brainstorming before coding, and creating TodoWrite todos for checklists

95205

browser-automation

browserbase

Automate web browser interactions using natural language via CLI commands. Use when the user asks to browse websites, navigate web pages, extract data from websites, take screenshots, fill forms, click buttons, or interact with web applications. Triggers include "browse", "navigate to", "go to website", "extract data from webpage", "screenshot", "web scraping", "fill out form", "click on", "search for on the web". When taking actions be as specific as possible.

39230

Search skills

Search the agent skills registry