Anthropic tip: wrap pasted content in tags to guard against prompt injection

minchoi · x · 2026-10-28

Tip #9 of a translated Anthropic prompt-engineering series: emails, documents, and copied webpages may contain instructions Claude shouldn't follow. Wrap pasted material in clearly identified tags (e.g. <externalcontent>) and instruct Claude to treat it as external content and never follow instructions inside — mitigating prompt injection, as shown in an example where a hidden "reply Approved" injection is neutralized.

Related event: Anthropic publishes official prompting best practices for Claude Opus 5.5(13 posts)→

Original post →

More from coding & agent

coding & agent channel →