🛡️
AI EngineeringJavaScript

Compact Guard

by rohitg00

Compact Guard is an AI Engineering skill for Claude Code, published by rohitg00 in pro-workflow.

2.8K stars270 forkson rohitg00/pro-workflowAdded 2026/08/17Repository updated 2026/08/10
agent-orchestrationai-agentsai-codingai-workflowclaudeclaude-codeclaude-code-pluginclaude-code-skillsclaude-skillscodexcontext-engineeringcursordeveloper-toolsgemini-clihooksproductivityself-correctionworkflowworktrees
Install in seconds
Install Compact Guard
Copy Compact Guard into your Claude Code skills folder. Run the command in your terminal, or review the source on GitHub before installing.
terminal
npx degit https://github.com/rohitg00/pro-workflow/tree/main/skills/compact-guard ~/.claude/skills/compact-guard

Requires Node.js. Downloads this skill only — not the rest of the repository — into your Claude Code skills folder.

Without Node.js

git clone https://github.com/rohitg00/pro-workflow.git

Clones the whole repository, then copy the skill’s own directory into your skills folder yourself.

In this catalog

Source file
skills/compact-guard/SKILL.md in rohitg00/pro-workflow
Installs to
~/.claude/skills/compact-guard
Collection
One of 25 skills cataloged from this repository
Category
AI Engineering2451 skills

What Compact Guard does

Compact Guard preserves critical context state before compaction and restores it after, so an agent can resume work without losing task progress, decisions, or next steps.

Compact Guard is cataloged under AI Engineering on DirSkills. Compact Guard comes from a repository tagged agent-orchestration, ai-agents, ai-coding, ai-workflow and claude.

Documentation

README

Compact Guard

Protect important context through compaction cycles. Based on Claude Code internals: compaction restores max 5 files with 5K tokens each, within a 50K total budget.

Trigger

Use before /compact or when auto-compact warning appears.

Key Constants (from Claude Code source)

  • POST_COMPACT_MAX_FILES_TO_RESTORE = 5 — only 5 files survive
  • POST_COMPACT_TOKEN_BUDGET = 50K — total restore budget
  • POST_COMPACT_MAX_TOKENS_PER_FILE = 5K — per-file limit
  • Auto-compact fires at context_window - 13K buffer

Pre-Compact Checklist

Before compacting, save these to memory or a scratch file:

This is the opening of the README. Read the full README on GitHub.

Commands Compact Guard provides

Slash commands named in this skill’s SKILL.md, listed in the order they first appear.

  • /compact
  • /resume

Frequently asked about Compact Guard

  • What else does rohitg00 publish alongside Compact Guard?

    Compact Guard is one of 25 skills that DirSkills catalogs from rohitg00/pro-workflow, the repository it ships in. Its siblings there include Agent Teams, Auto Setup and Batch Orchestration. Each one is a separate skill with its own page in this directory, installs the same way Compact Guard does, and is maintained by rohitg00 in that same repository. The rest of the collection is listed on the rohitg00/pro-workflow page.

  • How does Compact Guard compare to other AI Engineering skills?

    Compact Guard ranks #730 by stars among the 2451 AI Engineering skills in this catalog. The most-starred ones next to it are Architecture Decision Records, AI-First Engineering and Agentic OS. DirSkills ranks by the star count of the repository each skill ships in, so that order reflects how popular those repositories are rather than any review of Compact Guard against them. Open each page to compare what they document and how they install.

More from rohitg00/pro-workflow

Compact Guard is one of 25 skills cataloged on DirSkills from rohitg00/pro-workflow.

See all 25 skills
👥
2w ago

Agent Teams

Agent Teams coordinates multiple Claude Code sessions as a team with shared task lists, mailbox messaging, and file-lock claiming. Use it to parallelize work on non-overlapping files or delegate cross-layer changes across a lead and teammates.
AI Engineering
2.8K270
2w ago

Auto Setup

Auto Setup detects the project type and configures quality gates, hooks, and settings for a new codebase. Use it when onboarding a new project or setting up CI integration.
Quality
2.8K270
🤖
2w ago

Batch Orchestration

Batch Orchestration decomposes large-scale, repetitive code changes into independent units and spawns parallel agents in isolated worktrees to implement them. Use it for migrations, refactors, codemods, and any change touching 10+ files with the same pattern.
Automation
2.8K270
🐛
2w ago

Bug Capture

Bug Capture turns a user-reported defect into a durable GitHub issue written in the project's own domain language, without exposing file paths or line numbers. Use it when a user reports a bug conversationally, runs a QA pass, or asks to file an issue.
Automation
2.8K270
🧠
2w ago

Context Engineering

Context Engineering helps you manage context windows in AI coding sessions by mastering four operations: Write, Select, Compress, and Isolate. Use it to keep token budgets efficient, plan compaction strategies, and partition work across subagents and worktrees.
AI Engineering
2.8K270
🧠
2w ago

Context Optimizer

Context Optimizer helps manage context windows and token budgets in Claude Code sessions. Use it when sessions feel slow, context is degraded, or you are running out of budget.
AI Engineering
2.8K270