在任务关键阶段建议手动压缩上下文,帮助连续保留思路与工作记忆。
复制安装指令,让 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 |
…
帮助开发者为代码代理配置性能优化、安全防护与研究优先工作流。
提供数据库迁移、回滚与零停机发布的最佳实践指导,适用于多种 ORM 与 SQL 数据库。
通过双评审智能体对结果进行对抗式校验,提升输出发布前的可靠性
帮助你掌握地道 Rust 模式、所有权与并发实践,编写安全高性能应用。
基于 C++ Core Guidelines 编写、审查并重构更安全现代的 C++ 代码。
为 Claude Code 会话提供系统化校验流程,帮助检查结果正确性与质量。
在多阶段任务中建议手动压缩上下文,帮助持续保留关键信息与工作连续性。
在多步骤任务中建议分段手动压缩上下文,帮助持续保留关键信息与推进状态。
为 AI 开发任务定义和组合上下文,提升输出一致性与交付质量。
通过分阶段优化上下文检索,帮助子代理获得更准确完整的任务信息
将交接信息压缩为可审计的结构化上下文胶囊,保留目标、约束、决策与风险。
通过 MCP 或剪贴板高效共享代码,并按任务规则定制上下文给大模型。