Prompt Engineering — Simple Guide learn.auditormachine.com
The Course Chapter 5
Chapter 5

Control the Output Format

Claude will shape its answer any way you ask — a table, a list, one word, a formal letter, or text inside markers you can copy out reliably. This chapter also reveals the trick mentioned in Chapter 1: starting Claude’s answer yourself.


Ask for the answer inside markers

In Chapter 2 we removed the unwanted introduction by saying “skip the preamble”. Another way: tell Claude to put the poem (the same tiny three-line “haiku” from Chapter 2) inside markers. Everything outside the markers becomes easy to ignore — and easy for a program to strip away automatically:

YOU WRITE
Please write a haiku about Rabbit. Put it in <haiku> tags.
CLAUDE ANSWERS
<haiku> Soft ears in moonlight, quiet hops through morning dew — garden shadows dance. </haiku>

“Speaking for Claude” — starting the answer yourself

Remember the turn-taking rule from Chapter 1? Programmers can write the beginning of Claude’s reply, and Claude simply continues from there. It cannot repeat the opening you wrote for it — so it cannot add any introduction before it. If you start Claude’s answer with the opening marker “<haiku>”, the very first thing Claude produces is the poem itself:

YOU WRITE
Please write a haiku about Cat. Put it in <haiku> tags.
YOU START CLAUDE’S ANSWER WITH …
<haiku>
CLAUDE ANSWERS
Silent paws at dusk, golden eyes watch everything — the house belongs to her. </haiku>
You wrote the opening marker as the start of Claude’s reply, and Claude simply continued from it — no introduction possible. This technique is called “prefilling” or “speaking for Claude”.

Structured answers for programs

The same trick forces tidy, machine-readable answers. Ask for the haiku as a structured list of named lines (a format programmers call JSON), pre-fill the opening bracket, and Claude delivers pure structure — no chatter at all:

YOU WRITE
Please write a haiku about Cat. Use JSON format with the keys “first_line”, “second_line”, and “third_line”.
YOU START CLAUDE’S ANSWER WITH …
{
CLAUDE ANSWERS
"first_line": "Whiskers in sunlight", "second_line": "a slow stretch across warm tiles", "third_line": "the day can wait now" }
Claude continued straight from the opening bracket you wrote — pure structure, no chatter around it.

Combining everything

Markers for the input, markers for the output, and multiple changing parts — all in one prompt. Here a casual office message is wrapped in <email> markers, and the answer is requested in its own marked section, rewritten in a highly formal and respectful style:

YOU WRITE
Hey Claude. Here is an email: <email>Hi Zaki, just pinging you for a quick update on that report you were supposed to send.</email> Make this email extremely formal and respectful. Write the new version in <formal_email> tags.
YOU START CLAUDE’S ANSWER WITH …
<formal_email>
CLAUDE ANSWERS
Respected Zaki Sahab, I hope this message finds you in the best of health and spirits. I am writing to kindly request an update regarding the report entrusted to your good self. I would be most grateful for your response at your earliest convenience. With highest regards, </formal_email>
REMEMBER

Never accept a messy answer — name the format you want. Markers keep the answer clean and easy to extract, and pre-filling the first characters of Claude’s reply forces it to start exactly where you want.