<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Maryam Saba</title>
    <description>The latest articles on DEV Community by Maryam Saba (@maryam_saba_792cdbcdb46fd).</description>
    <link>https://dev.to/maryam_saba_792cdbcdb46fd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3691681%2F738a5cb8-28b2-48d1-8a09-3a973e747cee.png</url>
      <title>DEV Community: Maryam Saba</title>
      <link>https://dev.to/maryam_saba_792cdbcdb46fd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maryam_saba_792cdbcdb46fd"/>
    <language>en</language>
    <item>
      <title>XML Tagging in Prompts: The Secret to Getting Better Output from Claude and GPT</title>
      <dc:creator>Maryam Saba</dc:creator>
      <pubDate>Mon, 03 Aug 2026 20:39:43 +0000</pubDate>
      <link>https://dev.to/maryam_saba_792cdbcdb46fd/xml-tagging-in-prompts-the-secret-to-getting-better-output-from-claude-and-gpt-54e1</link>
      <guid>https://dev.to/maryam_saba_792cdbcdb46fd/xml-tagging-in-prompts-the-secret-to-getting-better-output-from-claude-and-gpt-54e1</guid>
      <description>&lt;h1&gt;
  
  
  XML Tagging in Prompts: The Secret to Getting Better Output from Claude and GPT
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;A simple structuring trick that turns messy, unpredictable LLM outputs into clean, reliable ones.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;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 context, a few examples, formatting rules, and the actual task — the model starts mixing things up. It answers the wrong part of the question. It ignores your formatting instructions. It treats your example output as part of the actual task.&lt;/p&gt;

&lt;p&gt;The fix is almost embarrassingly simple: &lt;strong&gt;wrap your prompt sections in XML tags.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why XML Tags Work So Well
&lt;/h2&gt;

&lt;p&gt;LLMs are trained on enormous amounts of code, documentation, and markup. XML (and HTML) syntax is deeply embedded in that training data, which means models are very good at recognizing where one tagged section ends and another begins. Unlike plain paragraphs — where the boundary between "here's my context" and "here's my instruction" is fuzzy — a tag creates an unambiguous boundary.&lt;/p&gt;

&lt;p&gt;Anthropic actually recommends this explicitly for Claude: wrapping distinct parts of a prompt (instructions, context, examples, output format) in tags like &lt;code&gt;&amp;lt;instructions&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;context&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;example&amp;gt;&lt;/code&gt;, and &lt;code&gt;&amp;lt;output_format&amp;gt;&lt;/code&gt; measurably improves consistency, especially in longer or more complex prompts.&lt;/p&gt;

&lt;p&gt;Think of it like the difference between handing someone a wall of text versus handing them a form with labeled fields. Both contain the same information, but one is far easier to parse correctly — for a human, and for a model.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Before-and-After Example
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Without tags:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Summarize the article below in 3 bullet points. Keep it under 50 words.
Use a neutral tone. Here's an example of the style I want:
"- Company X raised $10M in Series A funding."
Now here's the article: [long article text]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model has to guess where the instructions end and the article begins — and with a long article, it sometimes starts summarizing the example instead of the real content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;With tags:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;instructions&amp;gt;&lt;/span&gt;
Summarize the article in 3 bullet points, under 50 words total.
Use a neutral tone.
&lt;span class="nt"&gt;&amp;lt;/instructions&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;example_style&amp;gt;&lt;/span&gt;
- Company X raised $10M in Series A funding.
&lt;span class="nt"&gt;&amp;lt;/example_style&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;article&amp;gt;&lt;/span&gt;
[long article text]
&lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now there's zero ambiguity. The model knows exactly what's an instruction, what's a style reference, and what's the raw content to work on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Tags Worth Using
&lt;/h2&gt;

&lt;p&gt;You don't need a formal schema — these are just semantic containers the model can recognize. Some of the most useful:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;instructions&amp;gt;&lt;/code&gt; — the actual task&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;context&amp;gt;&lt;/code&gt; — background info the model needs but shouldn't act on directly&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;example&amp;gt;&lt;/code&gt; / &lt;code&gt;&amp;lt;examples&amp;gt;&lt;/code&gt; — sample inputs/outputs (few-shot prompting)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;document&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt; — source text to analyze/transform&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;output_format&amp;gt;&lt;/code&gt; — exactly how you want the response structured&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;thinking&amp;gt;&lt;/code&gt; — for models that support step-by-step reasoning before the final answer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also nest them, e.g., multiple &lt;code&gt;&amp;lt;document index="1"&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;document index="2"&amp;gt;&lt;/code&gt; blocks when feeding several sources at once — attributes work too, and models parse them correctly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus: Ask for Tagged Output Too
&lt;/h2&gt;

