The delimiter pattern organizes complex prompts by separating instructions from variable content. Clear section boundaries make reusable templates easier to populate, maintain, review, and debug, especially when they combine multiple data sources. section 4.3
Structure a template by giving each input a labeled boundary:
- Use headings to identify sections and separators to mark transitions. section 4.3
- Fence variable content such as logs, code, or copied text so it does not blend into instructions. section 4.3
- Choose delimiters that do not appear inside the input; switch delimiter types if conflicts arise. section 4.3
Table 4.1 Choosing your delimiters
| Delimiter type |
Best used for |
|---|---|
| Triple backticks ( |
Data or content with special characters; can specify input types like |
| Markdown headings ( # Section) with separators ( ---) |
Human-readable prompt sections that keep each input source easy to identify |
| XML tags ( |
Semantic structure or nested organization |
Compare delimiter choices: fenced blocks suit special-character content, Markdown headings and separators clarify human-readable sections, and XML tags support semantic or nested structure. section 4.3
Multisource bug analysis
A production bug template can place an error log, recent change summary, and relevant code in separate headed and fenced sections, then ask for the most likely root cause in one sentence. This makes each source easy to identify and update independently. section 4.3.1
For content that contains backticks, XML tags can separate the input from the instruction. The pattern mainly improves organization; it does not depend on a particular response change. section 2.7.2 section 4.3
