Claude CodeIntermediateClaude Code
claude -p: Claude Code in scripts, with limited tools
Adding -p turns Claude Code into a non-interactive command that takes the prompt, runs and exits: ideal for scripts and CI.
It is the same binary, the same authentication and the same model, just without an interactive session. With --allowedTools you limit what it can use in that run (a review that reads files but does not run shell, for example). --append-system-prompt sets the context for that stage of the pipeline.
Example
# Security review of a PR gh pr diff "$1" | claude -p \ --append-system-prompt "Review for security vulnerabilities" \ --output-format json # Run tests and fix failures claude -p "Run test suite, fix any failures" --allowedTools "Bash,Read,Edit"