Prompt Structure & Syntax
Best Formats for AI Prompts
Prompt formatting is not cosmetic. In the Microsoft and MIT benchmark study Does Prompt Formatting Have Any Impact on LLM Performance? (arXiv:2411.10541), switching only the structural syntax between Plain Text, Markdown, YAML, and JSON caused accuracy swings of up to 40% to 42% on identical prompts.
| Format | Best Used For | Avoid For | Token Overhead | Best Model Fit |
|---|---|---|---|---|
| Plain Text | Quick 1-shot questions, brainstorming, reasoning models (o3, GPT-5, Gemini Thinking) | Long multi-doc context, strict API extraction | Lowest (0%) | ChatGPT o3/GPT-5, Gemini |
Markdown (.md) | Universal default for instructions, SKILL.md, AGENTS.md, pasted web pages | Raw untrusted user text with colliding # headings | Very Low (~5-10%) | All models |
| XML Tags | Separating instructions, reference documents, and few-shot examples | Short 2-line conversational asks | Moderate (~10-15%) | Claude (best), GPT-4.1/5, Gemini |
| JSON | Strict structured outputs, API payloads, typed extraction | Input document collections or prose (hurts retrieval & burns tokens) | High (~25-40%) | API output schemas |
| YAML | Compact frontmatter triggers (SKILL.md metadata), flat config lists | Long multi-paragraph prose | Low (20-30% lean vs JSON) | Skill metadata & configs |
| HTML | Asking coding agents (Claude Code, Artifacts) to output dense visual specs | Raw uncleaned webpage paste as input | High as input, dense as output | Claude Code / Artifacts |
Compare the Same Prompt Across 4 Formats
Best universal default for ChatGPT, Claude, and Gemini. Low token overhead and crisp hierarchy.
Markdown (.md)
# Role
You are a senior product marketer auditing a SaaS landing page.
## Context
- Product: Automated invoice tool for freelance designers
- Audience: Solo designers billing $5k-$15k/month
## Task
Review the draft copy below and rewrite the hero section + 3 value bullets.
## Constraints
- Keep sentences under 18 words
- Use concrete numbers instead of vague adjectives
- Output only the rewritten copy in Markdown Best for Claude and long multi-document prompts. Prevents data from bleeding into instructions.
XML Tags
<documents>
<document index="1">
<source>landing-page-draft.md</source>
<content>[Paste draft copy here]</content>
</document>
</documents>
<instructions>
Audit the copy inside <document>. Rewrite the hero headline, subheadline, and 3 value bullets for freelance designers billing $5k-$15k/month.
</instructions>
<constraints>
- Keep every sentence under 18 words
- Replace vague claims with concrete time or money outcomes
- Return clean Markdown inside <rewrite> tags
</constraints> Best for fast 1-shot prompts and reasoning models (o3, GPT-5, Gemini Thinking) when no long docs are attached.
Plain Text
Rewrite this SaaS hero section for freelance designers billing $5k-$15k/month. Keep every sentence under 18 words, replace vague adjectives with concrete time or money outcomes, and return only the headline, subheadline, and 3 bullets.
Draft copy:
[Paste draft copy here] Avoid for feeding long documents in, but use JSON when you need strict typed output for code or APIs.
JSON (Output Only)
Audit the draft landing page copy below and return valid JSON matching this exact schema (no markdown fences):
{
"headline": "string (max 10 words)",
"subheadline": "string (max 20 words)",
"value_bullets": ["string", "string", "string"],
"weakest_original_line": "string",
"why_it_failed": "string"
} Practical Rules to Remember
- Default to Markdown (
.md) for almost everything you type or paste. Strip noisy webpage HTML into clean Markdown before pasting context—Copy Markdown does this in one click without wasting tokens on navigation chrome. - Upgrade to XML tags the moment your prompt mixes instructions with pasted documents, transcripts, or multiple examples. Use clear tags like
<documents>,<instructions>, and<constraints>. - Use JSON on the way out, not on the way in. OpenAI's official GPT-4.1 guide explicitly warns that JSON performs poorly for document collections.
- Use YAML for tiny metadata headers. That is why Claude Skills use YAML frontmatter (~100 tokens) on top of Markdown instructions.