Agent skill
compact
[Utilities] Compress context to optimize token usage
Install this agent skill to your Project
npx add-skill https://github.com/duc01226/EasyPlatform/tree/main/.claude/skills/compact
SKILL.md
[IMPORTANT] Use
TaskCreateto break ALL work into small tasks BEFORE starting — including tasks for each file read. This prevents context loss from long files. For simple tasks, AI MUST ask user whether to skip.
Quick Summary
Goal: Compress conversation context to optimize token usage while preserving critical information.
Workflow:
- Analyze -- Identify essential vs. expendable context
- Compress -- Remove redundant information, summarize findings
- Verify -- Ensure critical decisions and progress are preserved
Key Rules:
- Preserve: decisions made, files modified, current task state
- Remove: redundant tool outputs, repeated searches, verbose logs
- Use when context window approaches limits
Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence percentages (Idea should be more than 80%).
Compact Context
Proactively compress the current conversation context to optimize token usage.
When to Use
- Before starting a new task in a long session
- When working on multiple unrelated features
- At natural workflow checkpoints (after commits, PR creation)
- When context indicator shows high usage
Actions
- Summarize completed work - What was done, key decisions made
- Preserve essential context - Active file paths, current task, blockers
- Clear redundant history - Old exploration, superseded plans
- Update memory - Save important patterns to
.claude/memory/
Best Practices
- Use
/compactat natural breakpoints, not mid-task - After compacting, briefly restate the current objective
- Check that critical file paths are still accessible
- If working on a bug, preserve error messages and stack traces
Context Preservation Checklist
Before compacting, ensure you've saved:
- Current branch and uncommitted changes status
- Active file paths being modified
- Any error messages or stack traces
- Key decisions and their rationale
- Pending items from todo list
Example Usage
User: /compact
Claude: Compacting context...
## Session Summary
- Implemented employee export feature
- Fixed validation bug in SaveEmployeeCommand
- Created unit tests for EmployeeHelper
## Active Context
- Branch: feature/employee-export
- Files: Employee.Application/Commands/ExportEmployees/
- Current task: Add pagination to export
## Cleared
- Exploration of unrelated notification code
- Superseded implementation approaches
Ready to continue with pagination implementation.
Closing Reminders
- MUST break work into small todo tasks using
TaskCreateBEFORE starting - MUST search codebase for 3+ similar patterns before creating new code
- MUST cite
file:lineevidence for every claim (confidence >80% to act) - MUST add a final review todo task to verify work quality
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
fix-parallel
[Implementation] Analyze & fix issues with parallel fullstack-developer agents
ask
[Utilities] Answer technical and architectural questions.
claude-code
[Utilities] Claude Code CLI setup, configuration, troubleshooting, and feature guidance. Triggers on claude code setup, hook not firing, MCP connection, context limit, skill creation, slash command setup.
workflow-deployment
[Workflow] Trigger Deployment & Infrastructure workflow — CI/CD pipelines, Docker, Kubernetes setup and deployment.
workflow-idea-to-pbi
[Workflow] Trigger Idea to PBI workflow — po/ba workflow: capture idea, refine to pbi, create stories, prioritize.
easy-claude-help
[Utilities] Configuration guide for the easy-claude framework — explain settings, guide users through configuring .ck.json.
Didn't find tool you were looking for?