rag-playbook

rag-playbook is a skill for Claude Code, Codex from tienenwu/fables. It costs 115 tokens per session (1,544 once invoked), scanned B, original, MIT.

A guide for building and troubleshooting RAG systems, which let an AI answer using retrieved documents, and semantic-search systems, which find relevant text by meaning. It covers choices such as document splitting, keyword and meaning-based search, indexes, and result reordering.

In plain words
What is it for?
Use it when designing or debugging document search, choosing a search database, improving recall, or evaluating how well a retrieval system finds the right documents.
Why use it?
It helps locate whether poor answers come from retrieving the wrong information before changing the AI prompt or model.

Skill for Claude CodeCodex

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

Good fit Use it when designing or debugging document search, choosing a search database, improving recall, or evaluating how well a retrieval system finds the right documents.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tienenwu/fables/rag
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 tienenwu/fables --skill rag
Clone the repo
git clone --depth 1 https://github.com/tienenwu/fables

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 rag-playbook

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/tienenwu/fables/rag"><img src="https://agentmods.dev/badge/skills/tienenwu/fables/rag.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 115 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,544 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00115 $0.01544
Opus 5.5 $0.00046 $0.00618
Sonnet 5.5 $0.00023 $0.00309
Haiku 4.5 $0.00012 $0.00154

Measured 3mo ago against content hash 4eb25a609a3f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

rag-playbook scanned grade B with 1 finding 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 3mo ago.

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.

Instruction-override phrasingmediumPrompt injection

Text telling the model to disregard its earlier instructions or safety rules is the shape of a prompt injection, whoever wrote it.

- **Never splice retrieved docs directly into the prompt as trusted input**: document content may contain injections like "ignore previous instructions." Retrieved content is untrusted input — isolate it with markers and

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

en/rag/SKILL.md · 58 lines

How it starts

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

🌐 繁體中文(canonical) · English mirror

RAG and Semantic Search Judgment Handbook

Currency: criteria reflect the early-2026 ecosystem. Anywhere a specific model/product name appears is marked "verified 2026-07, re-verify before selecting" — leaderboards and pricing move fast; don't treat a two-year-old ranking as current.

Core Principles

  1. Retrieval quality is the ceiling on generation quality: the LLM can only answer from the context you feed it. When the answer is wrong, first measure retrieval (is the correct answer even in the retrieved docs?) — don't first tune the prompt or swap in a bigger model; that's fixing the wrong layer.
  2. Tuning without an eval set is superstition: changing chunk size, swapping embeddings, adding rerank — each can make some queries better and others worse. Without a golden set to run recall@k, you're just gambling. The eval set comes before all optimization.
  3. Hybrid (BM25 + vector) is the default, not an advanced option: pure vector loses to keyword matching on proper nouns, model numbers, IDs, and codes. Unless you've already verified pure vector is enough, start from hybrid.
  4. First ask "do you even need RAG": if the documents fit in the context window → hand the full text straight to the LLM; if what you need to change is behavior/tone rather than facts → fine-tune; only "large body of facts, needs citation, gets updated" is RAG's turf. Don't use RAG for RAG's sake.
  5. Query side and index side must use the same embedding model: swapping models = re-embed everything. Computing similarity across two different models' vectors produces meaningless numbers, and it won't raise an error — the hardest silent failure to catch.

Where to Start

Situation Which path Read first
Just starting, not yet sure whether to use RAG Run the "do you need RAG" triage first, then discuss the pipeline references/architecture-design.md §1
Designing the whole pipeline / assigning each stage's responsibility First draw ingest→chunk→embed→index→retrieve→rerank→generate, marking clearly what symptom each stage's error disguises itself as references/architecture-design.md
Choosing vector store / embedding model / index / reranker Use the decision tables; never introduce new infrastructure just because it "sounds professional" references/tech-selection.md
Retrieval is inaccurate (finds nothing, finds wrong, bad ranking) First locate whether it's chunk / language mismatch / should-be-hybrid, then act references/retrieval-quality.md
Building an eval set / deciding whether a change can ship golden set + recall@k baseline, run once before and once after the change references/retrieval-quality.md §Evaluation
Fine in demo, blows up only in production Run the release checklist line by line (latency p99, cost, injection, privilege escalation) references/release-checklist.md

Read the full file on GitHub · 58 lines

Files

What ships with it

5 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. 3mo ago First seen · 58 lines · 115 tokens per session scan B 4eb25a609a3f

Subscribe to this mod's changes

rag-playbook is a skill published in the GitHub repository tienenwu/fables (4 stars, last pushed 4mo ago), licensed MIT. It adds 115 tokens to every session and 1,544 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it B with 1 finding (instruction-override phrasing). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

rag-playbook compared with skills from other repositories

rag-playbook next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
rag-playbooktienenwu/fablesSkill44mo agoMITB115Claude Code, Codex
agent-platform-rag-engine-managementgoogle/skillsSkill25ktodayApache-2.0A85Claude Code, Codex
llm-app-patternsdavila7/claude-code-templatesSkill35ktodayMITA54Claude Code, Codex
graphifyGraphify-Labs/graphifySkill155ktodayApache-2.0B76Claude Code
9router-embeddingsdecolua/9routerSkill33k8d agoMITA66Claude Code, Codex
eddtruera/trulensSkill3.7ktodayMITA63Claude Code, Codex
browserwing-adminMemTensor/MemOSSkill13ktodayApache-2.0B47Claude Code, Codex