RAG Corpus Hygiene
Purpose
Help agents clean and review a RAG corpus before indexing. This skill focuses on prompt residue, broad retrieval magnets, local paths, private data, malformed metadata, overbroad summaries, and source documents likely to attract wrong queries.
Quick Start
- Run available corpus lint checks before ingestion.
- Review broad summaries, heavily cited docs, role/identity docs, and new evidence manually.
- Replace broad positioning with concrete facts, dates, artifacts, roles, and limitations.
- Move facts into narrow source-specific documents where possible.
- Keep broad overview docs out of normal indexed evidence unless retrieval hooks are narrow.
Operating Constraints
- Do not index prompt instructions or evaluator scaffolding as evidence.
- Do not index local absolute paths, secrets, or private identity details.
- Do not let source maps or broad summaries dominate retrieval for unrelated questions.
- Treat linter warnings as review prompts, not automatic truth.
- Prefer narrow, concrete source documents over catch-all answer banks.
Inputs This Skill Expects
- Corpus root, evidence document schema, and ingestion settings.
- Lint output, changed documents, or known retrieval failures.
- Public/private display policy.
- Chunking defaults and documents excluded from normal retrieval.
Output Contract
- Report corpus hygiene issues by severity.
- Provide exact document repairs or review instructions.
- State which files should be excluded, narrowed, split, or rewritten.
- State whether ingestion is safe or blocked.
Procedure
- Run corpus linting or perform structured review.
- Inspect documents that influence retrieval most.
- Identify prompt residue, evaluator scaffolding, broad retrieval magnets, local paths, secrets, and malformed metadata.
- Repair or quarantine risky documents.
- Re-run lint and spot-check retrieval for representative queries.
- Document remaining warnings and accepted risks.
Pitfalls And Gotchas
- Embedding the assistant's desired behavior inside evidence documents.
- Treating broad summaries as harmless when they dominate semantic retrieval.
- Letting prompt residue become source truth.
- Rewriting precise facts into flowery prose that retrieves poorly.
- Fixing warnings mechanically without reading the document context.
Progressive Disclosure
Start with lint output and the highest-impact documents. Expand into chunking, source exclusion, metadata redesign, or retrieval evals only when hygiene findings explain actual failures.
Verification Pattern
- Confirm lint or structured review was run.
- Confirm local paths, secrets, and prompt residue are removed or intentionally excluded.
- Confirm broad docs have narrow retrieval hooks or are excluded from normal evidence.
- Confirm representative retrieval queries no longer pull irrelevant source magnets.
1---2name: rag-corpus-hygiene3description: Guardrail for linting and reviewing RAG corpora before ingestion, with emphasis on prompt residue, retrieval magnets, public safety, and source hygiene.4---56# RAG Corpus Hygiene78## Purpose9Help agents clean and review a RAG corpus before indexing. This skill focuses on prompt residue, broad retrieval magnets, local paths, private data, malformed metadata, overbroad summaries, and source documents likely to attract wrong queries.1011## Quick Start121. Run available corpus lint checks before ingestion.132. Review broad summaries, heavily cited docs, role/identity docs, and new evidence manually.143. Replace broad positioning with concrete facts, dates, artifacts, roles, and limitations.154. Move facts into narrow source-specific documents where possible.165. Keep broad overview docs out of normal indexed evidence unless retrieval hooks are narrow.1718## Operating Constraints19- Do not index prompt instructions or evaluator scaffolding as evidence.20- Do not index local absolute paths, secrets, or private identity details.21- Do not let source maps or broad summaries dominate retrieval for unrelated questions.22- Treat linter warnings as review prompts, not automatic truth.23- Prefer narrow, concrete source documents over catch-all answer banks.2425## Inputs This Skill Expects26- Corpus root, evidence document schema, and ingestion settings.27- Lint output, changed documents, or known retrieval failures.28- Public/private display policy.29- Chunking defaults and documents excluded from normal retrieval.3031## Output Contract32- Report corpus hygiene issues by severity.33- Provide exact document repairs or review instructions.34- State which files should be excluded, narrowed, split, or rewritten.35- State whether ingestion is safe or blocked.3637## Procedure381. Run corpus linting or perform structured review.392. Inspect documents that influence retrieval most.403. Identify prompt residue, evaluator scaffolding, broad retrieval magnets, local paths, secrets, and malformed metadata.414. Repair or quarantine risky documents.425. Re-run lint and spot-check retrieval for representative queries.436. Document remaining warnings and accepted risks.4445## Pitfalls And Gotchas46- Embedding the assistant's desired behavior inside evidence documents.47- Treating broad summaries as harmless when they dominate semantic retrieval.48- Letting prompt residue become source truth.49- Rewriting precise facts into flowery prose that retrieves poorly.50- Fixing warnings mechanically without reading the document context.5152## Progressive Disclosure53Start with lint output and the highest-impact documents. Expand into chunking, source exclusion, metadata redesign, or retrieval evals only when hygiene findings explain actual failures.5455## Verification Pattern56- Confirm lint or structured review was run.57- Confirm local paths, secrets, and prompt residue are removed or intentionally excluded.58- Confirm broad docs have narrow retrieval hooks or are excluded from normal evidence.59- Confirm representative retrieval queries no longer pull irrelevant source magnets.