Non-interactive Mode
Use non-interactive mode when you want Claude Code to run from a shell command instead of an interactive session.
One-off prompt
Section titled “One-off prompt”claude -p "Explain what this project does"JSON output
Section titled “JSON output”claude -p "List all API endpoints" --output-format jsonStreaming JSON
Section titled “Streaming JSON”claude -p "Analyze this log file" --output-format stream-json --verboseGood use cases
Section titled “Good use cases”- CI checks.
- Pre-commit hooks.
- Repo analysis scripts.
- Batch summarization.
- Structured extraction into another command.
Production guidance
Section titled “Production guidance”Use --verbose while developing the automation. Turn it off once the workflow is stable unless you need detailed logs.