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

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.