一键导入
ai-rag
RAG and search engineering — chunking, hybrid retrieval, reranking, and nDCG evaluation. Use when building retrieval-augmented generation pipelines.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
RAG and search engineering — chunking, hybrid retrieval, reranking, and nDCG evaluation. Use when building retrieval-augmented generation pipelines.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | ai-rag |
| description | RAG and search engineering — chunking, hybrid retrieval, reranking, and nDCG evaluation. Use when building retrieval-augmented generation pipelines. |
Build production-grade retrieval systems with hybrid search, grounded generation, and measurable quality.
This skill covers:
Modern Best Practices (Jan 2026):
Default posture: deterministic pipeline, bounded context, explicit failure handling, and telemetry for every stage.
Scope note: For prompt structure and output contracts used in the generation phase, see ai-prompt-engineering.
| Task | Tool/Framework | Command/Pattern | When to Use |
|---|---|---|---|
| Decide RAG vs alternatives | Decision framework | RAG if: freshness + citations + corpus size; else: fine-tune/caching | Avoid unnecessary retrieval latency/complexity |
| Chunking & parsing | Chunker + parser | Start simple; add structure-aware chunking per doc type | Ingestion for docs, code, tables, PDFs |
| Retrieval | Sparse + dense (hybrid) | Fusion (e.g., RRF) + metadata filters + top-k tuning | Mixed query styles; high recall requirements |
| Precision boost | Reranker | Cross-encoder/LLM rerank of top-k candidates | When top-k contains near-misses/noise |
| Grounding | Output contract + citations | Quote/ID citations; answerability gate; refuse on missing evidence | Compliance, trust, and auditability |
| Evaluation | Offline + online eval | Retrieval metrics + answer metrics + regression tests | Prevent silent regressions and staleness failures |
Building RAG system: [Architecture Path]
├─ Document type?
│ ├─ Page/section-structured? → Structure-aware chunking (pages/sections + metadata)
│ ├─ Technical docs/code? → Structure-aware + code-aware chunking (symbols, headers)
│ └─ Simple content? → Fixed-size token chunking with overlap (baseline)
│
├─ Retrieval accuracy low?
│ ├─ Query ambiguity? → Query rewriting + multi-query expansion + filters
│ ├─ Noisy results? → Add reranker + better metadata filters
│ └─ Mixed queries? → Hybrid retrieval (sparse + dense) + reranking
│
├─ Dataset size?
│ ├─ <100k chunks? → Flat index (exact search)
│ ├─ 100k-10M? → HNSW (low latency)
│ └─ >10M? → IVF/ScaNN/DiskANN (scalable)
│
└─ Production quality?
└─ Add: ACLs, freshness/invalidation, eval gates, and telemetry (end-to-end)
Do
Avoid
Use this skill when the user asks:
When users ask for vendor/model/framework recommendations, validate claims against current primary sources.
data/sources.json and start from sources with "add_as_web_search": true.After checking, provide:
For adjacent topics, reference these skills:
Resources
Templates
Data
Use this skill whenever the user needs retrieval-augmented system design or debugging, not prompt work or deployment.
Builds multi-repo context hubs and compiled markdown knowledge maps. Use when profiling repo portfolios or assembling LLM-ready cross-repo knowledge bases.
Builds per-repo code graphs in JSON and markdown-ready derived artifacts. Use when you need blast radius, symbol-level maps, import graphs, inheritance, or test links.
Context-driven AI development with AGENTS.md, repo knowledge bases, Claude Code, Codex, and Copilot. Use when adopting repo-native AI workflows or multi-repo setups.
Technical writing for READMEs, ADRs, API docs, and changelogs. Use when revising or consolidating a repo documentation folder.
Design, implement, and troubleshoot NUKE-based CI/CD pipelines for .NET services with fast local-to-CI feedback loops. Use when creating or refactoring `nuke/Build.cs` target graphs, tuning `DependsOn`/`After`/`Triggers`/`OnlyWhenDynamic` behavior, orchestrating unit/API/DB test categories, merging and publishing coverage and test reports, building and pushing Docker images with traceable tags and digests, producing artifact contracts such as `deploy.env`, and diagnosing flaky or slow pipeline execution. For service code changes use $software-csharp-backend, for NUnit fixture design use $qa-testing-nunit, and for safe logging rewrites use $dev-structured-logs.
Systematic debugging for crashes, regressions, flakes, and production bugs. Use when diagnosing stack traces, logs, traces, or profiling data.