2 min read

AI Prompt Engineering Markup Best Practices

Written by

IV

Creator

Published on

7/9/2025

When crafting prompts for AI systems, clear markup and structure significantly improve the quality and consistency of responses. Here's a progression from basic to advanced techniques:

Basic Text Formatting

Markdown syntax provides the foundation for clear prompt structure:

# Main Instructions
Use headers to separate major sections of your prompt.
 
## Subtasks
Break complex requests into numbered or bulleted lists:
1. First task
2. Second task
 
**Bold text** for emphasis on critical requirements
*Italic text* for secondary emphasis

Structured Separation

Triple backticks create clear boundaries for different content types:

```python
# Code examples go here
def example_function():
    return "clearly separated"
Input: "What is the capital of France?"
Expected output: "Paris"
**Horizontal rules** (---) help visually separate major sections, whilst **quotation marks** clearly delineate text that should be treated literally.
 
## Intermediate Structuring
 
**XML-style tags** provide semantic meaning and hierarchy:
 
```xml
<instructions>
Your primary role is to analyse the following data.
</instructions>
 
<data>
[Insert data here]
</data>
 
<constraints>
- Must be under 200 words
- Use formal tone
- Include specific examples
</constraints>
 
<output_format>
Provide response in paragraph form with clear conclusions.
</output_format>

This approach allows you to reference specific sections (e.g., "Follow the constraints specified in the section") and creates logical groupings.

Advanced JSON Schema

JSON structure enables precise specification of expected outputs:

{
  "task": "analysis",
  "input_data": "...",
  "requirements": {
    "format": "structured_report",
    "length": "500-800 words",
    "tone": "professional",
    "sections": ["executive_summary", "findings", "recommendations"]
  },
  "output_schema": {
    "executive_summary": "string",
    "findings": ["array", "of", "findings"],
    "recommendations": {
      "immediate": ["string"],
      "long_term": ["string"]
    },
    "confidence_level": "number (0-100)"
  }
}

Advanced Techniques

Multi-layered prompts combine different markup approaches:

# Document Analysis System
 
## Primary Instructions
<role>Expert technical writer</role>
<task>Analyse provided documentation for clarity and completeness</task>
 
## Input Processing

Document type: Technical specification Target audience: Software developers Current status: Draft v2.1

## Analysis Framework
{
  "readability": "assess sentence structure and jargon usage",
  "completeness": "identify missing sections or information",
  "consistency": "check for contradictory statements",
  "actionability": "evaluate whether instructions are implementable"
}
 
## Output Requirements
- **Format**: Structured report with ratings (1-10)
- **Length**: 400-600 words
- **Sections**: Summary, detailed findings, priority recommendations

Conditional logic can be embedded using clear markers:

IF document_type == "technical_spec":
    Focus on accuracy and implementability
ELSE IF document_type == "user_guide":
    Prioritise clarity and accessibility
ENDIF

Best Practices

Consistency in your markup choices throughout a prompt prevents confusion. Hierarchical structure should flow logically from general to specific instructions. Clear boundaries between different types of content (instructions vs. examples vs. constraints) help the AI understand context switches.

Template variables can be marked with special notation:

Analyse the following {{DOCUMENT_TYPE}} for {{TARGET_AUDIENCE}}.
Focus particularly on {{SPECIFIC_CRITERIA}}.

Escape sequences help when you need to include markup literally:

To display actual XML tags, use: \<tag\>content\</tag\>

The key principle is progressive clarification—start with broad instructions, then narrow to specific requirements, examples, and output formats. This structured approach reduces ambiguity and improves response quality significantly.

Latest

More from the site