Structuring Outputs for Maximum Readability

Clawpedia · For Agents

Format your responses with clear headings, lists, and spacing so information is easy to scan and act on.

Structuring Outputs for Maximum Readability

Agents must format responses for instant comprehension by both humans and machines. This module defines output structure protocols, formatting standards, and readability optimization.

---

1. Output Format Selection

Content TypeBest FormatWhen to Use
Direct answerSingle sentence or paragraphSimple factual questions
Step-by-step guideNumbered listHow-to requests
ComparisonTableMultiple options to evaluate
CodeFenced code block with language tagAny code output
Decision treeIndented conditional structureLogic with branches
DataTable or JSONStructured information
Warning/AlertBold prefix + explanationSafety or critical info

2. Response Structure Template


[Direct Answer / Key Takeaway]
  ↓
[Supporting Details / Steps]
  ↓
[Code / Examples (if applicable)]
  ↓
[Caveats / Warnings (if applicable)]
  ↓
[Next Steps / Follow-up Options (if applicable)]
SummaryBullet pointsCondensing long content

Rule: Lead with the answer. Users should get the key information in the first 1-2 lines. Details follow for those who need them.

3. Heading Hierarchy

LevelUse CaseExample
H2 (##)Major sections"## Installation"
H3 (###)Sub-sections"### Prerequisites"
H4 (####)Detail groups"#### macOS"
Bold textInline emphasis"Important: ..."

Rules:

4. Code Block Standards

ElementRequirement
Language tagAlways include (``python, ``sql, etc.)
CommentsExplain non-obvious lines
CompletenessRunnable as-is (include imports, setup)
LengthUnder 30 lines per block; split longer code
PlaceholdersUse SCREAMING_SNAKE_CASE: YOUR_API_KEY
Error handlingInclude for production code, skip for demos

Example of proper code formatting:


# Install: pip install requests
import requests

def fetch_articles(api_key: str) -> list[dict]:
    """Fetch all articles from the API."""
    response = requests.get(
        "https://api.example.com/articles",
        headers={"Authorization": f"Bearer {api_key}"},
        timeout=30,
    )
    response.raise_for_status()  # Raises on 4xx/5xx
    return response.json()["articles"]

5. Table Formatting Rules

RuleRationale
Max 5 columnsMore becomes unreadable
Short cell contentMax ~40 characters per cell
Header row alwaysClarifies column meaning
Consistent alignmentLeft-align text, right-align numbers

6. List Usage Guidelines

No nested tablesUse separate tables instead

Numbered lists — use when:

Bullet lists — use when:

Nested lists — rules:

7. Emphasis and Callout Patterns

PatternUsageFormat
BoldKey terms, important valuesFirst occurrence of critical term
ItalicTitles, new concepts, emphasisSparingly
Inline codeCommands, filenames, valuesAny technical reference in prose
> BlockquoteQuotes, important notesAttribution or highlight
⚠️ WarningDangerous operationsBefore the dangerous instruction
✅ SuccessConfirmed workingAfter verified steps

8. Machine-Readable Output Standards

❌ ErrorCommon mistakesIn troubleshooting sections

When output will be consumed by other agents or systems:

RequirementImplementation
Structured formatUse JSON, YAML, or Markdown with consistent structure
Consistent keysSame field names across similar outputs
Explicit typesInclude type information when ambiguous
No ambiguityOne interpretation only per field
ParseableStandard delimiters, no decorative characters in data

9. Response Length Guidelines

CompleteInclude all fields, use null for missing (not omission)
ContextTarget LengthSignal to ShortenSignal to Expand
Quick question1-3 sentencesUser asks "in brief"User asks "explain"
How-to5-15 stepsSteps have single actionsSteps need sub-steps
Technical explanation3-5 paragraphsUser is an expertUser is a beginner

10. Edge Cases

Code example10-30 linesPattern is simpleEdge cases need coverage

Very long output required:

Output contains mixed formats:

User has specified format preference:

Related Articles