rag-prep

rag-prep is a skill for Claude Code from sanic732/P2P-4PDA-edition. It costs 168 tokens per session (967 once invoked), scanned A, original, MIT.

A document-preparation skill that cleans and structures source files for retrieval systems, which find relevant passages from a document collection.

In plain words
What is it for?
Preparing documents for NotebookLM, Claude Projects, or another RAG system; RAG means generating answers from retrieved source passages.
Why use it?
It turns long or messy material into clearly separated, self-contained sections that retrieval tools can locate more accurately.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Part of the p2p-v8c3 plugin — 9 skills, 13 commands, 8 agents, 2 hooks shipped together

Good fit Preparing documents for NotebookLM, Claude Projects, or another RAG system; RAG means generating answers from retrieved source passages.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sanic732/p2p-4pda-edition/rag-prep
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 sanic732/P2P-4PDA-edition --skill rag-prep
Clone the repo
git clone --depth 1 https://github.com/sanic732/P2P-4PDA-edition

Made for: Claude Code.

Or install p2p-v8c3, the plugin that ships this one along with the rest of its 9 skills, 13 commands, 8 agents, 2 hooks.

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-prep

README.md
[![agentmods](https://agentmods.dev/badge/skills/sanic732/p2p-4pda-edition/rag-prep/github.svg)](https://agentmods.dev/skills/sanic732/p2p-4pda-edition/rag-prep)
Your own site
<a href="https://agentmods.dev/skills/sanic732/p2p-4pda-edition/rag-prep"><img src="https://agentmods.dev/badge/skills/sanic732/p2p-4pda-edition/rag-prep/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-prep

Your own site · 80×15
<a href="https://agentmods.dev/skills/sanic732/p2p-4pda-edition/rag-prep"><img src="https://agentmods.dev/badge/skills/sanic732/p2p-4pda-edition/rag-prep.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 168 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 967 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.
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.00168 $0.00967
Opus 5 $0.00084 $0.00483
Sonnet 5 $0.00034 $0.00193
Haiku 4.5 $0.00017 $0.00097

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

Security

Grade A, and why

rag-prep 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 9d 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.

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.

editions/8.4.6-C/plugin/.claude/skills/rag-prep/SKILL.md · 63 lines

How it starts

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

rag-prep — подготовка источника под RAG

Превращает сырой/длинный документ в источник, который RAG-движок хорошо режет на чанки и точно извлекает. Это «предварительное редактирование» перед загрузкой в NotebookLM / Claude Project / Cowork.

Когда применять / НЕ применять

Применять: перед загрузкой материала в RAG-источник; чистка «простыни»; структурирование под retrieval. НЕ применять: нужно задать запрос к уже готовой базе (→ rag-grounding); выбрать инструмент/стратегию (→ rag-router).

Принцип

Качество ответа RAG = качество попавших в контекст чанков. Значит каждый чанк должен быть самодостаточным и точно именованным. Правило: один файл = одна семантическая зона, один параграф = одна концепция, один тег = один сигнал.

Что делает (по шагам)

  1. Структура. Режет текст на разделы по Markdown-заголовкам (#, ##) — это естественные границы чанков. Никакого «полотна» без заголовков.
  2. Чанк-безопасность. Логические блоки (IF … THEN, определение+пояснение) держит целиком в одном разделе. Где нужно — закладывает overlap-формулировки на границах.
  3. Frontmatter в шапку файла: source_id, tags, при необходимости depends_on (граф связей).
  4. Якоря и теги. Стабильные #ID на ключевых блоках (для точного lookup) + ## TAGS: … в конце (тематическая выборка).
  5. Чистка и дедуп. Убирает шум/повторы; дубли заменяет ссылкой, а не копией.
  6. Дробление. Если файл несёт несколько зон — предлагает разбить на отдельные файлы (одна зона = один файл) и даёт строку для _INDEX.md.

Полный стандарт разметки (frontmatter, rag_zone, rag_anchor, дедуп, граф зависимостей) — в reference/rag_metaprompt_standard.md; открывать при сложной многофайловой структуре.

Важно (анти-мифы)

  • Большое окно (1M) не отменяет структуру: retrieval-качество ≠ размер окна.
  • Символьный тег [A-P_RULES] в dense-поиске «растворяется» — для надёжного lookup дублируй ID в frontmatter/метаданных и рассчитывай на гибридный поиск.

Read the full file on GitHub · 63 lines

Files

What ships with it

1 file 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. 9d ago First seen · 63 lines · 168 tokens per session scan A cc36f6227aa0

Subscribe to this mod's changes

rag-prep is a skill published in the GitHub repository sanic732/P2P-4PDA-edition (17 stars, last pushed 22d ago), licensed MIT. It adds 168 tokens to every session and 967 once invoked, about $0.0008 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

RAG Chunking Strategy Advisor

Given a document type and retrieval goal, recommends the optimal chunking strategy for a RAG pipeline to minimize retrieval failures.

Notysoty/openagentskills · 31 tokens

markitdown

Convert heterogeneous documents and selected URIs to Markdown with Microsoft MarkItDown for text analysis, search, and LLM/RAG ingestion. Covers safe local conversion, streams, Office/PDF/data formats, batch workflows, plugins, vision OCR, Azure extraction, and the official MCP server.

K-Dense-AI/scientific-agent-skills · 61 tokens

llamaindex

Data framework for building LLM applications with RAG. Specializes in document ingestion (300+ connectors), indexing, and querying. Features vector indices, query engines, agents, and multi-modal support. Use for document Q&A, chatbots, knowledge retrieval, or building RAG pipelines. Best for data-centric LLM…

davila7/claude-code-templates · 70 tokens

azure-ai

Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybrid search, speech-to-text, text-to-speech, transcription, OCR. WHEN: AI Search, query search, vector search, hybrid search, semantic search, speech-to-text, text-to-speech, transcribe, OCR, convert text to speech.

microsoft/skills · 76 tokens

kb-retriever

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

ConardLi/garden-skills · 105 tokens

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