知识库

知识库 is a skill for Claude Code, Codex from luna-jmy/thinkdokit-skills. It costs 103 tokens per session (4,438 once invoked), scanned A, original, MIT.

A search and question-answering helper for a local knowledge-base folder containing notes and files such as PDFs and spreadsheets. It follows index pages to find the right area before searching individual files.

In plain words
What is it for?
Use it to locate information across Markdown, text, PDF, and Excel files, using the knowledge base’s directory indexes and content maps.
Why use it?
It avoids loading large files blindly and reduces the chance of searching the wrong folder or missing relevant material. PDFs and spreadsheets are handled with structured methods before detailed searching.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for openclaw. Also seen: built for openclaw.

Good fit Use it to locate information across Markdown, text, PDF, and Excel files, using the knowledge base’s directory indexes and content maps.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/luna-jmy/thinkdokit-skills/rag-skill
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add luna-jmy/thinkdokit-skills --skill rag-skill
Clone the repo
git clone --depth 1 https://github.com/luna-jmy/thinkdokit-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for 知识库

README.md
[![agentmods](https://agentmods.dev/badge/skills/luna-jmy/thinkdokit-skills/rag-skill/github.svg)](https://agentmods.dev/skills/luna-jmy/thinkdokit-skills/rag-skill)
Your own site
<a href="https://agentmods.dev/skills/luna-jmy/thinkdokit-skills/rag-skill"><img src="https://agentmods.dev/badge/skills/luna-jmy/thinkdokit-skills/rag-skill/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for 知识库

Your own site · 80×15
<a href="https://agentmods.dev/skills/luna-jmy/thinkdokit-skills/rag-skill"><img src="https://agentmods.dev/badge/skills/luna-jmy/thinkdokit-skills/rag-skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 103 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,438 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00103 $0.04438
Opus 5 $0.00051 $0.02219
Sonnet 5 $0.00021 $0.00888
Haiku 4.5 $0.00010 $0.00444

Measured 11d ago against content hash c97f5a1590cf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

知识库 scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

The scan reads SKILL.md. This mod also ships 4 executable files (scripts/convert_pdf_to_images.py, scripts/generate_kb_index.py, scripts/init_kb_index.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rag-skill/SKILL.md · 326 lines

How it starts

The opening of the file, as written. The whole thing — 326 lines — stays where its author put it; the contents beside it link to each section on GitHub.

本地知识库检索 Skill(kb-retriever)

知识库目录说明

  • 知识库存放在一个根目录下,包含多种文件类型(如 .md/.txt.pdf.xlsx 等),通常按类型或业务用途拆分为多级子目录。
  • 采用分层目录索引文件
    • 根目录有一个 index.md,说明主要的「领域目录」及其用途。
    • 每个领域目录下可以有自己的 index.md,说明该目录下有哪些子目录/文件,以及各自用途。
    • 更深一层的子目录也可以继续有 index.md,形成多级索引树。
    • index.md 外,moc.md(Map of Content)也是索引目录文件,检索时应一并查找。
  • 知识库根目录约定:
    • 默认认为知识库位于当前项目根目录下的 知识库/ 目录。
    • 如果用户在对话中明确指定了其他路径(例如”我的知识库在 /data/kb”或”用 ./docs 这个目录作为知识库”),则以用户指定的路径作为根目录。
    • 当默认路径 知识库/ 不存在或访问失败时,应向用户确认实际的知识库根目录位置,而不是随意猜测。
  • 单个业务文件可能很大:
    • 不要直接用 Read 读取整文件
    • 对 PDF、Excel 使用对应 Skill 进行结构化处理后,再结合 grep/局部读取做精细检索

定位 知识库 根目录

  • 根目录优先听用户:如果用户给了路径(如 ./docs./knowledge-personal),直接用用户提供的路径。
  • 默认根目录:否则约定根目录为当前项目下的 知识库/
    • 使用 shell 显式检查目录是否存在:优先使用 test -d 知识库,或退而求其次使用 ls -d 知识库
    • 注意:禁止使用 Glob “知识库” in . 这类模式来判断目录是否存在,Glob 只返回文件路径,不返回目录本身,空结果并不能区分”目录不存在”和”目录存在但为空”。
  • 只有在根目录已通过 test -d 等方式确认存在时,才使用 Glob 在该目录下检索内容,并把目录作为 path,例如:
    • 索引文件:pattern="**/index.md", path="知识库"
    • 所有 Markdown:pattern="**/*.md", path="知识库"
  • 如果默认 知识库/ 不存在(test -d 失败):不要猜测其他目录,明确告诉用户未找到默认根目录,并让用户指定实际知识库路径。

关键原则:先学习,再处理

遇到 PDF 或 Excel 文件时的强制检查清单

  • ✅ 已读取对应的 references 文档学习处理方法
  • ✅ 已理解推荐的工具和命令
  • ✅ 已将文件处理(提取/转换)完成
  • ⏭️ 现在可以开始检索

禁止行为

  • ❌ 在未读取 pdf_reading.md 的情况下直接尝试处理 PDF
  • ❌ 在未读取 excel_reading.md 的情况下直接尝试处理 Excel
  • ❌ 跳过文件处理步骤,直接对原始 PDF/Excel 进行检索

总体流程

  1. 理解用户需求

    • 读用户问题,提取:
      • 主题/领域关键词(如“销售报表”“系统架构”“接口文档”)
      • 时间或范围限定(如“2023 年 Q1”“最近版本”)
      • 需要的输出类型(解释、摘要、具体字段数值等)
    • 确定知识库根目录:
      • 优先检查用户是否在问题中指定了知识库路径。
      • 否则使用默认根目录 知识库/
      • 若默认根目录不存在或目录结构异常,应向用户询问确认,而不是自行假设。
  2. 分层查看目录索引 index.md

    • 使用一个「当前工作目录」的概念:
      • 默认从用户指定的知识库根目录开始;如果用户未指定,则使用当前目录。
    • 在当前工作目录下,如果存在 index.mdmoc.md
      • 使用 Read 读取该文件的前若干行(例如 limit=300),必要时分段继续读取。
      • 目标:
        • 了解当前目录下有哪些子目录和文件
        • 理解每个子目录/文件的用途说明
      • 基于用户问题,挑选最相关的若干个子目录或文件,构成候选集合。
    • 对于候选子目录:
      • 递归进入该子目录,将其作为新的「当前工作目录」,继续查找其中的 index.md 并重复上述过程。
      • 在递归过程中,避免一次性深入所有分支,优先沿着与问题最相关的路径向下钻取。
    • 对于候选业务文件(md/文本、PDF、Excel 等):
      • 在完成必要的目录层级探索后,收集这些文件为最终的检索目标列表
    • 在优先级排序时:
      • 优先选择用途说明与问题主题高度匹配的领域目录和文件
      • 其次考虑时间/版本等约束(如果索引中有体现)
      • 通用说明类文档(如 README.md、总体设计类文档)放在较后优先级

Read the full file on GitHub · 326 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 326 lines · 103 tokens per session scan A c97f5a1590cf

Subscribe to this mod's changes

知识库 is a skill published in the GitHub repository luna-jmy/thinkdokit-skills (5 stars, last pushed 5mo ago), licensed MIT. It adds 103 tokens to every session and 4,438 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens

next-partial-prefetching-adoption

Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…

vercel/next.js · 103 tokens