Security, Compliance & RAG Best Practices
These are the standing rules for building production Claude applications that combine tool use, retrieval, and sensitive data safely. Use it as a reference during design review, not only at launch.
Search across all documentation pages
These are the standing rules for building production Claude applications that combine tool use, retrieval, and sensitive data safely. Use it as a reference during design review, not only at launch.
<source> or <retrieved_document> give Claude a machine-parseable boundary between trusted instructions and untrusted content.input_schema that still does its job. Prefer enums and internally-resolved values over open-ended string parameters for anything that maps to a real action.additionalProperties: False. This blocks the model from constructing an out-of-scope call at the schema level, before your own validation code even runs.cache_control is not the same as confirming it's working, check cache_read_input_tokens on real traffic.Threat Model Discipline (Section A) and Least-Privilege Tool Scoping (Section C), since they determine the blast radius of everything else. A well-grounded, well-cited RAG answer from an over-privileged tool is still a serious risk if that tool gets manipulated.
Sections A, B, E, and F still apply in reduced form, since even a read-only pipeline has an untrusted-content surface and PII/compliance exposure. Sections C, D, and G are primarily relevant once tool access or caching enters the picture.
The dedicated checklists (tool scoping, SOC2/GDPR, citation and grounding) go deeper on their specific topic with detailed numbered steps. This page is a condensed, cross-cutting summary meant for quick reference and design review, not a replacement for the detailed pages.
A shared credential means every tool inherits the combined permissions of all of them, so a gap in any single tool's validation exposes everything the shared credential can reach. Per-tool credentials keep each tool's actual blast radius equal to its stated scope.
No, it should be one layer among several, paired with delimiter isolation and explicit system-prompt framing. Regex catches known phrasings but misses paraphrases, encoded text, and injections in other languages.
Check the cache_read_input_tokens and cache_creation_input_tokens fields on response usage data across real traffic. A healthy pattern shows many cache reads relative to cache writes.
Poor grounding and poor security overlap more than they first appear, a RAG pipeline that includes low-relevance or unverified chunks is both more likely to hallucinate and more exposed to indirect injection, since a wider, less curated retrieved set is a wider untrusted-content surface.
No, they're written to apply regardless of which vector database, embedding model, or hybrid search implementation you use, the practices concern the pipeline's structure and controls, not a specific vendor's API.
Adding a new tool, connecting a new retrieval source, changing which credentials back existing tools, or expanding what data an agent can access, any of these changes the risk profile enough to warrant walking through the relevant sections again.
They overlap but aren't redundant, Section D focuses on preventing leaks and exfiltration through tool use, Section E adds the specific legal and audit-trail obligations (retention limits, data subject rights, attributable access logging) that apply once PII is involved, whether or not a leak ever occurs.
Stack versions: Written against the Claude model lineup current as of ~June 2026 - Claude Fable 5, Claude Opus 4.8, Claude Sonnet 5 (the default), and Claude Haiku 4.5 - and the official
anthropicPython SDK (latest 0.x release). Model names, pricing, and SDK versions move quickly - verify current specifics at platform.claude.com/docs before relying on them.
Reviewed by Chris St. John·Last updated Jul 19, 2026