brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: put the long document first and your question last in Claude

Claude
~/tips/tip-claude-long-document-top-question-end

Which clauses change the notice period? Quote them first, then explain.

Orders a Claude prompt with the long text first and your question at the end.

My instinct is to start with the question. For long inputs the docs say the opposite order is better.

The prompting guide says to place long documents and inputs near the top of the prompt, above your query, instructions and examples. It adds that queries at the end can improve response quality by up to 30 percent in tests, especially with complex, multi-document inputs.

<documents>
  <document index="1">
    <source>contract_v2.txt</source>
    <document_content>...</document_content>
  </document>
</documents>

Which clauses change the notice period? Quote them first, then explain.

That last sentence is a second trick from the same page: for long documents, ask Claude to quote the relevant parts first, then do the task. It helps the model focus on what matters and ignore the rest.

It costs nothing to try. Paste the document, add your question underneath, and compare the answer with what you got when the question came first. Wrapping several documents in tags with a <source> name, as in the example, helps Claude keep them apart.

The caveat is the number. It comes from Anthropic’s own tests, and “up to” does its usual job. I would take it as a reason to try the order. It is no promise. When you upload a file in the app instead of pasting, the order is less in your hands.

Further reading: Prompting best practices – Claude docs, On this site: wrap each part of a long Claude prompt in its own XML tag, On this site: explain why you want something and Claude aims better

More Claude tips /recap /focus /skill-doctor /autocompact 500k claude purge ~/work/my-repo --dry-run All Claude tips (83) All topics

Link