Machine-readable Claude Code output for a CI policy checker
CCAR-F
Claude Code Configuration & Workflows
Medium
Question 15 of 59
A release pipeline has Claude Code inspect a deployment diff and hand the findings to an automated policy checker. The checker reads named fields, fails the build on any violation, and runs with no human watching, so the payload has to arrive with the same field names and types on every run. Nobody needs to see the run progress as it happens.
How should you configure the Claude Code run so the checker can parse its output?
Show answer and explanation
DPass --output-format json with --json-schema, and read the validated findings from the structured_output field.
Running Claude Code with --output-format json alongside --json-schema constrains the response to the specified JSON Schema and delivers the parsed object in the structured_output property. This guarantees consistent field names and types for automated CI policy checkers. Streaming JSON with verbose flags is intended for live human observation and requires custom stream reassembly. The json output format on its own places unstructured free text inside the result field without schema enforcement. Instructing Claude to return JSON via prompts provides probabilistic formatting rather than deterministic schema guarantees.
Source: code.claude.com/
Anonymous, no account needed. Your tally stays in this browser.
Practice by topic: Claude Code questions