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: ask Claude to quote the relevant parts first when you hand it a long document

Claude
~/tips/tip-claude-quote-first-long-documents

Find the passages in the contract that say anything about ending it early.

Makes Claude pull the relevant passages out of a long text before it answers.

With a long contract, report or log, an answer can sound confident and rest on a sentence Claude half remembered. One extra step in the prompt makes that visible.

<document>
(paste the rental contract here)
</document>

Find the passages in the contract that say anything about ending it early.
Put them in <quotes> tags. Then, based only on those quotes,
explain what notice I have to give and whether there is a fee.

Anthropic’s prompting guide recommends this for long document tasks: ask Claude to quote the relevant parts first, then do the actual task. It helps Claude focus on the part that matters and ignore the rest of the text.

What I like most is the side effect. The quotes are right there, so you can check them against the document in a few seconds. If a quote isn’t in the source, or says something else than the conclusion claims, you know not to trust the answer.

The XML tags are optional, but they keep the quotes apart from the explanation, which makes the check easier. It works the same in the Claude apps and through the API.

It costs some length, so it isn’t worth it for short texts you can read in full yourself. And it doesn’t make a wrong source right: if the document is outdated, the quotes will be too.

Further reading: Prompting best practices: long context prompting

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

Link