Skip to content

Lesson 5 ยท Prompting Claude

Long Documents and Multi-Step Prompting

Work with long material in Claude: place documents before the question, ask for supporting quotes, split big jobs into steps, and verify quotes with code.

Claude can read a great deal of text at once. As of December 2026, Anthropic's API reference lists a 1-million-token context window for the Fable, Opus, Sonnet and Haiku models named in this course. The limits in the apps can be different and depend on your plan and features. A large window does not mean that every detail gets equal care, so how you arrange long material still matters.

What the context window holds

The context window is everything the model can consider in one go: instructions, your messages, earlier replies, attached text, tool definitions and tool results, plus room for the new answer. Text is measured in tokens, which are pieces of words; see tokenization basics. Token counts depend on the model and the language, so do not rely on a fixed words-to-tokens ratio.

Arrange long prompts

For long material, a reliable order is:

  1. The documents, each in its own tags with a name.
  2. Your instructions and question after them.
TEXT
<documents>
  <document>
    <source>lease-2025.txt</source>
    <content>
    [paste text here]
    </content>
  </document>
  <document>
    <source>lease-2026-draft.txt</source>
    <content>
    [paste text here]
    </content>
  </document>
</documents>

Compare the two leases. Focus on changes that affect the tenant's costs.
First copy the exact sentences you rely on into <quotes> tags, with the
source name. Then explain each change in plain language.
If a topic appears in only one document, say so.

Asking for quotes first does two useful things. It directs attention to the relevant passages, and it gives you something you can check.

Check the quotes

A model can misquote. A quote check is cheap: search the original text for each quoted sentence. This program normalizes spaces and capital letters, then reports which quotes really appear. The "quotes" here are invented for the exercise.

Python Verify that quoted sentences exist in the source

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A found quote proves only that the words exist. You still need to read around it, because a later clause might change its meaning. A missing quote is a clear warning sign.

Split big jobs into steps

One huge request, such as "read these reports, find the problems, rank them and write a board memo", hides where things go wrong. Break it into a chain:

flowchart LR
  A["Extract facts"] --> B["You check facts"]
  B --> C["Analyze and rank"]
  C --> D["Draft memo"]
  D --> E["Review the draft"]

Each step has an output you can inspect before the next one starts.

You can run the chain as several turns in one chat, or as separate chats that receive only the checked result of the previous step. Separate chats keep each step focused.

A useful final step is a review pass: "Check the draft against the extracted facts. List every claim that the facts do not support." This catches some errors. It is not independent proof, because the reviewer can share the writer's blind spots.

Keep long conversations on track

  • Restate the key requirements when the work has changed direction.
  • Ask Claude for a short handoff summary: goal, decisions made, open items. Paste it into a new chat when the old one grows unwieldy.
  • Keep the original files. A summary loses detail.

When you still need to split text

With a very large context window you often will not need to split text. Splitting is still useful when files exceed a limit, when you want to process items independently, or when cost matters. Split on natural boundaries such as headings or paragraphs, never in the middle of a sentence.

Python Plan chunks for a long text

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

If you process chunks separately, remember that none of them sees the others. A rule in chunk 1 may change the meaning of a clause in chunk 4. Include shared definitions in every chunk, and run a final pass that looks for conflicts.

Questions that work well on long material

Some kinds of question are much easier to check than others. Try these shapes:

  • Find all: "List every clause that mentions a deadline, with its section number."
  • Compare: "For each topic, show what document A says, what B says and whether they conflict."
  • Locate gaps: "Which of these ten requirements does the proposal not address?"
  • Trace: "Where does the figure in the summary table come from?"

Each one asks for a structure that you can compare with the source. For "find all" questions, spot-check in the other direction too: search the document yourself for a word such as "deadline" and see whether any match is missing from the list. A list can be correct in every row and still be incomplete.

Also tell Claude what the document is and how reliable it is. "This is an unreviewed draft" or "These are raw meeting notes with possible mistakes" changes how the content should be read. If two documents disagree, say which one wins, or ask for conflicts to be reported without choosing.

A review pass for omissions

After the first answer, run a second pass with a narrow job: "Here is the list you made. Read the document again and look only for items that are missing from it. Quote each one." A focused search for gaps often finds things that a general request for improvement does not. Treat its result in the same way as the first: open the document and confirm each new item. If the work matters, also read the sections where a miss would hurt most, such as exceptions, definitions and appendices, with your own eyes.

Common mistake: asking "Is everything in this document fine?" A vague question invites a vague yes. Ask specific questions: "List every deadline with its date and the party responsible."

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Where is it usually best to put the question when you include long documents?

    Putting instructions and the question after long material is a reliable arrangement.
  2. 2. A quoted sentence is found in the source. What does that prove?

    You still need to check the meaning, the context and the document itself.
  3. 3. Why split a large job into a chain of steps?

    Visible intermediate results make errors easier to find.
  4. 4. What belongs in a handoff summary?

    A short statement of the state of the work lets a new chat continue it.

Summary

  • The context window holds all the input plus the new answer.
  • Tag and name documents, then place your question after them.
  • Request supporting quotes and verify them against the source.
  • Chain steps for big jobs and check results between them.

Next: Working with Files, PDFs and Images

Your progress is saved in this browser. No account needed.