Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Context Compressor

ASecurity

Context compression and summarization methodology. Techniques for reducing token usage while preserving decision-critical information.

76 stars
0 votes
0 copies
0 views
Added 2/8/2026
developmentjavascriptjavabashnodeexpresssecurityperformancedocumentation

Security Analysis

A100/100

Scanned 2/12/2026

Install to Claude Code

$npx -y skills add majiayu000/claude-skill-registry --skill context-compressor --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Context Compressor?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Context Compressor
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-context-compressor/badge)](https://www.skillsdirectory.com/skills/majiayu000-context-compressor)

More formats (shields.io, HTML) on the badges page.

Download with Pro
Files
SKILL.md
---
name: context-compressor
description: Context compression and summarization methodology. Techniques for reducing token usage while preserving decision-critical information.
version: 1.0
model: sonnet
invoked_by: both
user_invocable: true
tools: [Read, Write]
best_practices:
  - Preserve decision-critical information
  - Remove redundant content
  - Use structured formats
  - Maintain traceability
error_handling: graceful
streaming: supported
---

# Context Compressor Skill

<identity>
Context Compressor Skill - Techniques for reducing token usage while preserving decision-critical information. Helps agents work efficiently within context limits.
</identity>

<capabilities>
- Compressing conversation history
- Summarizing code and documentation
- Extracting key decisions and context
- Creating efficient memory snapshots
- Reducing redundancy in context
</capabilities>

<instructions>
<execution_process>

### Step 1: Identify Compressible Content

Content types that can be compressed:

| Type          | Compression Strategy                         |
| ------------- | -------------------------------------------- |
| Code          | Keep signatures, summarize implementations   |
| Conversations | Extract decisions, drop small talk           |
| Documentation | Keep headings and key points                 |
| Errors        | Keep message and location, drop stack frames |
| Logs          | Keep patterns, drop repetitions              |

### Step 2: Apply Compression Techniques

**Technique 1: Decision Extraction**

Before:

```
User: Should we use Redis or Memcached?
Assistant: Let me analyze both options...
[500 words of analysis]
Recommendation: Redis for pub/sub support.
User: Ok let's use Redis.
```

After:

```
Decision: Use Redis (chosen for pub/sub support)
```

**Technique 2: Code Summarization**

Before:

```javascript
// 100 lines of UserService implementation
```

After:

```
UserService: CRUD operations for users
- Methods: create, read, update, delete, findByEmail
- Dependencies: db, validator, logger
- Location: src/services/user.js
```

**Technique 3: Error Compression**

Before:

```
Error: Cannot read property 'id' of undefined
    at UserController.getUser (src/controllers/user.js:45:23)
    at Layer.handle [as handle_request] (node_modules/express/lib/router/layer.js:95:5)
    ... 20 more stack frames
```

After:

```
Error: Cannot read 'id' of undefined @ src/controllers/user.js:45
Cause: User object is null when accessing .id
```

### Step 3: Structure Compressed Output

Use consistent formats:

```markdown
## Session Summary

### Decisions Made

- [D1] Use Redis for caching
- [D2] JWT for authentication

### Files Modified

- src/auth/jwt.js (new)
- src/config/redis.js (updated)

### Open Items

- [ ] Add rate limiting
- [ ] Write tests for JWT
```

### Step 4: Validate Compression

Ensure critical info preserved:

- [ ] All decisions captured
- [ ] Key file locations retained
- [ ] Error causes documented
- [ ] Next steps clear

</execution_process>

<best_practices>

1. **Preserve Decisions**: Never lose decision rationale
2. **Keep Locations**: File paths and line numbers are critical
3. **Summarize, Don't Delete**: Transform verbose content
4. **Use References**: Point to files instead of including content
5. **Test Recovery**: Can you continue work from compressed context?

</best_practices>
</instructions>

<examples>
<usage_example>
**Compression Request**:

```
Compress the last 10 messages for context handoff
```

**Example Response**:

```markdown
## Context Summary (compressed from 10 messages)

### Task

Implementing user authentication with JWT

### Progress

1. Created JWT utility (src/auth/jwt.js)
2. Added login endpoint (src/routes/auth.js)
3. Tests failing - mock issue

### Key Decisions

- Using RS256 for JWT signing (security over performance)
- 1-hour token expiry with refresh tokens

### Current Issue

Jest mock for jwt.sign not working
Location: src/auth/**tests**/jwt.test.js:23

### Next Steps

1. Fix JWT mock
2. Add refresh token endpoint
```

</usage_example>
</examples>

## Rules

- Never lose decision rationale
- Always include file locations
- Test that work can continue from compressed context

## Workflow Integration

This skill supports multi-agent orchestration by enabling efficient context management:

**Router Decision:** `.claude/workflows/core/router-decision.md`

- Router spawns agents that use this skill for context-efficient handoffs
- Used in long-running sessions to maintain continuity

**Artifact Lifecycle:** `.claude/workflows/core/skill-lifecycle.md`

- Compression patterns evolve with framework changes
- Session summaries feed into memory protocol

**Related Workflows:**

- `session-handoff` skill for complete handoff protocol
- `swarm-coordination` skill for multi-agent context sharing

---

## Memory Protocol (MANDATORY)

**Before starting:**

```bash
cat .claude/context/memory/learnings.md
```

**After completing:**

- New pattern -> `.claude/context/memory/learnings.md`
- Issue found -> `.claude/context/memory/issues.md`
- Decision made -> `.claude/context/memory/decisions.md`

> ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.

Attribution

majiayu000majiayu000
View sourceMore from majiayu000 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

284722 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2192 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

9881 votes

Pentest

PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.

5491 votes
View all in development →