Your CI pipeline uses Claude Code to review pull requests. Reviews currently come back as Markdown text. The team wants to post specific findings as inline PR comments at exact file/line locations. Right now they parse the Markdown with regex to extract findings — and it's brittle, breaks on edge cases, and silently drops findings the regex doesn't recognize.
What's the right fix?
Why did you pick that answer? Two or three sentences. The act of articulating it is what builds the judgment — not the click that follows.
--output-format json with --json-schema is the documented way to produce structured output from Claude Code. The schema constrains the response to exactly the fields the downstream consumer needs — no regex parsing, no silent drops, no maintenance burden as the format evolves. This is the pattern any CI integration should reach for first.
Better regex still parses prose — every new edge case adds a new rule to maintain. Structured output via schema eliminates the parsing problem entirely.
Generating Markdown and JSON in the same pass means the model is producing two views of the same review — which can disagree. The human-facing comment says "this is critical"; the JSON says severity 3. Now the team has to reconcile two outputs, and the schema stops being authoritative. Pick one canonical structured output; render Markdown from it if needed.
A second LLM call to parse the first LLM's prose adds latency, cost, and a new probabilistic failure point — to fix a problem that had a deterministic solution. Schema-enforced structured output produces the structured fields directly; using an LLM to rebuild structure from prose is doing the same work twice, badly.