跳到正文
Skillpedia
智能体33k · #8512

ctx-index

它能做什么

这个技能把本地项目文件加入 context-mode 的搜索索引,之后就能快速搜索。适合希望助手回答代码库相关问题、又不想每次都重新阅读的开发者。

适用场景

  • ✓当开发者希望助手之后能够搜索项目的代码和文档的时候。
  • ✓当大型代码仓库需要索引一次,让之后的搜索保持快速的时候。
  • ✓当项目文档需要以清晰的标签进行搜索的时候。

技能链接

https://github.com/mksglu/context-mode/blob/main/skills/ctx-index/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/mksglu/context-mode/blob/main/skills/ctx-index/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请索引这个项目文件夹,方便我之后搜索它的代码。”

每周 5 个新技能,1 分钟读完。

工作原理

这个技能会按路径索引所选文件夹,并使用深度和文件数量的限制使其易于管理。然后它会报告标签和文件数量,并展示之后使用的搜索命令。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Context Mode Index

Index local project content for later search.

Instructions

  1. Prefer the ctx_index MCP tool when it is available.
  2. Ask for a path only if the user did not provide one and the current project root is ambiguous.
  3. Use path, not large inline content, so file bytes do not enter the conversation.
  4. For repository indexing, pass conservative bounds and a clear source label:
ctx_index({
  path: ".",
  source: "project:<name>",
  maxDepth: 5,
  maxFiles: 200
})
  1. If MCP tools are unavailable, fall back to the CLI:
context-mode index . --source project:<name>
  1. Report the indexed source label, file count or section count, and the matching search command:
ctx_search({ source: "project:<name>", queries: ["..."] })

Safety

  • Do not index dependency directories, build outputs, secrets, or generated artifacts.
  • Prefer --exclude or exclude for project-specific noisy paths.
  • For broad repos, ask the user before raising maxFiles above 500.
常见问题

哪些内容不应该被索引?

依赖文件夹、构建输出、机密信息和生成的文件都应该排除在外。

文件数量有限制吗?

有。对于范围较广的代码仓库,技能会在将文件数量上限提高到 500 以上之前先询问。

索引之后怎样搜索?

使用搜索技能并指定相同的来源标签,即可找到已索引内容中的片段。

详情

作者的原始描述

Index a local file or directory into context-mode's persistent FTS5 knowledge base so future ctx_search calls can retrieve focused snippets without rereading raw files. Trigger: /context-mode:ctx-index

repo: mksglu/context-mode

热度

GitHub 星标
33k
排名
#8512
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能