kb-retriever

kb-retriever is a skill for Claude Code, Codex from ConardLi/garden-skills. It costs 105 tokens per session (3,737 once invoked), scanned A, original, MIT.

A retrieval and question-answering assistant for a local folder of documents, including Markdown, text, PDFs, and spreadsheets.

In plain words
What is it for?
Use it to answer questions from a local knowledge base, navigate its folder indexes, search documents, and extract information from PDFs or Excel files.
Why use it?
It helps find relevant information in a large document collection without loading every file at once, while using the appropriate method for each file type.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to answer questions from a local knowledge base, navigate its folder indexes, search documents, and extract information from PDFs or Excel files.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/conardli/garden-skills/kb-retriever
About the project

Garden Skills is an open-source collection of reusable instructions for AI coding agents such as Claude Code, Cursor, and Codex, covering tasks including web design, image generation, and turning source material into articles or presentations. Developers use the skills to guide agents through these workflows.

ConardLi/garden-skills · 12,324 stars · on GitHub

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 ConardLi/garden-skills --skill kb-retriever
Clone the repo
git clone --depth 1 https://github.com/ConardLi/garden-skills

Made for: Claude Code, Codex.

Its marketplace also offers this one on its own, as the plugin knowledge-base-skills/plugin install knowledge-base-skills after adding the marketplace above.

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 kb-retriever

README.md
[![agentmods](https://agentmods.dev/badge/skills/conardli/garden-skills/kb-retriever/github.svg)](https://agentmods.dev/skills/conardli/garden-skills/kb-retriever)
Your own site
<a href="https://agentmods.dev/skills/conardli/garden-skills/kb-retriever"><img src="https://agentmods.dev/badge/skills/conardli/garden-skills/kb-retriever/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 kb-retriever

Your own site · 80×15
<a href="https://agentmods.dev/skills/conardli/garden-skills/kb-retriever"><img src="https://agentmods.dev/badge/skills/conardli/garden-skills/kb-retriever.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 105 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,737 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. Third-party audits
  • Socket pass 8 May 2026
  • Snyk pass 8 May 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00105 $0.03737
Opus 5 $0.00053 $0.01869
Sonnet 5 $0.00021 $0.00747
Haiku 4.5 $0.00011 $0.00374

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

Security

Grade A, and why

kb-retriever 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 1 executable file (scripts/convert_pdf_to_images.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.

skills/kb-retriever/SKILL.md · 250 lines

How it starts

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

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

知识库目录说明

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

定位 knowledge 根目录

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

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

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

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

禁止行为

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

总体流程

  1. 理解用户需求

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

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

Read the full file on GitHub · 250 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 · 250 lines · 105 tokens per session scan A 9329fac8ad19

Subscribe to this mod's changes

kb-retriever is a skill published in the GitHub repository ConardLi/garden-skills (12,324 stars, last pushed 2mo ago), licensed MIT. It adds 105 tokens to every session and 3,737 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-30.

Related

Other skills, from other repositories

bailian-kb

A command-line manager for Alibaba Cloud Bailian knowledge bases, which are collections of documents prepared for search and question answering. It handles the stored documents, search services, text chunks, and data-centre files rather than everyday searches.

modelstudioai/cli · 234 tokens

azure-cognitive-search

Expert knowledge for Azure AI Search development including troubleshooting, best practices, decision making, architecture & design patterns, limits & quotas, security, configuration, integrations & coding patterns, and deployment. Use when designing indexes, skillsets, indexers, vector/semantic search, or secure data…

MicrosoftDocs/Agent-Skills · 116 tokens

azure-horizondb

Expert knowledge for Azure Horizondb development including troubleshooting, best practices, decision making, architecture & design patterns, limits & quotas, security, configuration, integrations & coding patterns, and deployment. Use when using azureai SQL/embeddings, pgvector tuning, Apache AGE graphs, hybrid…

MicrosoftDocs/Agent-Skills · 95 tokens

azure-documentdb

Expert knowledge for Azure DocumentDB development including troubleshooting, best practices, decision making, architecture & design patterns, limits & quotas, security, configuration, integrations & coding patterns, and deployment. Use when using DocumentDB search (BM25/vector), Data API, MongoDB compatibility, change…

MicrosoftDocs/Agent-Skills · 120 tokens

azure-document-intelligence

Expert knowledge for Azure AI Document Intelligence development including troubleshooting, best practices, decision making, limits & quotas, security, configuration, integrations & coding patterns, and deployment. Use when designing custom models, calling AnalyzeDocument APIs, running containers/offline, or migrating…

MicrosoftDocs/Agent-Skills · 117 tokens

azure-content-understanding

Expert knowledge for Azure Content Understanding in Foundry Tools development including troubleshooting, best practices, decision making, architecture & design patterns, limits & quotas, security, configuration, and integrations & coding patterns. Use when designing Content Understanding analyzers, RAG document flows…

MicrosoftDocs/Agent-Skills · 131 tokens