context-window-management
它能做什么
这个技能说明如何让 AI 模型有限的上下文窗口中保留最有用的信息。适合开发长时间运行、可能耗尽空间或丢失关键细节的 AI 应用的开发者。
适用场景
- ✓当一段长对话或应用接近模型的令牌上限的时候。
- ✓当重要细节似乎在长输入的中间部分丢失的时候。
- ✓当团队需要在总结和检索信息之间做选择的时候。
技能链接
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/ai-research/context-window-management/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的聊天机器人在长对话中会丢失关键细节。请帮我更好地管理它的上下文窗口。”
每周 5 个新技能,1 分钟读完。
工作原理
这个技能描述了一些策略,例如分层上下文、把重要内容放在开头和结尾,以及按重要性而不只是按时间顺序进行总结。它会帮你为应用选择合适的策略。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Context Window Management
You're a context engineering specialist who has optimized LLM applications handling millions of conversations. You've seen systems hit token limits, suffer context rot, and lose critical information mid-dialogue.
You understand that context is a finite resource with diminishing returns. More tokens doesn't mean better results—the art is in curating the right information. You know the serial position effect, the lost-in-the-middle problem, and when to summarize versus when to retrieve.
Your cor
Capabilities
- context-engineering
- context-summarization
- context-trimming
- context-routing
- token-counting
- context-prioritization
Patterns
Tiered Context Strategy
Different strategies based on context size
Serial Position Optimization
Place important content at start and end
Intelligent Summarization
Summarize by importance, not just recency
Anti-Patterns
❌ Naive Truncation
❌ Ignoring Token Costs
❌ One-Size-Fits-All
Related Skills
Works well with: rag-implementation, conversation-memory, prompt-caching, llm-npc-dialogue
常见问题
什么是上下文退化?
它是指随着对话变长,关键信息被埋没,回答质量逐渐下降的现象。
上下文越多越好吗?
不是。该技能指出,整理出正确的信息比增加更多令牌更重要。
它涵盖令牌成本吗?
涵盖。它提醒在管理上下文时不要忽视令牌成本。
详情
作者的原始描述
Strategies for managing LLM context windows including summarization, trimming, routing, and avoiding context rot Use when: context window, token limit, context management, context engineering, long context.
热度
- GitHub 星标
- 33k
- 排名
- #8535
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
owasp-security
33k教你的智能体掌握面向网页应用、API、移动端、容器和 AI 智能体的 OWASP 安全指南,以便发现常见弱点并提出修复建议。
agent-management
33k让你的智能体使用 AI Maestro 命令行工具创建、列出、休眠、唤醒、重命名和删除 AI 智能体,管理每个智能体的生命周期。
agent-messaging
33k让你的智能体使用智能体消息协议,在 AI 智能体之间发送、接收和回复带签名的消息,大部分在你自己的电脑上完成。
docs-search
33k让你的智能体搜索自动生成的代码文档,查找函数签名、类定义和注释,从而在修改代码之前核对真实的 API。