&lt;p&gt;This trick isn't just for input — you can ask the model to &lt;em&gt;return&lt;/em&gt; its answer in tags, which makes parsing the response programmatically trivial:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;answer&amp;gt;&lt;/span&gt;
Your final response here.
&lt;span class="nt"&gt;&amp;lt;/answer&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;confidence&amp;gt;&lt;/span&gt;high&lt;span class="nt"&gt;&amp;lt;/confidence&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're building this into an app (say, a Next.js API route calling the AI SDK), this turns a fragile "hope the model formats it right" problem into a simple string-extraction problem — no need for a full JSON schema when you just need one or two fields.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Not to Bother
&lt;/h2&gt;

&lt;p&gt;For a single, simple instruction ("Translate this to French"), tags are overkill — they add noise for no benefit. Reach for XML tagging when your prompt has &lt;strong&gt;multiple distinct components&lt;/strong&gt; that could be confused with each other: instructions + context + examples + a document to process, all in one message.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaway
&lt;/h2&gt;

&lt;p&gt;XML tagging isn't a hack — it's closer to good API design applied to prompts. You're giving the model an explicit contract instead of hoping it infers your intent from prose. The next time a prompt feels like it's "almost working," try wrapping its parts in tags before you start rewriting the wording. Often, structure — not phrasing — was the actual problem.&lt;/p&gt;




</description>
      <category>ai</category>
      <category>chatgpt</category>
      <category>claude</category>
      <category>llm</category>
    </item>
    <item>
      <title>I built an AI bestie for my Dad’s morning routine ⚡️☀️</title>
      <dc:creator>Maryam Saba</dc:creator>
      <pubDate>Sat, 03 Jan 2026 17:50:03 +0000</pubDate>
      <link>https://dev.to/maryam_saba_792cdbcdb46fd/i-built-an-ai-bestie-for-my-dads-morning-routine-1d86</link>
      <guid>https://dev.to/maryam_saba_792cdbcdb46fd/i-built-an-ai-bestie-for-my-dads-morning-routine-1d86</guid>
      <description>&lt;p&gt;Main Character Energy for your Mornings! ☕️✨&lt;/p&gt;

&lt;p&gt;I lowkey got tired of seeing my Dad head to the office stressed, so I built something special. I created an AI Morning Reminder n8n template that sends a healthy, motivational, and straight-up high-vibe quote every morning before he leaves.&lt;/p&gt;

&lt;p&gt;It’s basically a daily dose of "You got this!" delivered straight to his phone. 📈&lt;/p&gt;

&lt;p&gt;Why you need this in your life:&lt;/p&gt;

&lt;p&gt;Parental W: Set it up for your parents to make their day. 🧿&lt;/p&gt;

&lt;p&gt;Main Character Vibes: Use it for yourself to stay locked in on your goals. 🎯&lt;/p&gt;

&lt;p&gt;Fully Automated: Set it once and let the AI do the heavy lifting while you sleep. 😴&lt;/p&gt;

&lt;p&gt;No More Boring Mornings: Start the day with clarity and energy instead of a random notification dump.&lt;/p&gt;

&lt;p&gt;I’m dropping the template so you guys can use it too! Whether it’s for your own growth or to make your family smile, this is the ultimate productivity + mood hack. 🥂&lt;/p&gt;

&lt;p&gt;Grab it here: &lt;a href="https://maryamshine5.gumroad.com/l/ai-morning-reminder-n8n-template" rel="noopener noreferrer"&gt;AI Morning Reminder&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I lowkey got tired of seeing my Dad head to the office stressed, so I built something special. I created an AI Morning Reminder n8n template that sends a healthy, motivational, and straight-up high-vibe quote every morning before he leaves.&lt;/p&gt;

&lt;p&gt;It’s basically a daily dose of "You got this!" delivered straight to his phone. 📈&lt;/p&gt;

&lt;p&gt;Why you need this in your life:&lt;/p&gt;

&lt;p&gt;Parental W: Set it up for your parents to make their day. 🧿&lt;/p&gt;

&lt;p&gt;Main Character Vibes: Use it for yourself to stay locked in on your goals. 🎯&lt;/p&gt;

&lt;p&gt;Fully Automated: Set it once and let the AI do the heavy lifting while you sleep. 😴&lt;/p&gt;

&lt;p&gt;No More Boring Mornings: Start the day with clarity and energy instead of a random notification dump.&lt;/p&gt;

&lt;p&gt;I’m dropping the template so you guys can use it too! Whether it’s for your own growth or to make your family smile, this is the ultimate productivity + mood hack. 🥂&lt;/p&gt;

</description>
      <category>emailautomation</category>
      <category>webdev</category>
      <category>ai</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
