上下文健康诊断:mksglu/context-mode: ctx-doctor,适用于工程实践、代码质量与开发流程优化。
上下文健康诊断:mksglu/context-mode: ctx-doctor,适用于工程实践、代码质量与开发流程优化。
> 来源: mksglu/context-mode (19.7k stars) — Claude Code 上下文窗口优化
> 原文件: skills/ctx-doctor/SKILL.md
> 模型推荐: gpt-4.1 (工具/查询类)
mksglu 在 19.7k stars 的 context-mode 仓库里整理的"上下文窗口优化"工具集 — 通过 sandbox 输出压缩(98% reduction)、会话记忆持久化、17 平台路由,让 Claude 在长对话中保持高效。
michael 强调"skill 要有相应的指导功能,指导用户使用",所以加了下面两节让 Agent 和用户对接。
---
1. 用户提到"上下文 / context / 长会话 / 记忆"时触发
2. skill 会按"压缩 → 持久化 → 检索"流程跑
3. 涉及外部存储前 ask user 确认
4. 完工后让 Agent 跑自检
1. 告诉 Agent 你要管理什么对话(长会话 / 项目 / 知识库)
2. 如果需要外部存储 / API key,按提示提供
3. 全程 Agent 自动化,你只需回答授权类问题
---
---
name: ctx-doctor
description: |
Run context-mode diagnostics. Checks runtimes, hooks, FTS5,
plugin registration, npm and marketplace versions.
Trigger: /context-mode:ctx-doctor
user-invocable: true
---
Run diagnostics and display results directly in the conversation.
1. Call the `ctx_doctor` MCP tool directly. It runs all checks server-side and returns a plain-text status report.
2. Display the results verbatim — they are already formatted with plain-text status prefixes: `[OK]` PASS, `[FAIL]` FAIL, `[WARN]` WARN. Renderer-safe (no markdown task-list syntax) for cross-client compatibility (e.g., Z.ai GLM).
3. **Fallback** (only if MCP tool call fails): Derive the **plugin root** from this skill's base directory (go up 2 levels — remove `/skills/ctx-doctor`), then run with Bash:
CLI="<PLUGIN_ROOT>/cli.bundle.mjs"; [ ! -f "$CLI" ] && CLI="<PLUGIN_ROOT>/build/cli.js"; node "$CLI" doctor
Re-display results verbatim with the same `[OK]`/`[FAIL]`/`[WARN]` prefixes.
本 skill 专注于上下文健康诊断,mksglu/context-mode: ctx-doctor。它将相关流程标准化,帮助用户更快拿到可靠结果,减少重复手工操作。
当你需要在上下文健康诊断相关工作中获得稳定、可复用的产出时最适合——无论是单次任务还是纳入日常工作流,都能直接调用。
需要一个具体的项目或任务上下文,最好带有代码仓库或需求文档。
1. 告诉 Agent 你要管理什么对话(长会话 / 项目 / 知识库)
2. 如果需要外部存储 / API key,按提示提供
3. 全程 Agent 自动化,你只需回答授权类问题
---
本 skill 专注于上下文健康诊断,mksglu/context-mode: ctx-doctor。它将相关流程标准化,帮助用户更快拿到可靠结果,减少重复手工操作。
当你需要在上下文健康诊断相关工作中获得稳定、可复用的产出时最适合——无论是单次任务还是纳入日常工作流,都能直接调用。
需要一个具体的项目或任务上下文,最好带有代码仓库或需求文档。