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
  • 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.

Back to skills

Strategic Compact Skill

ASecurity

Suggest optimal context compaction strategies for AI agent sessions, preserving critical information while reducing token usage

6 stars
0 votes
0 copies
0 views
Added 9/20/2026
code-qualitygoreactdebuggingcode-reviewapisecurity

Works with

api

Security Analysis

A100/100

Scanned 9/20/2026

Install to Claude Code

$npx -y skills add darellchua2/opencode-config-template --skill strategic-compact-skill --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Strategic Compact Skill?

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

Security grade badge for Strategic Compact Skill
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/darellchua2-strategic-compact-skill/badge)](https://www.skillsdirectory.com/skills/darellchua2-strategic-compact-skill)

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

Download Zip
Files
SKILL.md
---
name: strategic-compact-skill
description: Suggest optimal context compaction strategies for AI agent sessions, preserving critical information while reducing token usage
license: Apache-2.0
compatibility: opencode
category: Agent Optimization
---

## What I do

Analyze session context and compact it: classify content by retention priority, generate a session brief that preserves actionable state, and plan session breakpoints.

**Trigger phrases**: "compact context", "summarize session", "reduce context", "what can we drop", "session getting long", "preserve key decisions".

## Retention Tiers

| Tier | Content | Handling |
|------|---------|----------|
| **1 — Must keep** | Current task + acceptance criteria; uncommitted changes and their purpose; active debugging state (hypothesis, what's been tried); blockers and dependencies; auth/security context | Keep verbatim |
| **2 — Should keep** | Architecture decisions + rationale; key file locations; API contracts/data models; test results; partial solutions with reasoning | Keep, tighten |
| **3 — Compressible** | Dead-end explorations ("tried X, failed because Y"); code-review findings (drop the back-and-forth); error resolutions (keep solution, drop the process); unchanged file contents (keep paths only) | One line each |
| **4 — Discard** | Greetings; redundant explanations; abandoned approaches with no learning value; intermediate iterations; content already in files (reference, don't inline) | Drop |

## Workflow

1. **Assess**: token estimate, open tasks, decisions made, files modified, errors resolved.
2. **Classify** content into the four tiers.
3. **Strategy**: list keep-full / summarize / discard items; present the plan before executing.
4. **Execute**: generate the session brief; persist critical info to `LEARNINGS/` or project config; update AGENTS.md if a project-level finding emerged; define the next session's starting point.
5. **Validate**: all active tasks tracked, all decisions preserved with rationale, all error/solution pairs documented, next steps clear. If anything critical was lost — restore and re-compact.

## Session Brief (output contract)

```markdown
## Session Brief (Compacted)

### Active Task
[one line]

### State
- [x] Completed: …
- [ ] In Progress: …
- [ ] Remaining: …

### Key Decisions
1. [decision]: [why] → [impact]

### Files
| File | Status | Notes |
|------|--------|-------|
| path | Modified/Created/Unchanged | what + why |

### Blockers
- …

### Next Steps
1. …
```

## When to Compact

- Proactively at ~70% context capacity, not reactively.
- Between subtasks; after a solved debug (keep the fix, drop the process); before PR creation (changes + rationale only).
- Common failure modes: over-compacting loses the "why" behind decisions; under-compacting keeps raw conversation; dropping context another skill/agent depends on.

## Integration

- `continuous-learning-skill` — extract patterns before compacting (Tier 1)
- `verification-loop-skill` — compaction preserves gate memos + verification state
- `eval-harness-skill` — eval results are Tier 2 (keep summaries)
- `plan-execution-skill` (--update) — PLAN.md files are natural compaction anchors

> **Removal note (2026-09-19, #409 trim per LEARNINGS #383 recipe):** dropped the worked compaction-strategy example, the multi-session plan template (variant of the session brief), the Example Usage section, and Best Practices prose (compressed into "When to Compact"). Kept verbatim: frontmatter, retention tiers, workflow contract, session-brief output template.

Attribution

darellchua2darellchua2
View sourceMore from darellchua2 →
SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

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

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Related Skills

Caveman Review

Ultra-compressed code review comments. Cuts noise from PR feedback while preserving the actionable signal. Each comment is one line: location, problem, fix. Use when user says "review this PR", "code review", "review the diff", "/review", or invokes /caveman-review. Auto-triggers when reviewing pull requests.

1023331 votes

Caveman Commit

Ultra-compressed commit message generator. Cuts noise from commit messages while preserving intent and reasoning. Conventional Commits format. Subject ≤50 chars, body only when "why" isn't obvious. Use when user says "write a commit", "commit message", "generate commit", "/commit", or invokes /caveman-commit. Auto-triggers when staging changes.

1023331 votes

Springboot Verification

Verification loop for Spring Boot projects: build, static analysis, tests with coverage, security scans, and diff review before release or PR.

2456590 votes

Verification Loop

一个全面的 Claude Code 会话验证系统。

2456590 votes

Django Verification

Verification loop for Django projects: migrations, linting, tests with coverage, security scans, and deployment readiness checks before release or PR.

2456590 votes
View all in code-quality →