A CI job must run Claude Code and parse the result. Which command fits?
Why B is the answer
claude -p "..." --output-format json
-p runs non-interactively and exits with a status code. --output-format json gives your script something to parse.
In detail
- -p runs Claude Code non-interactively and exits with a status code.
- --output-format json gives your script something to parse.
- Fail the job clearly when parsing fails.
Use case
An illustrative scenario, not a real incident.
A CI job reviews each pull request with claude -p and --output-format json. A script reads the result and posts comments, and the exit code decides pass or fail.
See it in different ways
flowchart LR A["User CLAUDE.md"] --> D["Context for the session"] B["Project CLAUDE.md"] --> D C["CLAUDE.local.md"] --> D E["Skill body"] -.->|"Only when used"| D
flowchart LR S0["CI starts"] --> S1["claude -p"] --> S2["JSON result"] --> S3["Script acts on it"]
Key point: -p for no prompts, and JSON for parsing.
Why the other options are wrong
- A. claude --interactive
- Interactive mode waits for a person, so a CI job would hang.
- C. claude --help
- --help only prints usage.
- D. claude config list
- This reads settings, and runs no task.

