Copying a 400-line build error into a chat box is a job for a pipe.
Print mode reads standard input, so anything you can cat can be the context for a question.
cat build-error.txt | claude -p 'concisely explain the root cause of this build error' > output.txt
The answer lands in output.txt. The same trick works on a diff. The docs have a package.json script that runs git diff main | claude -p as a typo linter.
There is a side benefit to piping a diff: Claude does not need Bash permission to read it, because you already handed it over.
The shape is the same every time: something produces text, Claude reads it, and you get text back. That fits into shell scripts, cron jobs and git hooks without any special glue. Add --output-format json and jq and the answer becomes data a script can branch on. I would reach for this before opening an interactive session for any one-off question about a file.
The caveat is a size cap. Piped input is limited to 10MB. Past that, Claude Code exits with an error and a non-zero status, and you write the content to a file and mention the path in the prompt instead.
Further reading: Run Claude Code programmatically – Claude Code docs, CLI reference – Claude Code docs, On this site: claude -p lets you pipe text into Claude Code from a script, On this site: add –bare to claude -p so scripts run the same everywhere