{
  "id": 101686,
  "title": "XML Tagging in Prompts: The Secret to Getting Better Output from Claude and GPT",
  "url": "https://urgent.news/2026/08/03/xml-tagging-in-prompts-the-secret-to-getting-better-output-from",
  "topic": "ai",
  "section": "AI",
  "published": "2026-08-03T20:39:43.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/maryam_saba_792cdbcdb46fd/xml-tagging-in-prompts-the-secret-to-getting-better-output-from-claude-and-gpt-54e1"
  },
  "original_language": "en",
  "account": "XML tagging is a simple trick that can help improve the output from large language models like Claude and GPT. When writing prompts for these models, it can be challenging to get accurate results when multiple instructions, context, examples, formatting rules, and the actual task are included. The issue arises because the model struggles to distinguish between different sections of the prompt, leading to incorrect answers or ignoring formatting instructions. The solution is to wrap prompt sections in XML tags, which creates clear boundaries for the model to work with. This method leverages the fact that LLMs are trained on code, documentation, and markup, making them adept at recognizing XML syntax. Anthropic recommends using tags such as instructions, context, example, output_format, thinking, document, or article to structure the prompt. By doing so, the model gains a precise understanding of the task, resulting in cleaner, more reliable outputs.",
  "summary": "XML Tagging in Prompts: The Secret to Getting Better Output from Claude and GPT A simple structuring trick that turns messy, unpredictable LLM outputs into clean, reliable ones. If you've spent any time writing prompts for Claude, GPT, or any other large language model, you've probably hit this wall: your prompt works fine for a simple ask, but the moment you pack in multiple instructions — some…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}