LESSON · 1 OF 4

Asking for a format

Asking for a format

Left to itself, a model answers in whatever shape it thinks fits, which is usually a few paragraphs of prose. If you need the answer in a particular form, say so in the prompt. Models follow format instructions well, and a clear format request is one of the cheapest ways to get output you can actually use.

Constrain the shape

Tell the model the exact form you want the answer in:

  • a bulleted list
  • a numbered list
  • a short table
  • a single sentence
  • one word

Compare a vague ask with a shaped one:

bash
claude -p "tell me about the ls command"
bash
claude -p "List three common uses of the ls command as a bulleted list"

The first gives you a wall of text. The second gives you three lines you can drop straight into notes or a script.

Constrain the length

Length is part of the format too. State it in plain terms the model can measure itself against:

  • "in one sentence"
  • "in under 50 words"
  • "exactly 5 items"
  • "a single word, yes or no"
bash
claude -p "Give me exactly 5 git commands a beginner should learn, as a numbered list"

Asking for "exactly 5" is far more reliable than hoping the model stops on its own. If you never cap the length, expect the answer to run long.

Why this matters

A shaped answer is a predictable answer. Once you start feeding a model's reply into a file or another command, a fixed format is what makes that possible. Machine-readable formats like JSON come later in this skill. For now the plain shapes - lists, one-liners, tables - already get you a long way.

Next: when your prompt includes a block of text to work on, delimiters keep your instructions and that text from blurring together.


Your lab setup

This VM comes preconfigured with your AI keys - just type claude to get started. Your key and URL are already set as $OPENAI_BASE_URL and $OPENAI_API_KEY.

Spin up a fresh environment and practice live.
linux-basic-ai · fresh machine · ready in under a minute