Four advanced Claude prompting techniques, with examples

Practice XML tags, few-shot examples, staged prompts, and structured output using a sample launch update you can check.

1. Separate instructions from source material

Use XML tags when a prompt contains several kinds of material. In the example below, the instructions tell Claude what to produce, and the notes are the evidence. The two dates describe different events. Launch has an unknown date even though the compatibility test has a scheduled date.

Tags make the boundary easier to read. In an application that can send email or modify records, keep approval and permission checks in your own code. Treat the response as a draft until a person or a validator checks it.

Code
<instructions>
Write a launch handoff for the support team.
Use three fields: release_date, risk, and next_step.
Use unknown for a release date that has not been announced.
</instructions>
<notes>
Release date is pending finance approval.
Nina runs the compatibility test on 14 May.
Some exported CSVs use the wrong date format.
</notes>

2. Give examples of the cases you care about

Show Claude one confirmed date and one uncertain date. For a confirmed launch note, show release_date as 20 May. For a note that says only a rehearsal is on 20 May, show release_date as unknown.

Then try a new note with the date 14 May and the owner Nina. The expected output keeps the release date unknown, identifies the CSV date-format risk, and places Nina’s compatibility test under next_step. Keeping a date out of the wrong field is the main test of the exercise.

Anthropic’s prompting guidance

3. Split an error-prone prompt into two passes

On the first pass, have Claude list the evidence for each field. On the second pass, give it only that checked list and ask it to compose the handoff. This helps when a reviewer wants to see exactly where a date, risk, or owner came from.

Try giving the extraction step a second source that proposes a release on 22 May. The first pass should report the proposed date separately from the approval status. The handoff can say approval is pending and flag the proposed date for confirmation.

4. Specify the output and check the values

A human handoff may need three labeled lines. If another program reads the result, describe the schema and the allowed empty values. Claude’s API supports schema-constrained structured output for supported models, and your application still needs to check factual meaning.

For this exercise, test one note with a confirmed date, one with an unknown date, and one with conflicting notes. A passing response places dates in the right fields and preserves uncertainty. Run the same three cases again after editing the prompt.

Claude API structured outputs

Related reading

The Reason Your Prompts Aren't Working

System Prompts Are the Real Leverage

Patterns for Different Kinds of Work