rag-builder
Skill0 starsChanged 3 months agoMITView on GitHub
端到端构建 RAG(检索增强生成)管道。当需要为 LLM 接入本地知识库、做文档问答、控制幻觉、选型 embedding/检索/评估方案时使用。
1 other project uses a version of this.
Adopted by
Most recently taken up by
- sunji-droid/jack-of-all-trades-africatheir own version, first seen Aug 10, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- sunji-droid/jack-of-all-trades-africa★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- data-cleaningSkill
- fine-tuning-prepSkill
- llm-evaluationSkill
- prompt-engineeringSkill
- prompt-optimizerSkill
The file
Files
RAG 构建
把文档知识注入 LLM 的标准做法:分块 → 向量化 → 索引 → 检索 → 生成 → 评估。目标是让模型"基于资料回答",减少幻觉。
使用步骤
1. 明确需求与评估基线(先定"怎么算好用")
- 是文档问答、客服、还是代码问答?
- 预先定义质量指标与一组评估问题(golden Q&A 集),作为后续回归基线。
2. 数据准备(可复用 data-cleaning 技能)
- 清洗、去重、保元数据。
- 分块(chunking):按结构(标题/段落/表格)切块;块大小与 overlap 需针对任务调参(如 500~1500 tokens + overlap)。
- 块级别检索 vs 父子检索:给小块检索、大块生成,可提升精度与上下文质量。
3. 向量化与索引
- 选 embedding 模型(按语言、领域、预算权衡)。
- 存向量 + 元数据(来源、段落、页码),建倒排/混合索引。
- 考虑混合检索:语义(向量)+ 关键词(BM25)融合,显著提升召回。
4. 检索(Retrieval)
- 训练/调参 top-k,做重排(rerank)提升前排质量。
- 可用查询改写/多路检索提高命中。
5. 生成(Grounding)
- 只把检索到的相关块给模型,并标注来源。
- Prompt 强调"仅基于给定资料回答,未找到则明说"(见 prompt-engineering)。
- 让模型附引用/来源块编号,便于溯源与审核。
6. 评估与迭代(参考 llm-evaluation)
- 三阶段指标:检索质量(Recall@k、命中率)、生成质量(忠实度 faithfulness、答案相关性)、端到端可用性。
- 记录失败的 query,反查是分块、检索还是生成环节问题,迭代修复。
架构速查
文档 → 清洗/分块 → embedding → 向量库(+BM25)
用户问题 → 检索(top-k) → 重排 → 组织上下文 → LLM 作答(附来源)自查清单
- 是否有 golden Q&A 作为回归基线。
- 分块/overlap 是否针对任务调过参。
- 是否用混合检索 + 重排。
- 生成 prompt 是否限定"仅基于资料"。
- 是否跟踪检索与生成两阶段指标并反问迭代。
参考关联
- 数据准备见 data-cleaning;质量评估见 llm-evaluation;提示词见 prompt-engineering。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

