Interactive eBook BuilderInteractive eBook Builder
$59 · unlimited access, unlimited eBooksGet it for $59

· By · 10 min read

How to Use Delimiters in Prompts

promptsaiwritingebook

Delimiters are labels, tags or fences that mark where one part of a prompt ends and another begins, so the model can tell instructions from source notes, examples and the actual request. Official vendor guides agree on the practice, with slightly different emphases. OpenAI’s prompt engineering guide says Markdown headings and lists can mark distinct sections and show hierarchy, while XML tags can show where a piece of content, such as a supporting document, begins and ends. XML attributes can also hold metadata you later refer to in the instructions. Anthropic’s prompting best practices recommend XML tags so Claude can parse mixed prompts unambiguously, with consistent, descriptive names and nested tags when the content has a natural hierarchy. Google’s Gemini 3 prompting guidance says to use clear delimiters to separate parts of the prompt, and that XML-style tags or Markdown headings are effective if you choose one format and use it consistently. OpenAI’s reasoning-model guidance also tells you to use delimiters such as Markdown, XML tags and section titles so the model can interpret each part of the input correctly.

For eBook and workbook projects, Interactive eBook Builder is a $59 one-time Notion AI template with Spec Builder, Drafter, Polisher and SEO BOT already set up, so labeled blocks for notes, outlines and requests can stay consistent from chapter to chapter. Notion AI access and usage are separate from the purchase. The examples below are teaching prompts written for this article, not paid Builder prompts and not recorded model outputs.

Why delimiters matter in book work

A chapter prompt is rarely a single sentence. It usually contains rules, notes, maybe an example, and a request. If those parts run together, the model can treat a constraint as optional color, or treat a sentence in your notes as an instruction. Delimiters do not make the writing better by themselves. They make the brief parsable.

This is especially important when you paste raw material: interview transcripts, old blog posts, research excerpts, or a messy outline. Google’s “add context” guidance is to include the information the model needs to solve the problem. Delimiters are how you show where that information starts and stops, so the model can use it without mixing it up with the job.

Choose one style and stay with it

You do not need all three styles at once. Pick the one you can maintain.

StyleWhat it looks likeWorks well forWatch for
Markdown headings## Notes then the notesChat tools, and prompts you want to reread easilyHeadings that already appear inside pasted chapters
XML-style tags<notes>...</notes>Mixed briefs with instructions, examples and sourcesForgetting to close a tag, or inventing a new name each time
Fenced blocksA code-style fence around a pasted excerptLong quotes, transcripts or sample pagesFences that already appear in the pasted text

OpenAI is comfortable combining Markdown for the overall skeleton with XML for documents and examples. Anthropic leans toward XML when the prompt is complex. Google asks you to pick one format and be consistent inside a single prompt. If you are writing a reusable template, consistency across chapters matters just as much as consistency inside one request. See how to write a prompt template for the larger structure these delimiters sit inside.

A messy prompt, then a delimited one

A messy version looks like this:

You're helping me write a chapter for new freelancers about morning
routines use these notes the venue is not relevant wait that's the
other project. 45 minutes before the first call three days a week
calendar and task list already in use no new apps no supplements
write about 300 words and maybe an example I like a calm tone here's
an old section I wrote last year [long pasted draft] make the new
one better than this but not the same.

A delimited version of the same job:

## Standing rules
Write for new freelancers in plain, calm language. Stay inside the
notes. If a fact is missing, write "Need from me" instead of inventing
it. Do not add supplements or new apps.

## Notes
- The reader has 45 minutes before the first client call, three days a week.
- They already use a calendar and a simple task list.
- The section should help them choose three repeatable actions.

## Example of the voice I want
<example>
You do not need a new identity by 6 a.m. You need three actions that
still fit when a client call moves earlier.
</example>

## Request
Draft a 250 to 350-word section, then a three-step example that totals
45 minutes or less. Do not rewrite or quote the example except as a
voice reference.

The second brief is not longer because it is more literary. It is longer because each part has a door and a wall. If the result still borrows a sentence from the example, you can tighten the request line. If it invents a fourth action, the miss is in the notes boundary, and the delimiter made that boundary visible.

How to label and nest tags

Anthropic’s advice is to use consistent, descriptive names, and to nest tags when the content is hierarchical. For several source documents, their long-context pattern wraps each document in a document tag with subtags such as source and document_content. You can use a lighter version of the same idea for a book:

<documents>
  <document index="1">
    <source>Approved outline, chapter 4</source>
    <document_content>
    [outline]
    </document_content>
  </document>
  <document index="2">
    <source>Interview notes, 3 March</source>
    <document_content>
    [notes]
    </document_content>
  </document>
</documents>

<request>
Using only the outline and interview notes above, draft the section on
naming a floor rate. If the two sources conflict, list the conflict
instead of averaging or inventing a number.
</request>

OpenAI also shows examples wrapped in tags, such as a product review and the desired assistant response, each with an id. The lesson is the same: the tag tells the model what the block is, and the attribute can tell it which block you mean if you refer back to it.

Name tags after the job of the block, not after a cute shorthand you will forget. notes, example, request, and draft_to_edit are clearer than stuff, old, or misc.

Put the source first and the question last

Once the notes are in their own block, put the question after them. Anthropic says to place long-form data near the top, with the query last, and reports that this can improve response quality by up to 30 percent in tests, especially with complex, multi-document inputs. Google’s Gemini 3 guidance says to supply large amounts of context first and place the specific instructions or questions at the very end. For a chapter made of pasted research plus a short request, that order should be the default.

Anthropic also suggests asking the model to quote relevant parts of long documents before carrying out the task, so it focuses on the supported material. That is a useful extra step when you are checking a draft against notes, or turning a transcript into a chapter section.

Common delimiter mistakes

The most common misses are practical, not theoretical:

Delimiters also help when you want a strict output format. You can ask the model to return the reader-facing draft in one tag and a “Need from me” list in another. Our guide to making Claude follow a strict output format goes further on that pattern.

How this fits a longer workflow

A reusable template plus stable delimiters is usually enough to keep a book consistent in a chat tool. In Interactive eBook Builder, Spec Builder, Drafter and Polisher already separate stages, which reduces the chance that planning notes, draft text and editorial comments collapse into one unlabeled pile. You can still use the same heading or tag names in the notes you paste into each stage. SEO BOT can later publish supporting articles to the Auto-Blogger blog, each linking back to your eBook, site and brand; labeled sources matter there too, because an article that cannot tell a claim from a note will not deserve to be published. Keep the supplied setup or adapt it, and review the result.

FAQ

Do I have to use XML if I am not a developer?

No. Markdown headings are enough for many chapter briefs, and Google lists them as an effective option. Use XML-style tags when the prompt mixes several kinds of content, or when headings would collide with the text you are pasting.

Can I invent my own tag names?

Yes, as long as they are descriptive and consistent. Official examples use names such as notes, example, document and request. The model does not need a special reserved vocabulary from you, but it does need to see the same names used the same way.

Should the model’s output use the same tags?

Only when that helps you extract or review it. For a chapter, you might want <draft> and <need_from_me>. For the book itself, you probably want ordinary prose. Say which you want. Do not assume the model will hide its working in tags unless you ask.

Do delimiters reduce hallucinations on their own?

They help the model see the source boundary, which makes it easier to stay inside the notes. They do not, by themselves, stop invention. You still need a rule such as “If a fact is not in the notes, write 'Need from me.'” and you still need to read the result.

Before you hit send

Ship niche eBooks with agents already built.

Get the Interactive eBook Builder for $59