在任务关键阶段建议手动压缩上下文,帮助连续保留思路与工作记忆。
复制安装指令,让 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 |
…
为 Spring Boot 项目执行构建、测试、扫描与变更复核的发布前验证流程
通过 fal.ai 一站式生成图片、视频与音频内容,满足多模态创作需求
提供适用于 React/Next.js 的高质量动画模式,快速实现常见交互动效。
帮助用户智能挖掘高价值潜在客户并生成多渠道触达方案
提供 Nuxt 4 的 SSR 安全、性能优化与数据获取最佳实践模式
帮助你规划家庭与实验室网络拓扑、地址分配、设备连接与常见避坑。
无损压缩 Claude Code 与 OpenCode 上下文,提升长任务开发效率。
帮助 Claude Code 清理臃肿上下文,分层裁剪并减少会话丢失风险
压缩提示词、文档与智能体技能内容,在保留结构下节省令牌成本。
帮助代理监测上下文压力、压缩会话历史并跨会话恢复关键规则与文件状态
压缩上下文并持久化任务检查点,显著降低 AI 代理 token 消耗
本地优先保存跨会话事实与偏好,帮助 AI 更省 token 地续接上下文