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

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.

agentmods
npx agentmods add skills/tienenwu/fables/rag
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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.00115 $0.01544
Opus 5 $0.00057 $0.00772
Sonnet 5 $0.00023 $0.00309
Haiku 4.5 $0.00012 $0.00154

Measured 4d ago against content hash 4eb25a609a3f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 4d 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. 4d 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 1mo ago), licensed MIT. It adds 115 tokens to every session and 1,544 once invoked, about $0.0006 per session on Opus 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

Other skills, from other repositories

mem0-vercel-ai-sdk

Mem0 provider for Vercel AI SDK (@mem0/vercel-ai-provider). TRIGGER when: user mentions "vercel ai sdk", "@mem0/vercel-ai-provider", "createMem0", "retrieveMemories", "addMemories", "getMemories", "searchMemories", "mem0 vercel", "AI SDK provider", "AI SDK memory", or is using generateText/streamText with mem0. Also…

mem0ai/mem0 · 146 tokens

mem0-oss-to-platform

Plan and then execute a migration of a project from the mem0 open-source / self-hosted SDK (the local Memory class) to the mem0 Platform / hosted / managed SDK (the MemoryClient class). Use this whenever a developer wants to move, switch, or migrate their mem0 usage off OSS/self-hosted to the hosted API — e.g.…

mem0ai/mem0 · 273 tokens

docs-build

Build, preview, and validate the Uno documentation website (DocFX) locally — surface real content errors vs expected noise, drive rendered pages with Playwright, and validate external-doc commit bumps in importexternaldocs.ps1 before a PR. Use when working under doc/, editing articles/ markdown, bumping an external…

unoplatform/uno · 97 tokens

add-sample

Create a SamplesApp sample page with correct theming and attributes. Use when adding UI samples for controls.

unoplatform/uno · 21 tokens

speckit-taskstoissues

Convert existing tasks into actionable, dependency-ordered GitHub issues for the feature based on available design artifacts.

unoplatform/uno · 28 tokens

graph-mutation-plan

Cookbook for composing an applygraphmutations plan — stable entitykey patterns, the canonical label/edge vocabulary, evidence/invalidation/confidence discipline, and a worked example. Load this when building a non-trivial mutation plan.

potpie-ai/potpie · 51 tokens