在任务关键阶段建议手动压缩上下文,帮助连续保留思路与工作记忆。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "strategic-compact" 技能: 1. 下载 https://raw.githubusercontent.com/affaan-m/ECC/main/skills/strategic-compact/SKILL.md 2. 保存为 ~/.claude/skills/strategic-compact/SKILL.md 3. 装好后重载技能,告诉我可以用了
当我们从需求分析进入方案设计时,请先帮我做一次手动上下文压缩,保留目标、关键约束、已确认结论和待解决问题。
一份精炼的阶段摘要,便于在新阶段继续推进且不丢失关键背景。
请在开始下一轮编码前压缩当前对话上下文,整理已完成模块、接口约定、遗留 bug 和下一步优先事项。
结构化的开发进度摘要,可直接作为后续实现的上下文输入。
请在进入文献对比阶段前,手动压缩前面的讨论内容,提炼研究目标、核心发现、证据来源与后续验证方向。
一份面向下一研究阶段的上下文摘要,减少信息遗漏和重复沟通。
Suggests manual /compact at strategic points in your workflow rather than relying on arbitrary auto-compaction.
Auto-compaction triggers at arbitrary points:
Strategic compaction at logical boundaries:
The suggest-compact.js script runs on PreToolUse (Edit/Write) and:
Add to your ~/.claude/settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Edit",
"hooks": [{ "type": "command", "command": "node ~/.claude/scripts/hooks/suggest-compact.js" }]
},
{
"matcher": "Write",
"hooks": [{ "type": "command", "command": "node ~/.claude/scripts/hooks/suggest-compact.js" }]
}
]
}
}
Environment variables:
COMPACT_THRESHOLD — Tool calls before first suggestion (default: 50)Use this table to decide when to compact:
| Phase Transition | Compact? | Why |
|---|---|---|
| Research → Planning | Yes | Research context is bulky; plan is the distilled output |
| Planning → Implementation | Yes | Plan is in TodoWrite or a file; free up context for code |
| Implementation → Testing | Maybe | Keep if tests reference recent code; compact if switching focus |
| Debugging → Next feature | Yes | Debug traces pollute context for unrelated work |
| Mid-implementation | No | Losing variable names, file paths, and partial state is costly |
| After a failed approach | Yes | Clear the dead-end reasoning before trying a new approach |
Understanding what persists helps you compact with confidence:
| Persists | Lost |
|---|---|
| CLAUDE.md instructions | Intermediate reasoning and analysis |
| TodoWrite task list | File contents you previously read |
Memory files (~/.claude/memory/) | Multi-step conversation context |
| Git state (commits, branches) | Tool call history and counts |
| Files on disk | Nuanced user preferences stated verbally |
/compact with a summary — Add a custom message: /compact Focus on implementing auth middleware nextInstead of loading full skill content at session start, use a trigger table that maps keywords to skill paths. Skills load only when triggered, reducing baseline context by 50%+:
| Trigger | Skill | Load When |
|---|---|---|
| "test", "tdd", "coverage" | tdd-workflow | User mentions testing |
| "security", "auth", "xss" | security-review | Security-related work |
…
用于仓库命令执行、CI排障与小范围修复,并提供可核验执行证据。
帮助用户高效整理邮箱、起草核验并安全发送邮件与跟进。
为 Quarkus 项目执行发布前验证闭环,涵盖构建、测试、扫描与差异审查。
通过并行执行、批量调用与独立验证通道,加速复杂任务且保持结果正确。
帮助开发者快速掌握 Kotlin Ktor 服务端常用架构与测试模式。
提供地道 Go 语言模式与最佳实践,帮助构建健壮高效且易维护的应用
无损压缩 Claude Code 与 OpenCode 上下文,提升长任务开发效率。
压缩并检索本地上下文内容,提升 GPT/Codex 的令牌使用效率
压缩提示词、文档与智能体技能内容,在保留结构下节省令牌成本。
帮助代理监测上下文压力、压缩会话历史并跨会话恢复关键规则与文件状态
压缩上下文并持久化任务检查点,显著降低 AI 代理 token 消耗
为大模型对话提供上下文压缩,在保真前提下降低 token 消耗。