CCAR-F scenarios › Claude Code for Continuous Integration · Question 49 of 60
Scenario 5 · Claude Code for Continuous Integration
Claude Code runs inside your CI/CD pipeline. It reviews pull requests automatically, proposes test cases, and posts feedback on the PR. The central challenge is writing prompts and configuration that produce actionable findings while keeping false positives low enough that developers keep trusting the output.
Prompt Engineering & Structured Output
Your pipeline posts a readable markdown summary of review findings on each PR. The prompt already lists the four elements every finding needs: location, issue, severity, and suggested fix. Even so, some findings omit the line, others are long paragraphs, and many suggested fixes are vague ("consider refactoring this"). What is the most effective way to get consistent, actionable findings?
Show answer and explanation
Answer: D — Add a few example findings to the prompt that show the exact format, each with a precise location and a concrete, specific suggested fix.
When detailed instructions alone give inconsistent results, few-shot examples are the most effective way to get consistently formatted, actionable output. Section 6 specifically mentions examples showing location, issue, severity, and suggested fix. (a) adds more of the instructions that already aren't working. (b) misreads the symptom: the findings are inconsistent, not cut off. (c) breaks each finding into pieces handled separately and multiplies cost.
More from this scenario
- Developers dismiss about 30% of automated review findings. The team wants to improve the…
- Your pipeline runs `claude -p` to review each pull request, and a script then uses…
- The CI review job re-runs on every push to an open pull request. Developers complain…
- A nightly CI job asks Claude Code to propose new unit tests for recently changed…
- Tests generated in CI are often low value, such as getter checks and assertions that a…