zmime.com
Assistant / coding model · Claude

Prompt for Claude

Claude follows structure well. Tag your inputs, separate instructions from material, and it stays on the rails.

  • XML tags
  • Long documents
  • System prompt
  • Code
01 — Overview

What Claude rewards

Claude responds noticeably well to explicit structure. Wrapping each part of your prompt in tags — <instructions>, <document>, <example>, <format> — reduces the most common failure mode, where the model treats your material as instructions or your instructions as material.

It is also strong on long documents and careful code work. For both, the winning pattern is the same: give the material first, tag it, then state the task and the output contract, and include a rule for what to do when the answer is not present in the source. Anthropic’s prompt engineering docs go deeper on tags, system prompts and thinking controls.

  • 01Reliable instruction following with tagged, structured prompts.
  • 02Long document analysis with quotes and citations.
  • 03Careful code reasoning and review, including agentic coding workflows.
  • 04Extended thinking for problems that need working-out space.
02 — Anatomy

The tagged prompt pattern

  • <role> Who Claude is for this task, in the system prompt where possible.
  • <document> The source material, one tag per source, with attributes for name and date.
  • <instructions> The task, as numbered steps.
  • <constraints> Rules, exclusions, grounding requirements.
  • <example> One input-output pair showing exactly the shape you want.
  • <format> The output contract. Repeat it at the end for long prompts.
03 — The prompts

5 prompts written for Claude

Paste, then replace the [bracketed] parts. Keep the wording identical for anything you want repeated across a set.

Nothing matches that word. Clear the field to see every prompt.

Prompt 01

Tagged document analysis

Contracts, policies and research where the source must govern the answer.

  • long document
  • xml
Template · plain text
<role>
You are a meticulous analyst. You work only from the documents provided.
</role>

<documents>
<document name="[name]" date="[date]">
[paste full text]
</document>
<document name="[name]" date="[date]">
[paste full text]
</document>
</documents>

<instructions>
1. Extract every [obligation / claim / requirement], with the document name and section.
2. Quote the exact supporting text for each, maximum 15 words per quote.
3. Identify conflicts between documents and show both sides.
4. List questions a reader would still need answered, based only on gaps in these documents.
</instructions>

<constraints>
- Use only the documents above. If something is absent, write "not stated in the documents".
- No recommendations, no outside context, no speculation about intent.
- Preserve the documents' own terminology.
</constraints>

<format>
Markdown. One H2 per document, then a "Conflicts" section, then "Open questions". Every bullet ends with a source reference.
</format>
Prompt 02

System prompt for a specialised assistant

A reusable assistant with clear scope and refusal behaviour.

  • system prompt
  • setup
Template · plain text
You are [name], a [role] for [organisation].

<scope>
You help with: [list].
You do not help with: [list]. When asked, briefly say so and point to what you can do.
</scope>

<knowledge>
- The documents supplied in the conversation are the only authority on [our product / policy].
- Never state a price, policy, legal position or statistic that is not in those documents.
- When information is missing, say what is missing and what you would need.
</knowledge>

<style>
- Direct and warm. Answer first, detail after. No filler openings.
- Short paragraphs. Lists only for genuine sequences.
- Reading level: [grade]. Define any term of art on first use.
</style>

<format>
- Default: Markdown, no more than [n] words unless asked.
- Comparisons as tables.
- End with "Sources:" listing the documents you used, or "No sources used".
</format>

<behaviour>
- Ask at most two clarifying questions, then proceed with stated assumptions.
- Flag uncertainty inline as [unverified]; do not hide it.
- If asked to do something outside scope or unsafe, decline briefly and offer an alternative.
</behaviour>
Prompt 03

Code review with tagged context

Reviews that separate blocking issues from taste.

  • code review
  • software
Template · plain text
<role>
You are a senior [language] engineer reviewing a teammate's change.
</role>

<context>
Purpose of the change: [what it does]
Stack: [language, framework, versions]
Conventions: [summary or link]
Risk areas: [auth, data, concurrency, anything user-facing]
</context>

<diff>
[paste the diff]
</diff>

<instructions>
Review in this order and stop at the first category with no findings only if it genuinely has none:
1. Correctness and logic errors
2. Security: input validation, authorisation, secret handling, injection
3. Failure behaviour: timeouts, partial writes, retries, idempotency
4. Performance: N+1 queries, unbounded work, avoidable allocations
5. Tests: what is missing that would have caught a real bug
6. Style: optional, clearly labelled
</instructions>

<format>
A table: severity (blocking / should-fix / nit), file:line, issue, why it matters, suggested change.
Then "Not reviewed:" listing anything the diff alone cannot tell you.
No praise, no summary of the change.
</format>
Prompt 04

Few-shot pattern for consistent formatting

When you need the same output shape across many inputs.

  • few-shot
  • consistency
Template · plain text
<task>
Convert each input into the output format shown in the examples.
</task>

<example>
<input>[realistic input 1]</input>
<output>[exactly the output you want, formatting included]</output>
</example>

<example>
<input>[realistic input 2, ideally a harder case]</input>
<output>[exactly the output you want]</output>
</example>

<rules>
- Match the example format exactly, including punctuation and capitalisation.
- Never add fields or commentary that the examples do not contain.
- If an input lacks the information a field needs, output "[unknown]" for that field.
</rules>

<input>
[the real input]
</input>

Output only the converted result.
Prompt 05

Deep debugging with thinking space

Hard bugs where you want the reasoning before the fix.

  • debugging
  • reasoning
Template · plain text
<problem>
Expected: [behaviour]
Actual: [behaviour]
Reproduction: [exact steps and inputs]
Frequency: [always / intermittent, how often]
Recent changes: [what changed before it started]
</problem>

<evidence>
[paste stack trace, logs, failing test output]
</evidence>

<code>
[paste the smallest code covering the failure path]
</code>

<ruled-out>
[what you have already checked, and how]
</ruled-out>

<instructions>
1. Think through the execution path step by step before concluding anything.
2. Name the root cause and the specific line, or say clearly that the evidence is insufficient and what you would need.
3. Give two alternative hypotheses with a cheap test for each.
4. Propose the minimal fix plus a regression test that fails before it.
5. Note any other latent bug you spotted, without fixing it.
</instructions>
04 — Craft notes

What separates a good prompt from a wasted run

Do this 05

  • Wrap material and instructions in distinct tags.
  • Put durable rules in the system prompt, task material in the user turn.
  • Give one strong example rather than five weak ones.
  • Repeat the output format at the end of long prompts.
  • Include an explicit "not stated in the documents" fallback.

Not this 05

  • Pasting a document with no delimiter around it.
  • Mixing instructions inside the source material.
  • Asking for analysis and a rewrite in one turn.
  • Long prompts with the format buried in the middle.
  • Assuming tags are needed for everything — short asks stay short.
05 — Questions

Asked often, answered plainly

Do XML tags really make a difference?

For prompts with multiple parts, yes. They remove ambiguity about what is material and what is instruction, which is the main cause of a model answering the wrong question. For a one-line request they add nothing.

System prompt or user message?

Durable identity, scope, style and safety rules go in the system prompt. The specific task and its material go in the user message. That split makes the same setup reusable across many tasks.

When should I ask for extended thinking?

When intermediate steps determine correctness: debugging, maths, planning under constraints, or multi-document reconciliation. For formatting and drafting it mostly adds latency.

06 — Sources

Read the primary documentation

Vendors change flags, limits and defaults often. Where this site disagrees with official docs, the docs win.