Strategic Compact
Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.
Install
/plugin marketplace add xu-xiang/everything-claude-code-zhThe repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.
npx skills add xu-xiang/everything-claude-code-zh --skill strategic-compactgit clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh.git /tmp/everything-claude-code-zh
mkdir -p ~/.claude/skills
cp -r /tmp/everything-claude-code-zh/docs/zh-TW/skills/strategic-compact ~/.claude/skills/strategic-compactPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# 策略性壓縮技能
在工作流程的策略點建議手動 `/compact`,而非依賴任意的自動壓縮。
## 為什麼需要策略性壓縮?
自動壓縮在任意點觸發:
- 經常在任務中途,丟失重要上下文
- 不知道邏輯任務邊界
- 可能中斷複雜的多步驟操作
邏輯邊界的策略性壓縮:
- **探索後、執行前** - 壓縮研究上下文,保留實作計畫
- **完成里程碑後** - 為下一階段重新開始
- **主要上下文轉換前** - 在不同任務前清除探索上下文
## 運作方式
`suggest-compact.sh` 腳本在 PreToolUse(Edit/Write)執行並:
1. **追蹤工具呼叫** - 計算工作階段中的工具呼叫次數
2. **門檻偵測** - 在可設定門檻建議(預設:50 次呼叫)
3. **定期提醒** - 門檻後每 25 次呼叫提醒一次
## Hook 設定
新增到你的 `~/.claude/settings.json`:
```json
{
"hooks": {
"PreToolUse": [{
"matcher": "tool == \"Edit\" || tool == \"Write\"",
"hooks": [{
"type": "command",
"command": "~/.claude/skills/strategic-compact/suggest-compact.sh"
}]
}]
}
}
```
## 設定
環境變數:
- `COMPACT_THRESHOLD` - 第一次建議前的工具呼叫次數(預設:50)
## 最佳實務
1. **規劃後壓縮** - 計畫確定後,壓縮以重新開始
2. **除錯後壓縮** - 繼續前清除錯誤解決上下文
3. **不要在實作中途壓縮** - 為相關變更保留上下文
4. **閱讀建議** - Hook 告訴你*何時*,你決定*是否*
## 相關
- [Longform Guide](https://x.com/affaanmustafa/status/2014040193557471352) - Token 優化章節
- 記憶持久性 hooks - 用於壓縮後存活的狀態Details
- Skill name
strategic-compact- Repository
- xu-xiang/everything-claude-code-zh
- Path
docs/zh-TW/skills/strategic-compact/SKILL.md- License
- MIT
- Repo updated
- 5 March 2026
FAQ
What does the Strategic Compact skill do?
Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.
How do I install the Strategic Compact skill?
Claude Code plugin: /plugin marketplace add xu-xiang/everything-claude-code-zh. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Strategic Compact popular?
It lives in xu-xiang/everything-claude-code-zh, which has 2,037 GitHub stars and 332 forks.
Related skills
Backend Patterns
2kxu-xiang/everything-claude-code-zh
Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.
Coding Standards
2kxu-xiang/everything-claude-code-zh
Universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development.
Frontend Patterns
2kxu-xiang/everything-claude-code-zh
Frontend development patterns for React, Next.js, state management, performance optimization, and UI best practices.
Release Notes
1.1kagentic-community/mcp-gateway-registry
Create release notes for a new version tag. Gathers all commits, PRs, issues fixed, and breaking changes since a previous release. Creates the release notes markdown file, tags the repo, and pushes. Asks the user to confirm the base version to diff against.
Orchestration
1.1knumman-ali/n-skills
Multi-agent orchestration for complex tasks. Use when tasks require parallel work, multiple agents, or sophisticated coordination. Triggers include requests for features, reviews, refactoring, testing, documentation, or any work that benefits from decomposition into parallel subtasks. This skill defines how to orchestrate work using cc-mirror tasks for persistent dependency tracking and TodoWrite for real-time session visibility.
Cicd Automation Workflow Automate
2krmyndharis/antigravity-skills
Design efficient CI/CD pipelines, GitHub Actions workflows, and automated development processes that reduce manual work and accelerate delivery while maintaining quality and security. Use when creating or improving build, test, and deployment automation.
Browse the most popular Claude skills, all productivity & notes skills, or write your own with the skills generator.